-
Notifications
You must be signed in to change notification settings - Fork 283
N°8692 - Notification - placeholder attributesubitem #778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
accognet
wants to merge
7
commits into
support/3.2
Choose a base branch
from
feature/8692-placeholder_attributesubitem
base: support/3.2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
058e0b2
N°8692 - Notification - placeholder attributesubitem
accognet 93bdb6b
tests
accognet 872f757
tests
accognet ca2fbb9
rollback changes
accognet b4bfa28
Update tests/php-unit-tests/unitary-tests/core/AttributeSubItemTest.php
accognet 6578868
remove unused comment
accognet 4ef07d4
Apply suggestion from @rquetiez
accognet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
tests/php-unit-tests/unitary-tests/core/AttributeSubItemTest.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| <?php | ||
|
|
||
| namespace Combodo\iTop\Test\UnitTest\Core; | ||
|
|
||
| use AttributeDate; | ||
| use AttributeDateTime; | ||
| use Change; | ||
| use Combodo\iTop\Test\UnitTest\ItopDataTestCase; | ||
| use DateTime; | ||
| use MetaModel; | ||
| use UserRequest; | ||
|
|
||
| class AttributeSubItemTest extends ItopDataTestCase | ||
| { | ||
| public const CREATE_TEST_ORG = true; | ||
|
|
||
| /** | ||
| * @param string $sAttCode | ||
| * @param string $sVerb | ||
| * @param string $sExpectedValue | ||
| * | ||
| * @return void | ||
| */ | ||
| public function testGetForTemplate() | ||
| { | ||
| $aUserRequestCustomParams = [ | ||
| 'title' => "Test DisplayStopwatch", | ||
| ]; | ||
| $oUserRequest = $this->CreateUserRequest(456, $aUserRequestCustomParams); | ||
|
|
||
| $iStartDate = time() - 200; | ||
| $oStopwatch = $oUserRequest->Get('ttr'); | ||
| $oStopwatch->DefineThreshold(100, $iStartDate); | ||
| $oUserRequest->Set('ttr', $oStopwatch); | ||
|
|
||
| $sValue = $oUserRequest->Get('ttr_escalation_deadline'); | ||
| $oAttDef = MetaModel::GetAttributeDef(get_class($oUserRequest), 'ttr_escalation_deadline'); | ||
|
|
||
| /* self::assertEquals('Missed by 3 min', MetaModel::ApplyParams('$this->title$', ['this' => $oUserRequest])); | ||
accognet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self::assertEquals('Missed by 3 min', MetaModel::ApplyParams('$this->ttr_escalation_deadline$', ['this' => $oUserRequest])); | ||
| self::assertEquals('Missed by 3 min', MetaModel::ApplyParams('$this->html(ttr_escalation_deadline)$', ['this' => $oUserRequest]));*/ | ||
|
|
||
|
|
||
| self::assertEquals('Missed by 3 min', $oAttDef->GetForTemplate($sValue, 'html', $oUserRequest)); | ||
| $oDateTime = new DateTime(); | ||
| $oDateTime->setTimestamp($iStartDate); | ||
| $sDate = $oDateTime->format(AttributeDateTime::GetFormat()); | ||
| self::assertEquals($sDate, $oAttDef->GetForTemplate($sValue, 'label', $oUserRequest)); | ||
accognet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self::assertEquals('Missed by 3 min', $oAttDef->GetForTemplate($sValue, 'text', $oUserRequest)); | ||
accognet marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self::assertEquals($iStartDate, $oAttDef->GetForTemplate($sValue, '', $oUserRequest)); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.