fixed various inconsistencies
This commit is contained in:
parent
f964cc8474
commit
eb3f6c6efb
@ -92,7 +92,8 @@ class EntityUserProvider implements UserProviderInterface
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $refreshedUser = $this->repository->find($id)) {
|
$refreshedUser = $this->repository->find($id);
|
||||||
|
if (null === $refreshedUser) {
|
||||||
throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id)));
|
throw new UsernameNotFoundException(sprintf('User with id %s not found', json_encode($id)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
|
namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping AS ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity
|
* @ORM\Entity
|
||||||
|
@ -22,7 +22,7 @@ class CompilerDebugDumpPass implements CompilerPassInterface
|
|||||||
{
|
{
|
||||||
$filesystem = new Filesystem();
|
$filesystem = new Filesystem();
|
||||||
$filesystem->dumpFile(
|
$filesystem->dumpFile(
|
||||||
$this->getCompilerLogFilename($container),
|
self::getCompilerLogFilename($container),
|
||||||
implode("\n", $container->getCompiler()->getLog()),
|
implode("\n", $container->getCompiler()->getLog()),
|
||||||
0666 & ~umask()
|
0666 & ~umask()
|
||||||
);
|
);
|
||||||
|
@ -37,7 +37,7 @@ class TemplateFinderTest extends TestCase
|
|||||||
->will($this->returnValue(array('BaseBundle' => new BaseBundle())))
|
->will($this->returnValue(array('BaseBundle' => new BaseBundle())))
|
||||||
;
|
;
|
||||||
|
|
||||||
$parser = new TemplateFilenameParser($kernel);
|
$parser = new TemplateFilenameParser();
|
||||||
|
|
||||||
$finder = new TemplateFinder($kernel, $parser, __DIR__.'/../Fixtures/Resources');
|
$finder = new TemplateFinder($kernel, $parser, __DIR__.'/../Fixtures/Resources');
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testValidTrustedProxies($trustedProxies, $processedProxies)
|
public function testValidTrustedProxies($trustedProxies, $processedProxies)
|
||||||
{
|
{
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
$configuration = new Configuration(array());
|
$configuration = new Configuration();
|
||||||
$config = $processor->processConfiguration($configuration, array(array(
|
$config = $processor->processConfiguration($configuration, array(array(
|
||||||
'secret' => 's3cr3t',
|
'secret' => 's3cr3t',
|
||||||
'trusted_proxies' => $trustedProxies
|
'trusted_proxies' => $trustedProxies
|
||||||
@ -62,7 +62,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInvalidTypeTrustedProxies()
|
public function testInvalidTypeTrustedProxies()
|
||||||
{
|
{
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
$configuration = new Configuration(array());
|
$configuration = new Configuration();
|
||||||
$processor->processConfiguration($configuration, array(
|
$processor->processConfiguration($configuration, array(
|
||||||
array(
|
array(
|
||||||
'secret' => 's3cr3t',
|
'secret' => 's3cr3t',
|
||||||
@ -77,7 +77,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testInvalidValueTrustedProxies()
|
public function testInvalidValueTrustedProxies()
|
||||||
{
|
{
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
$configuration = new Configuration(array());
|
$configuration = new Configuration();
|
||||||
$processor->processConfiguration($configuration, array(
|
$processor->processConfiguration($configuration, array(
|
||||||
array(
|
array(
|
||||||
'secret' => 's3cr3t',
|
'secret' => 's3cr3t',
|
||||||
|
@ -46,7 +46,7 @@ class WebTestCase extends BaseWebTestCase
|
|||||||
{
|
{
|
||||||
require_once __DIR__.'/app/AppKernel.php';
|
require_once __DIR__.'/app/AppKernel.php';
|
||||||
|
|
||||||
return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\AppKernel';
|
return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\app\AppKernel';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function createKernel(array $options = array())
|
protected static function createKernel(array $options = array())
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app;
|
||||||
|
|
||||||
// get the autoload file
|
// get the autoload file
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
|
@ -46,7 +46,7 @@ class WebTestCase extends BaseWebTestCase
|
|||||||
{
|
{
|
||||||
require_once __DIR__.'/app/AppKernel.php';
|
require_once __DIR__.'/app/AppKernel.php';
|
||||||
|
|
||||||
return 'Symfony\Bundle\SecurityBundle\Tests\Functional\AppKernel';
|
return 'Symfony\Bundle\SecurityBundle\Tests\Functional\app\AppKernel';
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function createKernel(array $options = array())
|
protected static function createKernel(array $options = array())
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* file that was distributed with this source code.
|
* file that was distributed with this source code.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Symfony\Bundle\SecurityBundle\Tests\Functional;
|
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\app;
|
||||||
|
|
||||||
// get the autoload file
|
// get the autoload file
|
||||||
$dir = __DIR__;
|
$dir = __DIR__;
|
||||||
|
@ -22,7 +22,7 @@ class ConfigurationTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testConfigTree($options, $results)
|
public function testConfigTree($options, $results)
|
||||||
{
|
{
|
||||||
$processor = new Processor();
|
$processor = new Processor();
|
||||||
$configuration = new Configuration(array());
|
$configuration = new Configuration();
|
||||||
$config = $processor->processConfiguration($configuration, array($options));
|
$config = $processor->processConfiguration($configuration, array($options));
|
||||||
|
|
||||||
$this->assertEquals($results, $config);
|
$this->assertEquals($results, $config);
|
||||||
|
@ -116,7 +116,8 @@ class XcacheClassLoader
|
|||||||
if (xcache_isset($this->prefix.$class)) {
|
if (xcache_isset($this->prefix.$class)) {
|
||||||
$file = xcache_get($this->prefix.$class);
|
$file = xcache_get($this->prefix.$class);
|
||||||
} else {
|
} else {
|
||||||
xcache_set($this->prefix.$class, $file = $this->classFinder->findFile($class));
|
$file = $this->classFinder->findFile($class);
|
||||||
|
xcache_set($this->prefix.$class, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
|
@ -352,7 +352,7 @@ class ProgressHelper extends Helper
|
|||||||
$vars = array();
|
$vars = array();
|
||||||
$percent = 0;
|
$percent = 0;
|
||||||
if ($this->max > 0) {
|
if ($this->max > 0) {
|
||||||
$percent = (double) $this->current / $this->max;
|
$percent = (float) $this->current / $this->max;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->formatVars['bar'])) {
|
if (isset($this->formatVars['bar'])) {
|
||||||
|
@ -417,7 +417,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testAsText()
|
public function testAsText()
|
||||||
{
|
{
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$application->add(new \FooCommand);
|
$application->add(new \FooCommand());
|
||||||
$this->ensureStaticCommandHelp($application);
|
$this->ensureStaticCommandHelp($application);
|
||||||
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application');
|
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application');
|
||||||
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application');
|
$this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application');
|
||||||
@ -426,7 +426,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testAsXml()
|
public function testAsXml()
|
||||||
{
|
{
|
||||||
$application = new Application();
|
$application = new Application();
|
||||||
$application->add(new \FooCommand);
|
$application->add(new \FooCommand());
|
||||||
$this->ensureStaticCommandHelp($application);
|
$this->ensureStaticCommandHelp($application);
|
||||||
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application');
|
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application');
|
||||||
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application');
|
$this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application');
|
||||||
@ -450,7 +450,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
$tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false));
|
$tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false));
|
||||||
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command');
|
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $tester->getDisplay(true), '->renderException() renders the command synopsis when an exception occurs in the context of a command');
|
||||||
|
|
||||||
$application->add(new \Foo3Command);
|
$application->add(new \Foo3Command());
|
||||||
$tester = new ApplicationTester($application);
|
$tester = new ApplicationTester($application);
|
||||||
$tester->run(array('command' => 'foo3:bar'), array('decorated' => false));
|
$tester->run(array('command' => 'foo3:bar'), array('decorated' => false));
|
||||||
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
|
$this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $tester->getDisplay(true), '->renderException() renders a pretty exceptions with previous exceptions');
|
||||||
@ -797,7 +797,7 @@ class ApplicationTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function getDispatcher()
|
protected function getDispatcher()
|
||||||
{
|
{
|
||||||
$dispatcher = new EventDispatcher;
|
$dispatcher = new EventDispatcher();
|
||||||
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) {
|
$dispatcher->addListener('console.command', function (ConsoleCommandEvent $event) {
|
||||||
$event->getOutput()->write('before.');
|
$event->getOutput()->write('before.');
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,6 @@ namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
|
|||||||
use Symfony\Component\CssSelector\Parser\Handler\NumberHandler;
|
use Symfony\Component\CssSelector\Parser\Handler\NumberHandler;
|
||||||
use Symfony\Component\CssSelector\Parser\Token;
|
use Symfony\Component\CssSelector\Parser\Token;
|
||||||
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns;
|
||||||
use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping;
|
|
||||||
|
|
||||||
class NumberHandlerTest extends AbstractHandlerTest
|
class NumberHandlerTest extends AbstractHandlerTest
|
||||||
{
|
{
|
||||||
@ -46,6 +45,6 @@ class NumberHandlerTest extends AbstractHandlerTest
|
|||||||
{
|
{
|
||||||
$patterns = new TokenizerPatterns();
|
$patterns = new TokenizerPatterns();
|
||||||
|
|
||||||
return new NumberHandler($patterns, new TokenizerEscaping($patterns));
|
return new NumberHandler($patterns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,6 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testNestedExceptions()
|
public function testNestedExceptions()
|
||||||
{
|
{
|
||||||
$handler = new ExceptionHandler(true);
|
$handler = new ExceptionHandler(true);
|
||||||
$response = $handler->createResponse(new \RuntimeException('Foo', null, new \RuntimeException('Bar')));
|
$response = $handler->createResponse(new \RuntimeException('Foo', 0, new \RuntimeException('Bar')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ class PhpDumper extends Dumper
|
|||||||
{
|
{
|
||||||
parent::__construct($container);
|
parent::__construct($container);
|
||||||
|
|
||||||
$this->inlinedDefinitions = new \SplObjectStorage;
|
$this->inlinedDefinitions = new \SplObjectStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -238,6 +238,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testEventReceivesTheDispatcherInstance()
|
public function testEventReceivesTheDispatcherInstance()
|
||||||
{
|
{
|
||||||
$test = $this;
|
$test = $this;
|
||||||
|
$dispatcher = null;
|
||||||
$this->dispatcher->addListener('test', function ($event) use (&$dispatcher) {
|
$this->dispatcher->addListener('test', function ($event) use (&$dispatcher) {
|
||||||
$dispatcher = $event->getDispatcher();
|
$dispatcher = $event->getDispatcher();
|
||||||
});
|
});
|
||||||
|
@ -35,7 +35,7 @@ class EventTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->event = new Event;
|
$this->event = new Event();
|
||||||
$this->dispatcher = new EventDispatcher();
|
$this->dispatcher = new EventDispatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,14 +19,11 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
|
|||||||
class DependencyInjectionExtension implements FormExtensionInterface
|
class DependencyInjectionExtension implements FormExtensionInterface
|
||||||
{
|
{
|
||||||
private $container;
|
private $container;
|
||||||
|
|
||||||
private $typeServiceIds;
|
private $typeServiceIds;
|
||||||
|
|
||||||
private $guesserServiceIds;
|
private $guesserServiceIds;
|
||||||
|
|
||||||
private $guesser;
|
private $guesser;
|
||||||
|
|
||||||
private $guesserLoaded = false;
|
private $guesserLoaded = false;
|
||||||
|
private $typeExtensionServiceIds;
|
||||||
|
|
||||||
public function __construct(ContainerInterface $container,
|
public function __construct(ContainerInterface $container,
|
||||||
array $typeServiceIds, array $typeExtensionServiceIds,
|
array $typeServiceIds, array $typeExtensionServiceIds,
|
||||||
|
@ -55,7 +55,7 @@ abstract class FormPerformanceTestCase extends FormIntegrationTestCase
|
|||||||
if (is_integer($maxRunningTime) && $maxRunningTime >= 0) {
|
if (is_integer($maxRunningTime) && $maxRunningTime >= 0) {
|
||||||
$this->maxRunningTime = $maxRunningTime;
|
$this->maxRunningTime = $maxRunningTime;
|
||||||
} else {
|
} else {
|
||||||
throw new \InvalidArgumentException;
|
throw new \InvalidArgumentException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,12 +27,12 @@ class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->registry->setAccessible(true);
|
$this->registry->setAccessible(true);
|
||||||
|
|
||||||
$this->guesser = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
|
$this->guesser = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
|
||||||
$this->type = new FooType;
|
$this->type = new FooType();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAddType()
|
public function testAddType()
|
||||||
{
|
{
|
||||||
$factoryBuilder = new FormFactoryBuilder;
|
$factoryBuilder = new FormFactoryBuilder();
|
||||||
$factoryBuilder->addType($this->type);
|
$factoryBuilder->addType($this->type);
|
||||||
|
|
||||||
$factory = $factoryBuilder->getFormFactory();
|
$factory = $factoryBuilder->getFormFactory();
|
||||||
@ -46,7 +46,7 @@ class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testAddTypeGuesser()
|
public function testAddTypeGuesser()
|
||||||
{
|
{
|
||||||
$factoryBuilder = new FormFactoryBuilder;
|
$factoryBuilder = new FormFactoryBuilder();
|
||||||
$factoryBuilder->addTypeGuesser($this->guesser);
|
$factoryBuilder->addTypeGuesser($this->guesser);
|
||||||
|
|
||||||
$factory = $factoryBuilder->getFormFactory();
|
$factory = $factoryBuilder->getFormFactory();
|
||||||
|
@ -82,18 +82,15 @@ class ExtensionGuesser implements ExtensionGuesserInterface
|
|||||||
* value.
|
* value.
|
||||||
*
|
*
|
||||||
* @param string $mimeType The mime type
|
* @param string $mimeType The mime type
|
||||||
|
*
|
||||||
* @return string The guessed extension or NULL, if none could be guessed
|
* @return string The guessed extension or NULL, if none could be guessed
|
||||||
*/
|
*/
|
||||||
public function guess($mimeType)
|
public function guess($mimeType)
|
||||||
{
|
{
|
||||||
foreach ($this->guessers as $guesser) {
|
foreach ($this->guessers as $guesser) {
|
||||||
$extension = $guesser->guess($mimeType);
|
if (null !== $extension = $guesser->guess($mimeType)) {
|
||||||
|
return $extension;
|
||||||
if (null !== $extension) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $extension;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -881,14 +881,14 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetContentWorksTwiceInDefaultMode()
|
public function testGetContentWorksTwiceInDefaultMode()
|
||||||
{
|
{
|
||||||
$req = new Request;
|
$req = new Request();
|
||||||
$this->assertEquals('', $req->getContent());
|
$this->assertEquals('', $req->getContent());
|
||||||
$this->assertEquals('', $req->getContent());
|
$this->assertEquals('', $req->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetContentReturnsResource()
|
public function testGetContentReturnsResource()
|
||||||
{
|
{
|
||||||
$req = new Request;
|
$req = new Request();
|
||||||
$retval = $req->getContent(true);
|
$retval = $req->getContent(true);
|
||||||
$this->assertInternalType('resource', $retval);
|
$this->assertInternalType('resource', $retval);
|
||||||
$this->assertEquals("", fread($retval, 1));
|
$this->assertEquals("", fread($retval, 1));
|
||||||
@ -901,7 +901,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
|
public function testGetContentCantBeCalledTwiceWithResources($first, $second)
|
||||||
{
|
{
|
||||||
$req = new Request;
|
$req = new Request();
|
||||||
$req->getContent($first);
|
$req->getContent($first);
|
||||||
$req->getContent($second);
|
$req->getContent($second);
|
||||||
}
|
}
|
||||||
@ -1339,7 +1339,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
|
|||||||
*/
|
*/
|
||||||
public function testUrlencodedStringPrefix($string, $prefix, $expect)
|
public function testUrlencodedStringPrefix($string, $prefix, $expect)
|
||||||
{
|
{
|
||||||
$request = new Request;
|
$request = new Request();
|
||||||
|
|
||||||
$me = new \ReflectionMethod($request, 'getUrlencodedPrefix');
|
$me = new \ReflectionMethod($request, 'getUrlencodedPrefix');
|
||||||
$me->setAccessible(true);
|
$me->setAccessible(true);
|
||||||
|
@ -652,7 +652,7 @@ class ResponseTest extends ResponseTestCase
|
|||||||
'setCharset' => 'UTF-8',
|
'setCharset' => 'UTF-8',
|
||||||
'setPublic' => null,
|
'setPublic' => null,
|
||||||
'setPrivate' => null,
|
'setPrivate' => null,
|
||||||
'setDate' => new \DateTime,
|
'setDate' => new \DateTime(),
|
||||||
'expire' => null,
|
'expire' => null,
|
||||||
'setMaxAge' => 1,
|
'setMaxAge' => 1,
|
||||||
'setSharedMaxAge' => 1,
|
'setSharedMaxAge' => 1,
|
||||||
|
@ -59,7 +59,7 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function getStorage(array $options = array())
|
protected function getStorage(array $options = array())
|
||||||
{
|
{
|
||||||
$storage = new NativeSessionStorage($options);
|
$storage = new NativeSessionStorage($options);
|
||||||
$storage->registerBag(new AttributeBag);
|
$storage->registerBag(new AttributeBag());
|
||||||
|
|
||||||
return $storage;
|
return $storage;
|
||||||
}
|
}
|
||||||
@ -158,7 +158,7 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testSetSaveHandlerException()
|
public function testSetSaveHandlerException()
|
||||||
{
|
{
|
||||||
$storage = $this->getStorage();
|
$storage = $this->getStorage();
|
||||||
$storage->setSaveHandler(new \stdClass);
|
$storage->setSaveHandler(new \stdClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetSaveHandler53()
|
public function testSetSaveHandler53()
|
||||||
|
@ -53,7 +53,7 @@ class PhpBridgeSessionStorageTest extends \PHPUnit_Framework_TestCase
|
|||||||
protected function getStorage()
|
protected function getStorage()
|
||||||
{
|
{
|
||||||
$storage = new PhpBridgeSessionStorage();
|
$storage = new PhpBridgeSessionStorage();
|
||||||
$storage->registerBag(new AttributeBag);
|
$storage->registerBag(new AttributeBag());
|
||||||
|
|
||||||
return $storage;
|
return $storage;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ class ControllerResolver implements ControllerResolverInterface
|
|||||||
|
|
||||||
if (false === strpos($controller, ':')) {
|
if (false === strpos($controller, ':')) {
|
||||||
if (method_exists($controller, '__invoke')) {
|
if (method_exists($controller, '__invoke')) {
|
||||||
return new $controller;
|
return new $controller();
|
||||||
} elseif (function_exists($controller)) {
|
} elseif (function_exists($controller)) {
|
||||||
return $controller;
|
return $controller;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
|
|||||||
$host = $matches[1] ?: $matches[2];
|
$host = $matches[1] ?: $matches[2];
|
||||||
$port = $matches[3];
|
$port = $matches[3];
|
||||||
|
|
||||||
$memcache = new Memcache;
|
$memcache = new Memcache();
|
||||||
$memcache->addServer($host, $port);
|
$memcache->addServer($host, $port);
|
||||||
|
|
||||||
$this->memcache = $memcache;
|
$this->memcache = $memcache;
|
||||||
|
@ -42,7 +42,7 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
|
|||||||
$host = $matches[1] ?: $matches[2];
|
$host = $matches[1] ?: $matches[2];
|
||||||
$port = $matches[3];
|
$port = $matches[3];
|
||||||
|
|
||||||
$memcached = new Memcached;
|
$memcached = new Memcached();
|
||||||
|
|
||||||
//disable compression to allow appending
|
//disable compression to allow appending
|
||||||
$memcached->setOption(Memcached::OPT_COMPRESSION, false);
|
$memcached->setOption(Memcached::OPT_COMPRESSION, false);
|
||||||
|
@ -214,7 +214,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface
|
|||||||
throw new \RuntimeException('RedisProfilerStorage requires that the redis extension is loaded.');
|
throw new \RuntimeException('RedisProfilerStorage requires that the redis extension is loaded.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$redis = new \Redis;
|
$redis = new \Redis();
|
||||||
$redis->connect($data['host'], $data['port']);
|
$redis->connect($data['host'], $data['port']);
|
||||||
|
|
||||||
if (isset($data['path'])) {
|
if (isset($data['path'])) {
|
||||||
|
@ -121,6 +121,7 @@ class ClientTest extends \PHPUnit_Framework_TestCase
|
|||||||
new UploadedFile($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true),
|
new UploadedFile($source, 'original', 'mime/original', 123, UPLOAD_ERR_OK, true),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$file = null;
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
$client->request('POST', '/', array(), array('foo' => $file));
|
$client->request('POST', '/', array(), array('foo' => $file));
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ class TimeDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testCollect()
|
public function testCollect()
|
||||||
{
|
{
|
||||||
$c = new TimeDataCollector;
|
$c = new TimeDataCollector();
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$request->server->set('REQUEST_TIME', 1);
|
$request->server->set('REQUEST_TIME', 1);
|
||||||
@ -42,7 +42,7 @@ class TimeDataCollectorTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals(2000, $c->getStartTime());
|
$this->assertEquals(2000, $c->getStartTime());
|
||||||
|
|
||||||
$request = new Request();
|
$request = new Request();
|
||||||
$c->collect($request, new Response);
|
$c->collect($request, new Response());
|
||||||
$this->assertEquals(0, $c->getStartTime());
|
$this->assertEquals(0, $c->getStartTime());
|
||||||
|
|
||||||
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
$kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface');
|
||||||
|
@ -347,6 +347,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
||||||
|
|
||||||
|
$attributeRet = null;
|
||||||
if (null !== $fractionDigits) {
|
if (null !== $fractionDigits) {
|
||||||
$attributeRet = $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $fractionDigits);
|
$attributeRet = $formatter->setAttribute(NumberFormatter::FRACTION_DIGITS, $fractionDigits);
|
||||||
}
|
}
|
||||||
@ -355,7 +356,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertSame($expected, $formattedValue);
|
$this->assertSame($expected, $formattedValue);
|
||||||
$this->assertSame($expectedFractionDigits, $formatter->getAttribute(NumberFormatter::FRACTION_DIGITS));
|
$this->assertSame($expectedFractionDigits, $formatter->getAttribute(NumberFormatter::FRACTION_DIGITS));
|
||||||
|
|
||||||
if (isset($attributeRet)) {
|
if (null !== $attributeRet) {
|
||||||
$this->assertTrue($attributeRet);
|
$this->assertTrue($attributeRet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -379,6 +380,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL);
|
||||||
|
|
||||||
|
$attributeRet = null;
|
||||||
if (null !== $groupingUsed) {
|
if (null !== $groupingUsed) {
|
||||||
$attributeRet = $formatter->setAttribute(NumberFormatter::GROUPING_USED, $groupingUsed);
|
$attributeRet = $formatter->setAttribute(NumberFormatter::GROUPING_USED, $groupingUsed);
|
||||||
}
|
}
|
||||||
@ -387,7 +389,7 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertSame($expected, $formattedValue);
|
$this->assertSame($expected, $formattedValue);
|
||||||
$this->assertSame($expectedGroupingUsed, $formatter->getAttribute(NumberFormatter::GROUPING_USED));
|
$this->assertSame($expectedGroupingUsed, $formatter->getAttribute(NumberFormatter::GROUPING_USED));
|
||||||
|
|
||||||
if (isset($attributeRet)) {
|
if (null !== $attributeRet) {
|
||||||
$this->assertTrue($attributeRet);
|
$this->assertTrue($attributeRet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ function handleSignal($signal)
|
|||||||
echo "received signal $name\n";
|
echo "received signal $name\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
declare(ticks=1);
|
declare(ticks = 1);
|
||||||
pcntl_signal(SIGTERM, 'handleSignal');
|
pcntl_signal(SIGTERM, 'handleSignal');
|
||||||
pcntl_signal(SIGINT, 'handleSignal');
|
pcntl_signal(SIGINT, 'handleSignal');
|
||||||
|
|
||||||
|
@ -31,17 +31,16 @@ class AnnotationFileLoader extends FileLoader
|
|||||||
*
|
*
|
||||||
* @param FileLocatorInterface $locator A FileLocator instance
|
* @param FileLocatorInterface $locator A FileLocator instance
|
||||||
* @param AnnotationClassLoader $loader An AnnotationClassLoader instance
|
* @param AnnotationClassLoader $loader An AnnotationClassLoader instance
|
||||||
* @param string|array $paths A path or an array of paths where to look for resources
|
|
||||||
*
|
*
|
||||||
* @throws \RuntimeException
|
* @throws \RuntimeException
|
||||||
*/
|
*/
|
||||||
public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader, $paths = array())
|
public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader)
|
||||||
{
|
{
|
||||||
if (!function_exists('token_get_all')) {
|
if (!function_exists('token_get_all')) {
|
||||||
throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.');
|
throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.');
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct($locator, $paths);
|
parent::__construct($locator);
|
||||||
|
|
||||||
$this->loader = $loader;
|
$this->loader = $loader;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ class DumperPrefixCollectionTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testAddPrefixRoute()
|
public function testAddPrefixRoute()
|
||||||
{
|
{
|
||||||
$coll = new DumperPrefixCollection;
|
$coll = new DumperPrefixCollection();
|
||||||
$coll->setPrefix('');
|
$coll->setPrefix('');
|
||||||
|
|
||||||
$route = new DumperRoute('bar', new Route('/foo/bar'));
|
$route = new DumperRoute('bar', new Route('/foo/bar'));
|
||||||
@ -66,7 +66,7 @@ EOF;
|
|||||||
|
|
||||||
public function testMergeSlashNodes()
|
public function testMergeSlashNodes()
|
||||||
{
|
{
|
||||||
$coll = new DumperPrefixCollection;
|
$coll = new DumperPrefixCollection();
|
||||||
$coll->setPrefix('');
|
$coll->setPrefix('');
|
||||||
|
|
||||||
$route = new DumperRoute('bar', new Route('/foo/bar'));
|
$route = new DumperRoute('bar', new Route('/foo/bar'));
|
||||||
|
@ -76,7 +76,7 @@ class MaskBuilderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetPattern()
|
public function testGetPattern()
|
||||||
{
|
{
|
||||||
$builder = new MaskBuilder;
|
$builder = new MaskBuilder();
|
||||||
$this->assertEquals(MaskBuilder::ALL_OFF, $builder->getPattern());
|
$this->assertEquals(MaskBuilder::ALL_OFF, $builder->getPattern());
|
||||||
|
|
||||||
$builder->add('view');
|
$builder->add('view');
|
||||||
|
@ -115,7 +115,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->method('isPasswordValid')
|
->method('isPasswordValid')
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider(false, false, $encoder);
|
$provider = $this->getProvider(null, null, $encoder);
|
||||||
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->will($this->returnValue(true))
|
->will($this->returnValue(true))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider(false, false, $encoder);
|
$provider = $this->getProvider(null, null, $encoder);
|
||||||
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->will($this->returnValue(false))
|
->will($this->returnValue(false))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider(false, false, $encoder);
|
$provider = $this->getProvider(null, null, $encoder);
|
||||||
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->will($this->returnValue('newFoo'))
|
->will($this->returnValue('newFoo'))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider(false, false, null);
|
$provider = $this->getProvider();
|
||||||
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
|
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
|
||||||
$reflection->setAccessible(true);
|
$reflection->setAccessible(true);
|
||||||
$reflection->invoke($provider, $dbUser, $token);
|
$reflection->invoke($provider, $dbUser, $token);
|
||||||
@ -231,7 +231,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->will($this->returnValue('foo'))
|
->will($this->returnValue('foo'))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider(false, false, null);
|
$provider = $this->getProvider();
|
||||||
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
|
$reflection = new \ReflectionMethod($provider, 'checkAuthentication');
|
||||||
$reflection->setAccessible(true);
|
$reflection->setAccessible(true);
|
||||||
$reflection->invoke($provider, $dbUser, $token);
|
$reflection->invoke($provider, $dbUser, $token);
|
||||||
@ -245,7 +245,7 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
->will($this->returnValue(true))
|
->will($this->returnValue(true))
|
||||||
;
|
;
|
||||||
|
|
||||||
$provider = $this->getProvider(false, false, $encoder);
|
$provider = $this->getProvider(null, null, $encoder);
|
||||||
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
$method = new \ReflectionMethod($provider, 'checkAuthentication');
|
||||||
$method->setAccessible(true);
|
$method->setAccessible(true);
|
||||||
|
|
||||||
@ -270,17 +270,17 @@ class DaoAuthenticationProviderTest extends \PHPUnit_Framework_TestCase
|
|||||||
return $mock;
|
return $mock;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getProvider($user = false, $userChecker = false, $passwordEncoder = null)
|
protected function getProvider($user = null, $userChecker = null, $passwordEncoder = null)
|
||||||
{
|
{
|
||||||
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
|
$userProvider = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserProviderInterface');
|
||||||
if (false !== $user) {
|
if (null !== $user) {
|
||||||
$userProvider->expects($this->once())
|
$userProvider->expects($this->once())
|
||||||
->method('loadUserByUsername')
|
->method('loadUserByUsername')
|
||||||
->will($this->returnValue($user))
|
->will($this->returnValue($user))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === $userChecker) {
|
if (null === $userChecker) {
|
||||||
$userChecker = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface');
|
$userChecker = $this->getMock('Symfony\\Component\\Security\\Core\\User\\UserCheckerInterface');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,17 +114,17 @@ class PreAuthenticatedAuthenticationProviderTest extends \PHPUnit_Framework_Test
|
|||||||
return $token;
|
return $token;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getProvider($user = false, $userChecker = false)
|
protected function getProvider($user = null, $userChecker = null)
|
||||||
{
|
{
|
||||||
$userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
|
$userProvider = $this->getMock('Symfony\Component\Security\Core\User\UserProviderInterface');
|
||||||
if (false !== $user) {
|
if (null !== $user) {
|
||||||
$userProvider->expects($this->once())
|
$userProvider->expects($this->once())
|
||||||
->method('loadUserByUsername')
|
->method('loadUserByUsername')
|
||||||
->will($this->returnValue($user))
|
->will($this->returnValue($user))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false === $userChecker) {
|
if (null === $userChecker) {
|
||||||
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
$userChecker = $this->getMock('Symfony\Component\Security\Core\User\UserCheckerInterface');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ class SecureRandomTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$b = $this->getBitSequence($secureRandom, 20000);
|
$b = $this->getBitSequence($secureRandom, 20000);
|
||||||
|
|
||||||
$longestRun = 0;
|
$longestRun = $currentRun = 0;
|
||||||
$currentRun = $lastBit = null;
|
$lastBit = null;
|
||||||
for ($i = 0; $i < 20000; $i++) {
|
for ($i = 0; $i < 20000; $i++) {
|
||||||
if ($lastBit === $b[$i]) {
|
if ($lastBit === $b[$i]) {
|
||||||
$currentRun += 1;
|
$currentRun += 1;
|
||||||
|
@ -50,7 +50,7 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface()
|
public function testAutoLoginThrowsExceptionWhenImplementationDoesNotReturnUserInterface()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
||||||
$request = new Request;
|
$request = new Request();
|
||||||
$request->cookies->set('foo', 'foo');
|
$request->cookies->set('foo', 'foo');
|
||||||
|
|
||||||
$service
|
$service
|
||||||
@ -113,8 +113,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfaceImplementation()
|
public function testLoginSuccessIsNotProcessedWhenTokenDoesNotContainUserInterfaceImplementation()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
||||||
$request = new Request;
|
$request = new Request();
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
$token
|
$token
|
||||||
@ -136,8 +136,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testLoginSuccessIsNotProcessedWhenRememberMeIsNotRequested()
|
public function testLoginSuccessIsNotProcessedWhenRememberMeIsNotRequested()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => false, 'remember_me_parameter' => 'foo', 'path' => null, 'domain' => null));
|
$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();
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
$token
|
$token
|
||||||
@ -160,8 +160,8 @@ class AbstractRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testLoginSuccessWhenRememberMeAlwaysIsTrue()
|
public function testLoginSuccessWhenRememberMeAlwaysIsTrue()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
||||||
$request = new Request;
|
$request = new Request();
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
$token
|
$token
|
||||||
@ -186,9 +186,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));
|
$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));
|
$request->request->set('foo', array('bar' => $value));
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
$token
|
$token
|
||||||
@ -213,9 +213,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));
|
$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);
|
$request->request->set('foo', $value);
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
$token
|
$token
|
||||||
|
@ -43,7 +43,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
public function testAutoLoginThrowsExceptionOnInvalidCookie()
|
public function testAutoLoginThrowsExceptionOnInvalidCookie()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
|
$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->request->set('foo', 'true');
|
||||||
$request->cookies->set('foo', 'foo');
|
$request->cookies->set('foo', 'foo');
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
public function testAutoLoginThrowsExceptionOnNonExistentToken()
|
public function testAutoLoginThrowsExceptionOnNonExistentToken()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
|
$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->request->set('foo', 'true');
|
||||||
$request->cookies->set('foo', $this->encodeCookie(array(
|
$request->cookies->set('foo', $this->encodeCookie(array(
|
||||||
$series = 'fooseries',
|
$series = 'fooseries',
|
||||||
@ -77,7 +77,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
{
|
{
|
||||||
$userProvider = $this->getProvider();
|
$userProvider = $this->getProvider();
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600, 'secure' => false, 'httponly' => false));
|
$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')));
|
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||||
|
|
||||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||||
@ -102,7 +102,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
{
|
{
|
||||||
$userProvider = $this->getProvider();
|
$userProvider = $this->getProvider();
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true));
|
$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')));
|
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||||
|
|
||||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||||
@ -132,7 +132,7 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
public function testAutoLoginDoesNotAcceptAnExpiredCookie()
|
public function testAutoLoginDoesNotAcceptAnExpiredCookie()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
$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')));
|
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||||
|
|
||||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||||
@ -166,7 +166,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));
|
$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')));
|
$request->cookies->set('foo', $this->encodeCookie(array('fooseries', 'foovalue')));
|
||||||
|
|
||||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||||
@ -214,8 +214,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
public function testLogoutSimplyIgnoresNonSetRequestCookie()
|
public function testLogoutSimplyIgnoresNonSetRequestCookie()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
||||||
$request = new Request;
|
$request = new Request();
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
|
|
||||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||||
@ -236,9 +236,9 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
public function testLogoutSimplyIgnoresInvalidCookie()
|
public function testLogoutSimplyIgnoresInvalidCookie()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null));
|
||||||
$request = new Request;
|
$request = new Request();
|
||||||
$request->cookies->set('foo', 'somefoovalue');
|
$request->cookies->set('foo', 'somefoovalue');
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
|
|
||||||
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
$tokenProvider = $this->getMock('Symfony\Component\Security\Core\Authentication\RememberMe\TokenProviderInterface');
|
||||||
@ -266,8 +266,8 @@ class PersistentTokenBasedRememberMeServicesTest extends \PHPUnit_Framework_Test
|
|||||||
public function testLoginSuccessSetsCookieWhenLoggedInWithNonRememberMeTokenInterfaceImplementation()
|
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));
|
$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;
|
$request = new Request();
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
|
|
||||||
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$account = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
$account
|
$account
|
||||||
|
@ -56,7 +56,7 @@ class ResponseListenerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$listener = new ResponseListener();
|
$listener = new ResponseListener();
|
||||||
|
|
||||||
$this->assertSame(array(KernelEvents::RESPONSE => 'onKernelResponse'), $listener->getSubscribedEvents());
|
$this->assertSame(array(KernelEvents::RESPONSE => 'onKernelResponse'), ResponseListener::getSubscribedEvents());
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getRequest(array $attributes = array())
|
private function getRequest(array $attributes = array())
|
||||||
|
@ -39,7 +39,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testAutoLoginThrowsExceptionOnInvalidCookie()
|
public function testAutoLoginThrowsExceptionOnInvalidCookie()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => false, 'remember_me_parameter' => 'foo'));
|
$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->request->set('foo', 'true');
|
||||||
$request->cookies->set('foo', 'foo');
|
$request->cookies->set('foo', 'foo');
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$userProvider = $this->getProvider();
|
$userProvider = $this->getProvider();
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
$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'));
|
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
||||||
|
|
||||||
$userProvider
|
$userProvider
|
||||||
@ -68,7 +68,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$userProvider = $this->getProvider();
|
$userProvider = $this->getProvider();
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
$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'));
|
$request->cookies->set('foo', base64_encode('class:'.base64_encode('foouser').':123456789:fooHash'));
|
||||||
|
|
||||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
@ -93,7 +93,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$userProvider = $this->getProvider();
|
$userProvider = $this->getProvider();
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'path' => null, 'domain' => null, 'always_remember_me' => true, 'lifetime' => 3600));
|
$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'));
|
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time() - 1, 'foopass'));
|
||||||
|
|
||||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
@ -137,7 +137,7 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
;
|
;
|
||||||
|
|
||||||
$service = $this->getService($userProvider, array('name' => 'foo', 'always_remember_me' => true, 'lifetime' => 3600));
|
$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'));
|
$request->cookies->set('foo', $this->getCookie('fooclass', 'foouser', time()+3600, 'foopass'));
|
||||||
|
|
||||||
$returnedToken = $service->autoLogin($request);
|
$returnedToken = $service->autoLogin($request);
|
||||||
@ -179,8 +179,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testLoginSuccessIgnoresTokensWhichDoNotContainAnUserInterfaceImplementation()
|
public function testLoginSuccessIgnoresTokensWhichDoNotContainAnUserInterfaceImplementation()
|
||||||
{
|
{
|
||||||
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
$service = $this->getService(null, array('name' => 'foo', 'always_remember_me' => true, 'path' => null, 'domain' => null));
|
||||||
$request = new Request;
|
$request = new Request();
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
$token
|
$token
|
||||||
->expects($this->once())
|
->expects($this->once())
|
||||||
@ -200,8 +200,8 @@ class TokenBasedRememberMeServicesTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testLoginSuccess()
|
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));
|
$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;
|
$request = new Request();
|
||||||
$response = new Response;
|
$response = new Response();
|
||||||
|
|
||||||
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
$token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
|
||||||
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
$user = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
|
||||||
|
@ -29,7 +29,7 @@ class CustomNormalizer extends SerializerAwareNormalizer implements NormalizerIn
|
|||||||
*/
|
*/
|
||||||
public function denormalize($data, $class, $format = null, array $context = array())
|
public function denormalize($data, $class, $format = null, array $context = array())
|
||||||
{
|
{
|
||||||
$object = new $class;
|
$object = new $class();
|
||||||
$object->denormalize($this->serializer, $data, $format, $context);
|
$object->denormalize($this->serializer, $data, $format, $context);
|
||||||
|
|
||||||
return $object;
|
return $object;
|
||||||
|
@ -19,13 +19,13 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->encoder = new JsonEncoder;
|
$this->encoder = new JsonEncoder();
|
||||||
$this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
|
$this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncodeScalar()
|
public function testEncodeScalar()
|
||||||
{
|
{
|
||||||
$obj = new \stdClass;
|
$obj = new \stdClass();
|
||||||
$obj->foo = "foo";
|
$obj->foo = "foo";
|
||||||
|
|
||||||
$expected = '{"foo":"foo"}';
|
$expected = '{"foo":"foo"}';
|
||||||
@ -68,7 +68,7 @@ class JsonEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function getObject()
|
protected function getObject()
|
||||||
{
|
{
|
||||||
$obj = new \stdClass;
|
$obj = new \stdClass();
|
||||||
$obj->foo = 'foo';
|
$obj->foo = 'foo';
|
||||||
$obj->bar = array('a', 'b');
|
$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)));
|
$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)));
|
||||||
|
@ -24,14 +24,14 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->encoder = new XmlEncoder;
|
$this->encoder = new XmlEncoder();
|
||||||
$serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder()));
|
$serializer = new Serializer(array(new CustomNormalizer()), array('xml' => new XmlEncoder()));
|
||||||
$this->encoder->setSerializer($serializer);
|
$this->encoder->setSerializer($serializer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEncodeScalar()
|
public function testEncodeScalar()
|
||||||
{
|
{
|
||||||
$obj = new ScalarDummy;
|
$obj = new ScalarDummy();
|
||||||
$obj->xmlFoo = "foo";
|
$obj->xmlFoo = "foo";
|
||||||
|
|
||||||
$expected = '<?xml version="1.0"?>'."\n".
|
$expected = '<?xml version="1.0"?>'."\n".
|
||||||
@ -42,7 +42,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testSetRootNodeName()
|
public function testSetRootNodeName()
|
||||||
{
|
{
|
||||||
$obj = new ScalarDummy;
|
$obj = new ScalarDummy();
|
||||||
$obj->xmlFoo = "foo";
|
$obj->xmlFoo = "foo";
|
||||||
|
|
||||||
$this->encoder->setRootNodeName('test');
|
$this->encoder->setRootNodeName('test');
|
||||||
@ -63,7 +63,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testAttributes()
|
public function testAttributes()
|
||||||
{
|
{
|
||||||
$obj = new ScalarDummy;
|
$obj = new ScalarDummy();
|
||||||
$obj->xmlFoo = array(
|
$obj->xmlFoo = array(
|
||||||
'foo-bar' => array(
|
'foo-bar' => array(
|
||||||
'@id' => 1,
|
'@id' => 1,
|
||||||
@ -92,7 +92,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testElementNameValid()
|
public function testElementNameValid()
|
||||||
{
|
{
|
||||||
$obj = new ScalarDummy;
|
$obj = new ScalarDummy();
|
||||||
$obj->xmlFoo = array(
|
$obj->xmlFoo = array(
|
||||||
'foo-bar' => 'a',
|
'foo-bar' => 'a',
|
||||||
'foo_bar' => 'a',
|
'foo_bar' => 'a',
|
||||||
@ -345,7 +345,7 @@ class XmlEncoderTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function getObject()
|
protected function getObject()
|
||||||
{
|
{
|
||||||
$obj = new Dummy;
|
$obj = new Dummy();
|
||||||
$obj->foo = 'foo';
|
$obj->foo = 'foo';
|
||||||
$obj->bar = array('a', 'b');
|
$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)));
|
$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()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->normalizer = new CustomNormalizer;
|
$this->normalizer = new CustomNormalizer();
|
||||||
$this->normalizer->setSerializer(new Serializer);
|
$this->normalizer->setSerializer(new Serializer());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSerialize()
|
public function testSerialize()
|
||||||
{
|
{
|
||||||
$obj = new ScalarDummy;
|
$obj = new ScalarDummy();
|
||||||
$obj->foo = 'foo';
|
$obj->foo = 'foo';
|
||||||
$obj->xmlFoo = 'xml';
|
$obj->xmlFoo = 'xml';
|
||||||
$this->assertEquals('foo', $this->normalizer->normalize($obj, 'json'));
|
$this->assertEquals('foo', $this->normalizer->normalize($obj, 'json'));
|
||||||
@ -34,19 +34,19 @@ class CustomNormalizerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testDeserialize()
|
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->assertEquals('foo', $obj->xmlFoo);
|
||||||
$this->assertNull($obj->foo);
|
$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->assertEquals('foo', $obj->foo);
|
||||||
$this->assertNull($obj->xmlFoo);
|
$this->assertNull($obj->xmlFoo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSupportsNormalization()
|
public function testSupportsNormalization()
|
||||||
{
|
{
|
||||||
$this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy));
|
$this->assertTrue($this->normalizer->supportsNormalization(new ScalarDummy()));
|
||||||
$this->assertFalse($this->normalizer->supportsNormalization(new \stdClass));
|
$this->assertFalse($this->normalizer->supportsNormalization(new \stdClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSupportsDenormalization()
|
public function testSupportsDenormalization()
|
||||||
|
@ -17,13 +17,13 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->normalizer = new GetSetMethodNormalizer;
|
$this->normalizer = new GetSetMethodNormalizer();
|
||||||
$this->normalizer->setSerializer($this->getMock('Symfony\Component\Serializer\Serializer'));
|
$this->normalizer->setSerializer($this->getMock('Symfony\Component\Serializer\Serializer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalize()
|
public function testNormalize()
|
||||||
{
|
{
|
||||||
$obj = new GetSetDummy;
|
$obj = new GetSetDummy();
|
||||||
$obj->setFoo('foo');
|
$obj->setFoo('foo');
|
||||||
$obj->setBar('bar');
|
$obj->setBar('bar');
|
||||||
$obj->setCamelCase('camelcase');
|
$obj->setCamelCase('camelcase');
|
||||||
@ -118,7 +118,7 @@ class GetSetMethodNormalizerTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'camelCase'));
|
$this->normalizer->setIgnoredAttributes(array('foo', 'bar', 'camelCase'));
|
||||||
|
|
||||||
$obj = new GetSetDummy;
|
$obj = new GetSetDummy();
|
||||||
$obj->setFoo('foo');
|
$obj->setFoo('foo');
|
||||||
$obj->setBar('bar');
|
$obj->setBar('bar');
|
||||||
|
|
||||||
|
@ -28,20 +28,20 @@ class SerializerTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testNormalizeNoMatch()
|
public function testNormalizeNoMatch()
|
||||||
{
|
{
|
||||||
$this->serializer = new Serializer(array($this->getMock('Symfony\Component\Serializer\Normalizer\CustomNormalizer')));
|
$this->serializer = new Serializer(array($this->getMock('Symfony\Component\Serializer\Normalizer\CustomNormalizer')));
|
||||||
$this->serializer->normalize(new \stdClass, 'xml');
|
$this->serializer->normalize(new \stdClass(), 'xml');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalizeTraversable()
|
public function testNormalizeTraversable()
|
||||||
{
|
{
|
||||||
$this->serializer = new Serializer(array(), array('json' => new JsonEncoder()));
|
$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);
|
$this->assertEquals('{"foo":"foo","bar":"bar"}', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNormalizeGivesPriorityToInterfaceOverTraversable()
|
public function testNormalizeGivesPriorityToInterfaceOverTraversable()
|
||||||
{
|
{
|
||||||
$this->serializer = new Serializer(array(new CustomNormalizer), array('json' => new JsonEncoder()));
|
$this->serializer = new Serializer(array(new CustomNormalizer()), array('json' => new JsonEncoder()));
|
||||||
$result = $this->serializer->serialize(new NormalizableTraversableDummy, 'json');
|
$result = $this->serializer->serialize(new NormalizableTraversableDummy(), 'json');
|
||||||
$this->assertEquals('{"foo":"normalizedFoo","bar":"normalizedBar"}', $result);
|
$this->assertEquals('{"foo":"normalizedFoo","bar":"normalizedBar"}', $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ class SerializerTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testNormalizeOnDenormalizer()
|
public function testNormalizeOnDenormalizer()
|
||||||
{
|
{
|
||||||
$this->serializer = new Serializer(array(new TestDenormalizer()), array());
|
$this->serializer = new Serializer(array(new TestDenormalizer()), array());
|
||||||
$this->assertTrue($this->serializer->normalize(new \stdClass, 'json'));
|
$this->assertTrue($this->serializer->normalize(new \stdClass(), 'json'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -163,7 +163,9 @@ class StopwatchEvent
|
|||||||
*/
|
*/
|
||||||
public function getEndTime()
|
public function getEndTime()
|
||||||
{
|
{
|
||||||
return ($count = count($this->periods)) ? $this->periods[$count - 1]->getEndTime() : 0;
|
$count = count($this->periods);
|
||||||
|
|
||||||
|
return $count ? $this->periods[$count - 1]->getEndTime() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +27,7 @@ class Package implements PackageInterface
|
|||||||
* @param string $version The package version
|
* @param string $version The package version
|
||||||
* @param string $format The format used to apply the version
|
* @param string $format The format used to apply the version
|
||||||
*/
|
*/
|
||||||
public function __construct($version = null, $format = null)
|
public function __construct($version = null, $format = '')
|
||||||
{
|
{
|
||||||
$this->version = $version;
|
$this->version = $version;
|
||||||
$this->format = $format ?: '%s?%s';
|
$this->format = $format ?: '%s?%s';
|
||||||
|
@ -14,7 +14,6 @@ namespace Symfony\Component\Templating\Tests\Loader;
|
|||||||
use Symfony\Component\Templating\Loader\Loader;
|
use Symfony\Component\Templating\Loader\Loader;
|
||||||
use Symfony\Component\Templating\Loader\CacheLoader;
|
use Symfony\Component\Templating\Loader\CacheLoader;
|
||||||
use Symfony\Component\Templating\Storage\StringStorage;
|
use Symfony\Component\Templating\Storage\StringStorage;
|
||||||
use Symfony\Component\Templating\TemplateNameParser;
|
|
||||||
use Symfony\Component\Templating\TemplateReferenceInterface;
|
use Symfony\Component\Templating\TemplateReferenceInterface;
|
||||||
use Symfony\Component\Templating\TemplateReference;
|
use Symfony\Component\Templating\TemplateReference;
|
||||||
|
|
||||||
@ -22,7 +21,7 @@ class CacheLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
public function testConstructor()
|
public function testConstructor()
|
||||||
{
|
{
|
||||||
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(new TemplateNameParser()), sys_get_temp_dir());
|
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), sys_get_temp_dir());
|
||||||
$this->assertTrue($loader->getLoader() === $varLoader, '__construct() takes a template loader as its first argument');
|
$this->assertTrue($loader->getLoader() === $varLoader, '__construct() takes a template loader as its first argument');
|
||||||
$this->assertEquals(sys_get_temp_dir(), $loader->getDir(), '__construct() takes a directory where to store the cache as its second argument');
|
$this->assertEquals(sys_get_temp_dir(), $loader->getDir(), '__construct() takes a directory where to store the cache as its second argument');
|
||||||
}
|
}
|
||||||
@ -31,7 +30,7 @@ class CacheLoaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
{
|
{
|
||||||
$dir = sys_get_temp_dir().DIRECTORY_SEPARATOR.rand(111111, 999999);
|
$dir = sys_get_temp_dir().DIRECTORY_SEPARATOR.rand(111111, 999999);
|
||||||
mkdir($dir, 0777, true);
|
mkdir($dir, 0777, true);
|
||||||
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(new TemplateNameParser()), $dir);
|
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), $dir);
|
||||||
$loader->setDebugger($debugger = new \Symfony\Component\Templating\Tests\Fixtures\ProjectTemplateDebugger());
|
$loader->setDebugger($debugger = new \Symfony\Component\Templating\Tests\Fixtures\ProjectTemplateDebugger());
|
||||||
$this->assertFalse($loader->load(new TemplateReference('foo', 'php')), '->load() returns false if the embed loader is not able to load the template');
|
$this->assertFalse($loader->load(new TemplateReference('foo', 'php')), '->load() returns false if the embed loader is not able to load the template');
|
||||||
$loader->load(new TemplateReference('index'));
|
$loader->load(new TemplateReference('index'));
|
||||||
|
@ -12,14 +12,13 @@
|
|||||||
namespace Symfony\Component\Templating\Tests\Loader;
|
namespace Symfony\Component\Templating\Tests\Loader;
|
||||||
|
|
||||||
use Symfony\Component\Templating\Loader\Loader;
|
use Symfony\Component\Templating\Loader\Loader;
|
||||||
use Symfony\Component\Templating\TemplateNameParser;
|
|
||||||
use Symfony\Component\Templating\TemplateReferenceInterface;
|
use Symfony\Component\Templating\TemplateReferenceInterface;
|
||||||
|
|
||||||
class LoaderTest extends \PHPUnit_Framework_TestCase
|
class LoaderTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function testGetSetDebugger()
|
public function testGetSetDebugger()
|
||||||
{
|
{
|
||||||
$loader = new ProjectTemplateLoader4(new TemplateNameParser());
|
$loader = new ProjectTemplateLoader4();
|
||||||
$loader->setDebugger($debugger = new \Symfony\Component\Templating\Tests\Fixtures\ProjectTemplateDebugger());
|
$loader->setDebugger($debugger = new \Symfony\Component\Templating\Tests\Fixtures\ProjectTemplateDebugger());
|
||||||
$this->assertTrue($loader->getDebugger() === $debugger, '->setDebugger() sets the debugger instance');
|
$this->assertTrue($loader->getDebugger() === $debugger, '->setDebugger() sets the debugger instance');
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ abstract class AbstractComparison extends Constraint
|
|||||||
*/
|
*/
|
||||||
public function __construct($options = null)
|
public function __construct($options = null)
|
||||||
{
|
{
|
||||||
if (!isset($options['value'])) {
|
if (is_array($options) && !isset($options['value'])) {
|
||||||
throw new ConstraintDefinitionException(sprintf(
|
throw new ConstraintDefinitionException(sprintf(
|
||||||
'The %s constraint requires the "value" option to be set.',
|
'The %s constraint requires the "value" option to be set.',
|
||||||
get_class($this)
|
get_class($this)
|
||||||
|
@ -30,7 +30,7 @@ abstract class AbstractComparisonValidator extends ConstraintValidator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->compareValues($value, $constraint->value, $constraint)) {
|
if (!$this->compareValues($value, $constraint->value)) {
|
||||||
$this->context->addViolation($constraint->message, array(
|
$this->context->addViolation($constraint->message, array(
|
||||||
'{{ value }}' => $this->valueToString($constraint->value),
|
'{{ value }}' => $this->valueToString($constraint->value),
|
||||||
'{{ compared_value }}' => $this->valueToString($constraint->value),
|
'{{ compared_value }}' => $this->valueToString($constraint->value),
|
||||||
|
@ -117,14 +117,14 @@ class ConstraintTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testGetTargetsCanBeString()
|
public function testGetTargetsCanBeString()
|
||||||
{
|
{
|
||||||
$constraint = new ClassConstraint;
|
$constraint = new ClassConstraint();
|
||||||
|
|
||||||
$this->assertEquals('class', $constraint->getTargets());
|
$this->assertEquals('class', $constraint->getTargets());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetTargetsCanBeArray()
|
public function testGetTargetsCanBeArray()
|
||||||
{
|
{
|
||||||
$constraint = new ConstraintA;
|
$constraint = new ConstraintA();
|
||||||
|
|
||||||
$this->assertEquals(array('property', 'class'), $constraint->getTargets());
|
$this->assertEquals(array('property', 'class'), $constraint->getTargets());
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class ElementMetadataTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
protected function setUp()
|
protected function setUp()
|
||||||
{
|
{
|
||||||
$this->metadata = new TestElementMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity');
|
$this->metadata = new TestElementMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
|
@ -108,7 +108,7 @@ class Validator implements ValidatorInterface
|
|||||||
? '"'.$containingValue.'"'
|
? '"'.$containingValue.'"'
|
||||||
: 'the value of type '.gettype($containingValue);
|
: 'the value of type '.gettype($containingValue);
|
||||||
|
|
||||||
throw new ValidatorException(sprintf('The metadata for '.$valueAsString.' does not support properties.'));
|
throw new ValidatorException(sprintf('The metadata for %s does not support properties.', $valueAsString));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->resolveGroups($groups) as $group) {
|
foreach ($this->resolveGroups($groups) as $group) {
|
||||||
|
Reference in New Issue
Block a user