unify missing parentheses
This commit is contained in:
parent
2888594dbd
commit
077a089b4e
@ -840,7 +840,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getDispatcher()
|
||||
{
|
||||
$dispatcher = new EventDispatcher;
|
||||
$dispatcher = new EventDispatcher();
|
||||
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) {
|
||||
$event->getOutput()->write('before.');
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ class EventTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->event = new Event;
|
||||
$this->event = new Event();
|
||||
$this->dispatcher = new EventDispatcher();
|
||||
}
|
||||
|
||||
|
@ -27,12 +27,12 @@ class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->registry->setAccessible(true);
|
||||
|
||||
$this->guesser = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
|
||||
$this->type = new FooType;
|
||||
$this->type = new FooType();
|
||||
}
|
||||
|
||||
public function testAddType()
|
||||
{
|
||||
$factoryBuilder = new FormFactoryBuilder;
|
||||
$factoryBuilder = new FormFactoryBuilder();
|
||||
$factoryBuilder->addType($this->type);
|
||||
|
||||
$factory = $factoryBuilder->getFormFactory();
|
||||
@ -46,7 +46,7 @@ class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testAddTypeGuesser()
|
||||
{
|
||||
$factoryBuilder = new FormFactoryBuilder;
|
||||
$factoryBuilder = new FormFactoryBuilder();
|
||||
$factoryBuilder->addTypeGuesser($this->guesser);
|
||||
|
||||
$factory = $factoryBuilder->getFormFactory();
|
||||
|
@ -881,14 +881,14 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetContentWorksTwiceInDefaultMode()
|
||||
{
|
||||
$req = new Request;
|
||||
$req = new Request();
|
||||
$this->assertEquals('', $req->getContent());
|
||||
$this->assertEquals('', $req->getContent());
|
||||
}
|
||||
|
||||
public function testGetContentReturnsResource()
|
||||
{
|
||||
$req = new Request;
|
||||
$req = new Request();
|
||||
$retval = $req->getContent(true);
|
||||
$this->assertInternalType('resource', $retval);
|
||||
$this->assertEquals("", fread($retval, 1));
|
||||
@ -901,7 +901,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
|
||||
{
|
||||
$req = new Request;
|
||||
$req = new Request();
|
||||
$req->getContent($first);
|
||||
$req->getContent($second);
|
||||
}
|
||||
@ -1361,7 +1361,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testUrlencodedStringPrefix($string, $prefix, $expect)
|
||||
{
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
|
||||
$me = new \ReflectionMethod($request, 'getUrlencodedPrefix');
|
||||
$me->setAccessible(true);
|
||||
|
@ -758,7 +758,7 @@ class ResponseTest extends ResponseTestCase
|
||||
public function validContentProvider()
|
||||
{
|
||||
return array(
|
||||
'obj' => array(new StringableObject),
|
||||
'obj' => array(new StringableObject()),
|
||||
'string' => array('Foo'),
|
||||
'int' => array(2),
|
||||
);
|
||||
|
@ -59,7 +59,7 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
|
||||
protected function getStorage(array $options = array())
|
||||
{
|
||||
$storage = new NativeSessionStorage($options);
|
||||
$storage->registerBag(new AttributeBag);
|
||||
$storage->registerBag(new AttributeBag());
|
||||
|
||||
return $storage;
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ class PhpSessionStorageTest extends \PHPUnit_Framework_TestCase
|
||||
protected function getStorage()
|
||||
{
|
||||
$storage = new PhpBridgeSessionStorage();
|
||||
$storage->registerBag(new AttributeBag);
|
||||
$storage->registerBag(new AttributeBag());
|
||||
|
||||
return $storage;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
|
||||
$host = $matches[1] ?: $matches[2];
|
||||
$port = $matches[3];
|
||||
|
||||
$memcache = new Memcache;
|
||||
$memcache = new Memcache();
|
||||
$memcache->addServer($host, $port);
|
||||
|
||||
$this->memcache = $memcache;
|
||||
|
@ -42,7 +42,7 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
|
||||
$host = $matches[1] ?: $matches[2];
|
||||
$port = $matches[3];
|
||||
|
||||
$memcached = new Memcached;
|
||||
$memcached = new Memcached();
|
||||
|
||||
//disable compression to allow appending
|
||||
$memcached->setOption(Memcached::OPT_COMPRESSION, false);
|
||||
|
@ -19,7 +19,7 @@ class TimeDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testCollect()
|
||||
{
|
||||
$c = new TimeDataCollector;
|
||||
$c = new TimeDataCollector();
|
||||
|
||||
$request = new Request();
|
||||
$request->server->set('REQUEST_TIME', 1);
|
||||
@ -35,7 +35,7 @@ class TimeDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals(2000, $c->getStartTime());
|
||||
|
||||
$request = new Request();
|
||||
$c->collect($request, new Response);
|
||||
$c->collect($request, new Response());
|
||||
$this->assertEquals(0, $c->getStartTime());
|
||||
|
||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||
|
@ -20,7 +20,7 @@ class DumperPrefixCollectionTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testAddPrefixRoute()
|
||||
{
|
||||
$coll = new DumperPrefixCollection;
|
||||
$coll = new DumperPrefixCollection();
|
||||
$coll->setPrefix('');
|
||||
|
||||
$route = new DumperRoute('bar', new Route('/foo/bar'));
|
||||
@ -66,7 +66,7 @@ EOF;
|
||||
|
||||
public function testMergeSlashNodes()
|
||||
{
|
||||
$coll = new DumperPrefixCollection;
|
||||
$coll = new DumperPrefixCollection();
|
||||
$coll->setPrefix('');
|
||||
|
||||
$route = new DumperRoute('bar', new Route('/foo/bar'));
|
||||
|
@ -76,7 +76,7 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetPattern()
|
||||
{
|
||||
$builder = new MaskBuilder;
|
||||
$builder = new MaskBuilder();
|
||||
$this->assertEquals(MaskBuilder::ALL_OFF, $builder->getPattern());
|
||||
|
||||
$builder->add('view');
|
||||
|
@ -43,7 +43,7 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', 'foo');
|
||||
|
||||
$service
|
||||
@ -106,8 +106,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfaceImplementation()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
||||
$request = new Request;
|
||||
$response = new Response;
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token
|
||||
@ -129,8 +129,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoginSuccessIsNotProcessedWhenRememberMeIsNotRequested()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null));
|
||||
$request = new Request;
|
||||
$response = new Response;
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token
|
||||
@ -153,8 +153,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoginSuccessWhenRememberMeAlwaysIsTrue()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
||||
$request = new Request;
|
||||
$response = new Response;
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token
|
||||
@ -179,9 +179,9 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo[bar]', 'path' => null, 'domain' => null));
|
||||
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->request->set('foo', array('bar' => $value));
|
||||
$response = new Response;
|
||||
$response = new Response();
|
||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token
|
||||
@ -206,9 +206,9 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null));
|
||||
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->request->set('foo', $value);
|
||||
$response = new Response;
|
||||
$response = new Response();
|
||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token
|
||||
|
@ -36,7 +36,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
public function testAutoLoginThrowsExceptionOnInvalidCookie()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->request->set('foo', 'true');
|
||||
$request->cookies->set('foo', 'foo');
|
||||
|
||||
@ -47,7 +47,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
public function testAutoLoginThrowsExceptionOnNonExistentToken()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->request->set('foo', 'true');
|
||||
$request->cookies->set('foo', $this->encodeCookie(array(
|
||||
$series = 'fooseries',
|
||||
@ -70,7 +70,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
{
|
||||
$userProvider = $this->getProvider();
|
||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600, 'secure' => false, 'httponly' => false));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||
|
||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||
@ -95,7 +95,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
{
|
||||
$userProvider = $this->getProvider();
|
||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||
|
||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||
@ -125,7 +125,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
public function testAutoLoginDoesNotAcceptAnExpiredCookie()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||
|
||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||
@ -159,7 +159,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
;
|
||||
|
||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'secure' => false, 'httponly' => false, 'always_remember_me' => true, 'lifetime' => 3600));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||
|
||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||
@ -207,8 +207,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
public function testLogoutSimplyIgnoresNonSetRequestCookie()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
||||
$request = new Request;
|
||||
$response = new Response;
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
|
||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||
@ -229,9 +229,9 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
public function testLogoutSimplyIgnoresInvalidCookie()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', 'somefoovalue');
|
||||
$response = new Response;
|
||||
$response = new Response();
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
|
||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||
@ -259,8 +259,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
||||
public function testLoginSuccessSetsCookieWhenLoggedInWithNonRememberMeTokenInterfaceImplementation()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'domain' => 'myfoodomain.foo', 'path' => '/foo/path', 'secure' => true, 'httponly' => true, 'lifetime' => 3600, 'always_remember_me' => true));
|
||||
$request = new Request;
|
||||
$response = new Response;
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
|
||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
$account
|
||||
|
@ -44,7 +44,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$userProvider = $this->getProvider();
|
||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
||||
|
||||
$userProvider
|
||||
@ -61,7 +61,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$userProvider = $this->getProvider();
|
||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', base64_encode('class:'.base64_encode('foouser').':123456789:fooHash'));
|
||||
|
||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
@ -86,7 +86,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$userProvider = $this->getProvider();
|
||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() - 1, 'foopass'));
|
||||
|
||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
@ -130,7 +130,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
;
|
||||
|
||||
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
|
||||
$request = new Request;
|
||||
$request = new Request();
|
||||
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
||||
|
||||
$returnedToken = $service->autoLogin($request);
|
||||
@ -172,8 +172,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoginSuccessIgnoresTokensWhichDoNotContainAnUserInterfaceImplementation()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
||||
$request = new Request;
|
||||
$response = new Response;
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$token
|
||||
->expects($this->once())
|
||||
@ -193,8 +193,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
||||
public function testLoginSuccess()
|
||||
{
|
||||
$service = $this->getService(null, array('name' => 'foo', 'domain' => 'myfoodomain.foo', 'path' => '/foo/path', 'secure' => true, 'httponly' => true, 'lifetime' => 3600, 'always_remember_me' => true));
|
||||
$request = new Request;
|
||||
$response = new Response;
|
||||
$request = new Request();
|
||||
$response = new Response();
|
||||
|
||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||
|
@ -19,7 +19,7 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->encoder = new JsonEncoder;
|
||||
$this->encoder = new JsonEncoder();
|
||||
$this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
|
||||
}
|
||||
|
||||
|
@ -24,14 +24,14 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->encoder = new XmlEncoder;
|
||||
$this->encoder = new XmlEncoder();
|
||||
$serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder()));
|
||||
$this->encoder->setSerializer($serializer);
|
||||
}
|
||||
|
||||
public function testEncodeScalar()
|
||||
{
|
||||
$obj = new ScalarDummy;
|
||||
$obj = new ScalarDummy();
|
||||
$obj->xmlFoo = "foo";
|
||||
|
||||
$expected = '<?xml version="1.0"?>'."\n".
|
||||
@ -42,7 +42,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSetRootNodeName()
|
||||
{
|
||||
$obj = new ScalarDummy;
|
||||
$obj = new ScalarDummy();
|
||||
$obj->xmlFoo = "foo";
|
||||
|
||||
$this->encoder->setRootNodeName('test');
|
||||
@ -63,7 +63,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testAttributes()
|
||||
{
|
||||
$obj = new ScalarDummy;
|
||||
$obj = new ScalarDummy();
|
||||
$obj->xmlFoo = array(
|
||||
'foo-bar' => array(
|
||||
'@id' => 1,
|
||||
@ -92,7 +92,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testElementNameValid()
|
||||
{
|
||||
$obj = new ScalarDummy;
|
||||
$obj = new ScalarDummy();
|
||||
$obj->xmlFoo = array(
|
||||
'foo-bar' => 'a',
|
||||
'foo_bar' => 'a',
|
||||
@ -206,7 +206,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
public function testEncodeSerializerXmlRootNodeNameOption()
|
||||
{
|
||||
$options = array('xml_root_node_name' => 'test');
|
||||
$this->encoder = new XmlEncoder;
|
||||
$this->encoder = new XmlEncoder();
|
||||
$serializer = new Serializer(array(), array('xml' => new XmlEncoder()));
|
||||
$this->encoder->setSerializer($serializer);
|
||||
|
||||
@ -289,7 +289,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testDecodeWithoutItemHash()
|
||||
{
|
||||
$obj = new ScalarDummy;
|
||||
$obj = new ScalarDummy();
|
||||
$obj->xmlFoo = array(
|
||||
'foo-bar' => array(
|
||||
'@key' => "value",
|
||||
@ -362,7 +362,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
protected function getObject()
|
||||
{
|
||||
$obj = new Dummy;
|
||||
$obj = new Dummy();
|
||||
$obj->foo = 'foo';
|
||||
$obj->bar = array('a', 'b');
|
||||
$obj->baz = array('key' => 'val', 'key2' => 'val', 'A B' => 'bar', 'item' => array(array('title' => 'title1'), array('title' => 'title2')), 'Barry' => array('FooBar' => array('Baz' => 'Ed', '@id' => 1)));
|
||||
|
@ -19,13 +19,13 @@ class CustomNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->normalizer = new CustomNormalizer;
|
||||
$this->normalizer->setSerializer(new Serializer);
|
||||
$this->normalizer = new CustomNormalizer();
|
||||
$this->normalizer->setSerializer(new Serializer());
|
||||
}
|
||||
|
||||
public function testSerialize()
|
||||
{
|
||||
$obj = new ScalarDummy;
|
||||
$obj = new ScalarDummy();
|
||||
$obj->foo = 'foo';
|
||||
$obj->xmlFoo = 'xml';
|
||||
$this->assertEquals('foo', $this->normalizer->normalize($obj, 'json'));
|
||||
@ -34,18 +34,18 @@ class CustomNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testDeserialize()
|
||||
{
|
||||
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy), 'xml');
|
||||
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy()), 'xml');
|
||||
$this->assertEquals('foo', $obj->xmlFoo);
|
||||
$this->assertNull($obj->foo);
|
||||
|
||||
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy), 'json');
|
||||
$obj = $this->normalizer->denormalize('foo', get_class(new ScalarDummy()), 'json');
|
||||
$this->assertEquals('foo', $obj->foo);
|
||||
$this->assertNull($obj->xmlFoo);
|
||||
}
|
||||
|
||||
public function testSupportsNormalization()
|
||||
{
|
||||
$this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy));
|
||||
$this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy()));
|
||||
$this->assertFalse($this->normalizer->supportsNormalization(new \stdClass));
|
||||
}
|
||||
|
||||
|
@ -17,13 +17,13 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
protected function setUp()
|
||||
{
|
||||
$this->normalizer = new GetSetMethodNormalizer;
|
||||
$this->normalizer = new GetSetMethodNormalizer();
|
||||
$this->normalizer->setSerializer($this->getMock('Symfony\Component\Serializer\Serializer'));
|
||||
}
|
||||
|
||||
public function testNormalize()
|
||||
{
|
||||
$obj = new GetSetDummy;
|
||||
$obj = new GetSetDummy();
|
||||
$obj->setFoo('foo');
|
||||
$obj->setBar('bar');
|
||||
$obj->setCamelCase('camelcase');
|
||||
@ -118,7 +118,7 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'camelCase'));
|
||||
|
||||
$obj = new GetSetDummy;
|
||||
$obj = new GetSetDummy();
|
||||
$obj->setFoo('foo');
|
||||
$obj->setBar('bar');
|
||||
|
||||
|
@ -34,14 +34,14 @@ class SerializerTest extends \PHPUnit_Framework_TestCase
|
||||
public function testNormalizeTraversable()
|
||||
{
|
||||
$this->serializer = new Serializer(array(), array('json' => new JsonEncoder()));
|
||||
$result = $this->serializer->serialize(new TraversableDummy, 'json');
|
||||
$result = $this->serializer->serialize(new TraversableDummy(), 'json');
|
||||
$this->assertEquals('{"foo":"foo","bar":"bar"}', $result);
|
||||
}
|
||||
|
||||
public function testNormalizeGivesPriorityToInterfaceOverTraversable()
|
||||
{
|
||||
$this->serializer = new Serializer(array(new CustomNormalizer), array('json' => new JsonEncoder()));
|
||||
$result = $this->serializer->serialize(new NormalizableTraversableDummy, 'json');
|
||||
$this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
|
||||
$result = $this->serializer->serialize(new NormalizableTraversableDummy(), 'json');
|
||||
$this->assertEquals('{"foo":"normalizedFoo","bar":"normalizedBar"}', $result);
|
||||
}
|
||||
|
||||
|
@ -143,14 +143,14 @@ class ConstraintTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testGetTargetsCanBeString()
|
||||
{
|
||||
$constraint = new ClassConstraint;
|
||||
$constraint = new ClassConstraint();
|
||||
|
||||
$this->assertEquals('class', $constraint->getTargets());
|
||||
}
|
||||
|
||||
public function testGetTargetsCanBeArray()
|
||||
{
|
||||
$constraint = new ConstraintA;
|
||||
$constraint = new ConstraintA();
|
||||
|
||||
$this->assertEquals(array('property', 'class'), $constraint->getTargets());
|
||||
}
|
||||
|
Reference in New Issue
Block a user