| Conditions | 1 |
| Paths | 1 |
| Total Lines | 18 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | public function testValue() |
||
| 13 | { |
||
| 14 | $gridfield = new GridField('Test'); |
||
| 15 | |||
| 16 | $state = new GridState($gridfield); |
||
| 17 | $this->assertEquals('{}', $state->Value(), 'GridState without any data has empty JSON object for Value'); |
||
| 18 | |||
| 19 | $data = $state->getData(); |
||
| 20 | $data->initDefaults(['Foo' => 'Bar']); |
||
| 21 | |||
| 22 | $this->assertEquals('{}', $state->Value(), 'GridState without change has empty JSON object for Value'); |
||
| 23 | |||
| 24 | $data->Foo = 'Barrr'; |
||
|
|
|||
| 25 | |||
| 26 | $this->assertEquals( |
||
| 27 | '{"Foo":"Barrr"}', |
||
| 28 | $state->Value(), |
||
| 29 | 'GridState with changes returns has a JSON object string for Value.' |
||
| 30 | ); |
||
| 33 |