| @@ 19-33 (lines=15) @@ | ||
| 16 | */ |
|
| 17 | class SerializerTest extends WebTestCase |
|
| 18 | { |
|
| 19 | public function testMappingIteratorToArrayField() |
|
| 20 | { |
|
| 21 | $client = $this->createClient(array('test_case' => 'Serializer')); |
|
| 22 | $persister = $client->getContainer()->get('fos_elastica.object_persister.index.type'); |
|
| 23 | ||
| 24 | $object = new TypeObj(); |
|
| 25 | $object->id = 1; |
|
| 26 | $object->coll = new \ArrayIterator(array('foo', 'bar')); |
|
| 27 | $persister->insertOne($object); |
|
| 28 | ||
| 29 | $object->coll = new \ArrayIterator(array('foo', 'bar', 'bazz')); |
|
| 30 | $object->coll->offsetUnset(1); |
|
| 31 | ||
| 32 | $persister->replaceOne($object); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * Tests that the serialize_null configuration attribute works |
|
| @@ 80-94 (lines=15) @@ | ||
| 77 | $this->assertNotEmpty($mapping, 'Mapping was populated'); |
|
| 78 | } |
|
| 79 | ||
| 80 | public function testMappingIteratorToArrayField() |
|
| 81 | { |
|
| 82 | $client = $this->createClient(array('test_case' => 'ORM')); |
|
| 83 | $persister = $client->getContainer()->get('fos_elastica.object_persister.index.type'); |
|
| 84 | ||
| 85 | $object = new TypeObj(); |
|
| 86 | $object->id = 1; |
|
| 87 | $object->coll = new \ArrayIterator(array('foo', 'bar')); |
|
| 88 | $persister->insertOne($object); |
|
| 89 | ||
| 90 | $object->coll = new \ArrayIterator(array('foo', 'bar', 'bazz')); |
|
| 91 | $object->coll->offsetUnset(1); |
|
| 92 | ||
| 93 | $persister->replaceOne($object); |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| 97 | * @param Client $client |
|