|
@@ 27-36 (lines=10) @@
|
| 24 |
|
|
| 25 |
|
class CastToStringPropertyAccessorTest extends \PHPUnit_Framework_TestCase |
| 26 |
|
{ |
| 27 |
|
public function testThatCanCastObjectToString() |
| 28 |
|
{ |
| 29 |
|
$id = new IdentifierWithToString('id'); |
| 30 |
|
$array = array( |
| 31 |
|
'a' => $id |
| 32 |
|
); |
| 33 |
|
$propertyAccessor = new CastToStringPropertyAccessor(); |
| 34 |
|
|
| 35 |
|
$this->assertEquals('id', $propertyAccessor->getValue($array, '[a]')); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
public function testThatWontCastObjectWithoutToString() |
| 39 |
|
{ |
|
@@ 38-47 (lines=10) @@
|
| 35 |
|
$this->assertEquals('id', $propertyAccessor->getValue($array, '[a]')); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
public function testThatWontCastObjectWithoutToString() |
| 39 |
|
{ |
| 40 |
|
$id = new IdentifierWithoutToString('id'); |
| 41 |
|
$array = array( |
| 42 |
|
'a' => $id |
| 43 |
|
); |
| 44 |
|
$propertyAccessor = new CastToStringPropertyAccessor(); |
| 45 |
|
|
| 46 |
|
$this->assertEquals($id, $propertyAccessor->getValue($array, '[a]')); |
| 47 |
|
} |
| 48 |
|
|
| 49 |
|
public function testThatWontCastIntToString() |
| 50 |
|
{ |