-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ApplicationLicenceList ByOrganisation now uses OrganisationOpti…
…onal (#30) * feat: Msg ApplicationLicenceList ByOrganisation now uses OrganisationOptional * chore: added unit test for query * fix: Fixed existing unit test using incorrect property
- Loading branch information
Showing
3 changed files
with
107 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
104 changes: 104 additions & 0 deletions
104
test/Query/Messaging/ApplicationLicenceList/ByOrganisationTest.php
This file contains 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,104 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Dvsa\OlcsTest\Transfer\Query\Messaging\ApplicationLicenceList; | ||
|
||
use Dvsa\Olcs\Transfer\Query\Messaging\ApplicationLicenceList\ByOrganisation; | ||
use Dvsa\OlcsTest\Transfer\DtoWithoutOptionalFieldsTest; | ||
use Dvsa\OlcsTest\Transfer\Query\QueryTest; | ||
use Laminas\Stdlib\ArraySerializableInterface; | ||
|
||
class ByOrganisationTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
use QueryTest, DtoWithoutOptionalFieldsTest { | ||
DtoWithoutOptionalFieldsTest::testDefaultValues insteadof QueryTest; | ||
} | ||
|
||
/** | ||
* Should return a new blank DTO on which to run tests | ||
* | ||
* @return ArraySerializableInterface | ||
*/ | ||
protected function createBlankDto() | ||
{ | ||
return new ByOrganisation(); | ||
} | ||
|
||
/** | ||
* Should return an array of valid field values (i.e. those which should pass validation) | ||
* | ||
* for example: | ||
* | ||
* return [ | ||
* 'fieldName' => [ | ||
* 'good-value-1', | ||
* 'good-value-2', | ||
* ], | ||
* 'anotherFieldName' => ['good-value'], | ||
* ]; | ||
* | ||
* @return array | ||
*/ | ||
protected function getValidFieldValues() | ||
{ | ||
return [ | ||
'organisation' => [ | ||
'1', | ||
null, | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* Should return an array of invalid field values (i.e. those which should fail validation) | ||
* | ||
* for example: | ||
* | ||
* return [ | ||
* 'fieldName' => [ | ||
* 'bad-value-1', | ||
* 'bad-value-2', | ||
* ], | ||
* 'anotherFieldName' => ['bad-value'], | ||
* ]; | ||
* | ||
* @return array | ||
*/ | ||
protected function getInvalidFieldValues() | ||
{ | ||
$invalidNumbers = [ | ||
0, | ||
]; | ||
|
||
return [ | ||
'organisation' => $invalidNumbers, | ||
]; | ||
} | ||
|
||
/** | ||
* Should return an array of expected transformations which input filters should apply to fields | ||
* | ||
* for example: | ||
* | ||
* return [ | ||
* 'fieldWhichGetsTrimmed' => [[' string ', 'string']], | ||
* 'fieldWhichFiltersOutNonNumericDigits => [ | ||
* ['a1b2c3', '123'], | ||
* [99, '99'], | ||
* ], | ||
* ]; | ||
* | ||
* Tests expect the function 'getFoo' to exist for the function 'foo'. | ||
* | ||
* This DOES NOT assert that the value gets validated. To do that @see DtoTest::getValidFieldValues | ||
* | ||
* @return array | ||
*/ | ||
protected function getFilterTransformations() | ||
{ | ||
return [ | ||
'organisation' => [[99, '99']], | ||
]; | ||
} | ||
} |
This file contains 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