Conditions | 1 |
Paths | 1 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
12 | public function testFieldsAndFiltersAreRemovedAfterChangingIdentifier() |
||
13 | { |
||
14 | /** @var Resource $resource */ |
||
15 | $resource = $this->objFromFixture(Resource::class, 'teachers'); |
||
16 | |||
17 | $this->assertGreaterThan(0, $resource->Fields()->count(), 'Fixtures should load relationships'); |
||
18 | $this->assertGreaterThan(0, $resource->Filters()->count(), 'Fixtures should load relationships'); |
||
19 | |||
20 | // Change name, relationships should be retained |
||
21 | $resource->Name = 'Primary Teachers'; |
||
|
|||
22 | $resource->write(); |
||
23 | |||
24 | $this->assertGreaterThan(0, $resource->Fields()->count(), 'Changing name should not affect relations'); |
||
25 | $this->assertGreaterThan(0, $resource->Filters()->count(), 'Changing name should not affect relations'); |
||
26 | |||
27 | // Change identifier, relationships should be removed |
||
28 | $resource->Identifier = 'something-different'; |
||
29 | $resource->write(); |
||
30 | |||
31 | $this->assertCount(0, $resource->Fields(), 'Changing identifier should clear fields'); |
||
32 | $this->assertCount(0, $resource->Filters(), 'Changing identifier should clear filters'); |
||
33 | } |
||
35 |