1 | <?php |
||
5 | use FOS\ElasticaBundle\Serializer\Callback; |
||
6 | |||
7 | class CallbackTest extends PHPUnit_Framework_TestCase |
||
8 | { |
||
9 | public function testSerializerMustHaveSerializeMethod() |
||
15 | |||
16 | public function testSetGroupsWorksWithValidSerializer() |
||
24 | |||
25 | public function testSetGroupsFailsWithInvalidSerializer() |
||
26 | { |
||
27 | $callback = new Callback(); |
||
28 | $serializer = $this->getMockBuilder('FakeSerializer')->setMethods(array('serialize'))->getMock(); |
||
29 | $callback->setSerializer($serializer); |
||
30 | |||
31 | $this->setExpectedException( |
||
32 | 'RuntimeException', |
||
33 | 'Setting serialization groups requires using "JMS\Serializer\Serializer" or ' |
||
34 | . '"Symfony\Component\Serializer\Serializer"' |
||
35 | ); |
||
36 | |||
37 | $callback->setGroups(array('foo')); |
||
38 | } |
||
40 |