-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow industry classification description to be nullable (#7)
- Loading branch information
1 parent
784ff34
commit 31df6a0
Showing
2 changed files
with
58 additions
and
1 deletion.
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
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,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hyra\Tests\NzCompaniesOfficeLookup\Model; | ||
|
||
use Hyra\NzCompaniesOfficeLookup\Model\IndustryClassificationsResponse; | ||
|
||
final class IndustryClassificationResponseTest extends BaseModelTest | ||
{ | ||
public function testValidModel(): void | ||
{ | ||
$data = <<<JSON | ||
{ | ||
"classificationCode": "C121220", | ||
"classificationDescription": "Breweries", | ||
"uniqueIdentifier": "140987" | ||
} | ||
JSON; | ||
|
||
/** @var IndustryClassificationsResponse $parsed */ | ||
$parsed = $this->valid($data, IndustryClassificationsResponse::class); | ||
|
||
static::assertSame('C121220', $parsed->code); | ||
static::assertSame('Breweries', $parsed->description); | ||
} | ||
|
||
public function testValidModelWithoutDescription(): void | ||
{ | ||
$data = <<<JSON | ||
{ | ||
"classificationCode": "C121220", | ||
"classificationDescription": null, | ||
"uniqueIdentifier": "140987" | ||
} | ||
JSON; | ||
|
||
/** @var IndustryClassificationsResponse $parsed */ | ||
$parsed = $this->valid($data, IndustryClassificationsResponse::class); | ||
|
||
static::assertSame('C121220', $parsed->code); | ||
static::assertNull($parsed->description); | ||
} | ||
|
||
public function testInvalidModel(): void | ||
{ | ||
$data = <<<JSON | ||
{ | ||
"classificationCode": null, | ||
"classificationDescription": "Breweries", | ||
"uniqueIdentifier": "140987" | ||
} | ||
JSON; | ||
|
||
$this->invalid($data, IndustryClassificationsResponse::class); | ||
} | ||
} |