for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
use \FOS\ElasticaBundle\Serializer\Callback;
class CallbackTest extends PHPUnit_Framework_TestCase
{
public function testSerializerMustHaveSerializeMethod()
$callback = new Callback();
$this->setExpectedException('RuntimeException', 'The serializer must have a "serialize" method.');
$callback->setSerializer(new \stdClass());
}
public function testSetGroupsWorksWithValidSerializer()
$serializer = $this->getMock('Symfony\Component\Serializer\Serializer', array(), array(), '', false);
$callback->setSerializer($serializer);
$callback->setGroups(array('foo'));
public function testSetGroupsFailsWithInvalidSerializer()
$serializer = $this->getMockBuilder('FakeSerializer')->setMethods(array('serialize'))->getMock();
$this->setExpectedException(
'RuntimeException',
'Setting serialization groups requires using "JMS\Serializer\Serializer" or '
. '"Symfony\Component\Serializer\Serializer"'
);