-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathIssue72Test.php
More file actions
46 lines (37 loc) · 1.42 KB
/
Issue72Test.php
File metadata and controls
46 lines (37 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
declare(strict_types=1);
namespace PHPModelGenerator\Tests\Issues\Issue;
use PHPModelGenerator\Tests\Issues\AbstractIssueTest;
class Issue72Test extends AbstractIssueTest
{
/**
* If a root OneOf composition uses branches which only provide examples (which should cause every input to pass)
* ignore those branches as it's most likely an error in the schema. The generation process will emit a warning.
*/
public function testExampleOneOfBranchIsSkipped(): void
{
$className = $this->generateClassFromFile('OneOfExample.json');
$object = new $className(['label' => 'Hannes']);
$this->assertSame('Hannes', $object->getLabel());
}
public function testNestedAllOf(): void
{
$this->markTestSkipped('Not functional yet');
$className = $this->generateClassFromFile('NestedAllOf.json');
$company = new $className([
'CEO' => [
'yearsInCompany' => 10,
'name' => 'Hannes',
'salary' => 10000,
'assistance' => [
'yearsInCompany' => 4,
'name' => 'Dieter',
'salary' => 8000,
],
],
]);
$this->assertSame(10, $company->getCEO()->getYearsInCompany());
$this->assertSame('Hannes', $company->getCEO()->getName());
$this->assertSame(10000, $company->getCEO()->getSalary());
}
}