|
@@ 31-41 (lines=11) @@
|
| 28 |
|
class CollectionTest extends \PHPUnit_Framework_TestCase |
| 29 |
|
{ |
| 30 |
|
|
| 31 |
|
public function testAnExistingPropertyCanBeAccessed() |
| 32 |
|
{ |
| 33 |
|
$graphNode = new Collection(['foo' => 'bar']); |
| 34 |
|
|
| 35 |
|
$field = $graphNode->getField('foo'); |
| 36 |
|
$this->assertEquals('bar', $field); |
| 37 |
|
|
| 38 |
|
// @todo v6: Remove this assertion |
| 39 |
|
$property = $graphNode->getProperty('foo'); |
| 40 |
|
$this->assertEquals('bar', $property); |
| 41 |
|
} |
| 42 |
|
|
| 43 |
|
public function testAMissingPropertyWillReturnNull() |
| 44 |
|
{ |
|
@@ 51-61 (lines=11) @@
|
| 48 |
|
$this->assertNull($field, 'Expected the property to return null.'); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
public function testAMissingPropertyWillReturnTheDefault() |
| 52 |
|
{ |
| 53 |
|
$graphNode = new Collection(['foo' => 'bar']); |
| 54 |
|
|
| 55 |
|
$field = $graphNode->getField('baz', 'faz'); |
| 56 |
|
$this->assertEquals('faz', $field); |
| 57 |
|
|
| 58 |
|
// @todo v6: Remove this assertion |
| 59 |
|
$property = $graphNode->getProperty('baz', 'faz'); |
| 60 |
|
$this->assertEquals('faz', $property); |
| 61 |
|
} |
| 62 |
|
|
| 63 |
|
public function testFalseDefaultsWillReturnSameType() |
| 64 |
|
{ |