Merge branch '2.3' into 2.4

* 2.3:
  [Security] fixed pre/post authentication checks
  Updated lithuanian validator translation: changed vartotojas to naudotojas as it is more proper term.
  Fixed CSS
  [HttpFoundation] Throw proper exception when invalid data is passed to JsonResponse class
  addressed == -> === suggestion
  Fixed #9020 - Added support for collections in service#parameters
  fixes PSR-0 issues in tests
  adjusted behavior to always copy override on url files
  Skips test that need full lib-intl.

Conflicts:
	src/Symfony/Component/Security/Acl/Tests/Permission/MaskBuilderTest.php
	src/Symfony/Component/Security/Core/Tests/Authentication/Token/RememerMeTokenTest.php
	src/Symfony/Component/Security/Core/Tests/User/AccountCheckerTest.php
	src/Symfony/Component/Security/Core/Tests/User/InMemoryProviderTest.php
	src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationFailureHandlerTest.php
	src/Symfony/Component/Security/Http/Tests/Authentication/DefaultAuthenticationSuccessHandlerTest.php
	src/Symfony/Component/Security/Tests/Core/Authentication/Token/RememberMeTokenTest.php
	src/Symfony/Component/Security/Tests/Core/Authentication/Token/RememerMeTokenTest.php
	src/Symfony/Component/Security/Tests/Core/User/AccountCheckerTest.php
	src/Symfony/Component/Security/Tests/Core/User/InMemoryProviderTest.php
	src/Symfony/Component/Security/Tests/Core/User/InMemoryUserProviderTest.php
	src/Symfony/Component/Security/Tests/Core/User/UserCheckerTest.php
This commit is contained in:
Fabien Potencier 2013-12-31 14:43:26 +01:00
commit 35774da863
58 changed files with 203 additions and 155 deletions

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection\Compiler;
namespace Symfony\Bridge\Doctrine\Tests\DependencyInjection\CompilerPass;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterEventListenersAndSubscribersPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\ProxyManager\LazyProxy\Tests;
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy;
require_once __DIR__ . '/Fixtures/includes/foo.php';

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\ProxyManager\LazyProxy\Tests\Dumper;
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Dumper;
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\DependencyInjection\ContainerBuilder;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\ProxyManager\LazyProxy\Tests\Instantiator;
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\Instantiator;
use ProxyManager\Proxy\LazyLoadingInterface;
use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\ProxyManager\LazyProxy\Tests\Instantiator;
namespace Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper;
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
use Symfony\Component\DependencyInjection\Definition;
@ -56,8 +56,8 @@ class ProxyDumperTest extends \PHPUnit_Framework_TestCase
$code = $this->dumper->getProxyCode($definition);
$this->assertStringMatchesFormat(
'%Aclass SymfonyBridgeProxyManagerLazyProxyTestsInstantiatorProxyDumperTest%aextends%w'
. '\Symfony\Bridge\ProxyManager\LazyProxy\Tests\Instantiator%a',
'%Aclass SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest%aextends%w'
. '\Symfony\Bridge\ProxyManager\Tests\LazyProxy\PhpDumper\ProxyDumperTest%a',
$code
);
}
@ -72,7 +72,7 @@ class ProxyDumperTest extends \PHPUnit_Framework_TestCase
$this->assertStringMatchesFormat(
'%wif ($lazyLoad) {%w$container = $this;%wreturn $this->services[\'foo\'] = new '
. 'SymfonyBridgeProxyManagerLazyProxyTestsInstantiatorProxyDumperTest_%s(%wfunction '
. 'SymfonyBridgeProxyManagerTestsLazyProxyPhpDumperProxyDumperTest_%s(%wfunction '
. '(&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {'
. '%w$wrappedInstance = $container->getFooService(false);%w$proxy->setProxyInitializer(null);'
. '%wreturn true;%w}%w);%w}%w',

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Twig\Tests\Node;
namespace Symfony\Bridge\Twig\Tests\TokenParser;
use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser;
use Symfony\Bridge\Twig\Node\FormThemeNode;

View File

@ -5,20 +5,7 @@ http://developer.yahoo.com/yui/license.html
version: 3.1.2
build: 56
*/
.sf-reset html{color:#000;background:#FFF;}.sf-reset body,.sf-reset div,.sf-reset dl,.sf-reset dt,.sf-reset dd,.sf-reset ul,.sf-reset ol,.sf-reset li,.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6,.sf-reset pre,.sf-reset code,.sf-reset form,.sf-reset fieldset,.sf-reset legend,.sf-reset input,.sf-reset textarea,.sf-reset p,.sf-reset blockquote,.sf-reset th,.sf-reset td{margin:0;padding:0;}.sf-reset table{border-collapse:collapse;border-spacing:0;}.sf-reset fieldset,.sf-reset img{border:0;}.sf-reset address,.sf-reset caption,.sf-reset cite,.sf-reset code,.sf-reset dfn,.sf-reset em,.sf-reset strong,.sf-reset th,.sf-reset var{font-style:normal;font-weight:normal;}.sf-reset li{list-style:none;}.sf-reset caption,.sf-reset th{text-align:left;}.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6{font-size:100%;font-weight:normal;}.sf-reset q:before,.sf-reset q:after{content:'';}.sf-reset abbr,.sf-reset acronym{border:0;font-variant:normal;}.sf-reset sup{vertical-align:text-top;}.sf-reset sub{vertical-align:text-bottom;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-family:inherit;font-size:inherit;font-weight:inherit;}.sf-reset input,.sf-reset textarea,.sf-reset select{*font-size:100%;}.sf-reset legend{color:#000;}
.sf-reset html,
.sf-reset body {
width: 100%;
min-height: 100%;
_height: 100%;
margin: 0;
padding: 0;
}
.sf-reset body {
font: 1em "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
text-align: left;
background-color: #efefef;
}
.sf-reset div,.sf-reset dl,.sf-reset dt,.sf-reset dd,.sf-reset ul,.sf-reset ol,.sf-reset li,.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6,.sf-reset pre,.sf-reset code,.sf-reset form,.sf-reset fieldset,.sf-reset legend,.sf-reset input,.sf-reset textarea,.sf-reset p,.sf-reset blockquote,.sf-reset th,.sf-reset td{margin:0;padding:0;}.sf-reset table{border-collapse:collapse;border-spacing:0;}.sf-reset fieldset,.sf-reset img{border:0;}.sf-reset address,.sf-reset caption,.sf-reset cite,.sf-reset code,.sf-reset dfn,.sf-reset em,.sf-reset strong,.sf-reset th,.sf-reset var{font-style:normal;font-weight:normal;}.sf-reset li{list-style:none;}.sf-reset caption,.sf-reset th{text-align:left;}.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6{font-size:100%;font-weight:normal;}.sf-reset q:before,.sf-reset q:after{content:'';}.sf-reset abbr,.sf-reset acronym{border:0;font-variant:normal;}.sf-reset sup{vertical-align:text-top;}.sf-reset sub{vertical-align:text-bottom;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-family:inherit;font-size:inherit;font-weight:inherit;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-size:100%;}.sf-reset legend{color:#000;}
.sf-reset abbr {
border-bottom: 1px dotted #000;
cursor: help;

View File

@ -15,7 +15,7 @@ use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
class RoutingTest extends \PHPUnit_Framework_TestCase
class RouterTest extends \PHPUnit_Framework_TestCase
{
public function testGenerateWithServiceParam()
{

View File

@ -5,20 +5,7 @@ http://developer.yahoo.com/yui/license.html
version: 3.1.2
build: 56
*/
.sf-reset html{color:#000;background:#FFF;}.sf-reset body,.sf-reset div,.sf-reset dl,.sf-reset dt,.sf-reset dd,.sf-reset ul,.sf-reset ol,.sf-reset li,.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6,.sf-reset pre,.sf-reset code,.sf-reset form,.sf-reset fieldset,.sf-reset legend,.sf-reset input,.sf-reset textarea,.sf-reset p,.sf-reset blockquote,.sf-reset th,.sf-reset td{margin:0;padding:0;}.sf-reset table{border-collapse:collapse;border-spacing:0;}.sf-reset fieldset,.sf-reset img{border:0;}.sf-reset address,.sf-reset caption,.sf-reset cite,.sf-reset code,.sf-reset dfn,.sf-reset em,.sf-reset strong,.sf-reset th,.sf-reset var{font-style:normal;font-weight:normal;}.sf-reset li{list-style:none;}.sf-reset caption,.sf-reset th{text-align:left;}.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6{font-size:100%;font-weight:normal;}.sf-reset q:before,.sf-reset q:after{content:'';}.sf-reset abbr,.sf-reset acronym{border:0;font-variant:normal;}.sf-reset sup{vertical-align:text-top;}.sf-reset sub{vertical-align:text-bottom;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-family:inherit;font-size:inherit;font-weight:inherit;}.sf-reset input,.sf-reset textarea,.sf-reset select{*font-size:100%;}.sf-reset legend{color:#000;}
.sf-reset html,
.sf-reset body {
width: 100%;
min-height: 100%;
_height: 100%;
margin: 0;
padding: 0;
}
.sf-reset body {
font: 1em "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
text-align: left;
background-color: #efefef;
}
.sf-reset div,.sf-reset dl,.sf-reset dt,.sf-reset dd,.sf-reset ul,.sf-reset ol,.sf-reset li,.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6,.sf-reset pre,.sf-reset code,.sf-reset form,.sf-reset fieldset,.sf-reset legend,.sf-reset input,.sf-reset textarea,.sf-reset p,.sf-reset blockquote,.sf-reset th,.sf-reset td{margin:0;padding:0;}.sf-reset table{border-collapse:collapse;border-spacing:0;}.sf-reset fieldset,.sf-reset img{border:0;}.sf-reset address,.sf-reset caption,.sf-reset cite,.sf-reset code,.sf-reset dfn,.sf-reset em,.sf-reset strong,.sf-reset th,.sf-reset var{font-style:normal;font-weight:normal;}.sf-reset li{list-style:none;}.sf-reset caption,.sf-reset th{text-align:left;}.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6{font-size:100%;font-weight:normal;}.sf-reset q:before,.sf-reset q:after{content:'';}.sf-reset abbr,.sf-reset acronym{border:0;font-variant:normal;}.sf-reset sup{vertical-align:text-top;}.sf-reset sub{vertical-align:text-bottom;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-family:inherit;font-size:inherit;font-weight:inherit;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-size:100%;}.sf-reset legend{color:#000;}
.sf-reset abbr {
border-bottom: 1px dotted #000;
cursor: help;
@ -58,6 +45,8 @@ build: 56
padding-bottom: 10px;
}
.sf-reset .block {
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
margin-bottom: 20px;
background-color: #FFFFFF;

View File

@ -330,10 +330,10 @@
position: static;
background: #cbcbcb;
background-image: -moz-linear-gradient(90deg, #cbcbcb, #e8e8e8); !important;
background-image: -webkit-gradient(linear, 0% 0%, 100% 0%, from(#cbcbcb), to(#e8e8e8)); !important;
background-image: -o-linear-gradient(180deg, #cbcbcb, #e8e8e8); !important;
background: linear-gradient(90deg, #cbcbcb, #e8e8e8); !important;
background-image: -moz-linear-gradient(90deg, #cbcbcb, #e8e8e8) !important;
background-image: -webkit-gradient(linear, 0% 0%, 100% 0%, from(#cbcbcb), to(#e8e8e8)) !important;
background-image: -o-linear-gradient(180deg, #cbcbcb, #e8e8e8) !important;
background: linear-gradient(90deg, #cbcbcb, #e8e8e8) !important;
}
{% endif %}

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Config\Tests;
use Symfony\Component\Config\ConfigCache;
use Symfony\Component\Config\Resource\FileResource;
class ConfigTest extends \PHPUnit_Framework_TestCase
class ConfigCacheTest extends \PHPUnit_Framework_TestCase
{
private $resourceFile = null;

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Config\Tests\Definition;
use Symfony\Component\Config\Definition\NodeInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class NormalizerTest extends \PHPUnit_Framework_TestCase
class NormalizationTest extends \PHPUnit_Framework_TestCase
{
/**
* @dataProvider getEncoderTests

View File

@ -14,7 +14,7 @@ namespace Symfony\Component\Console\Tests\Formatter;
use Symfony\Component\Console\Formatter\OutputFormatter;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
class FormatterStyleTest extends \PHPUnit_Framework_TestCase
class OutputFormatterTest extends \PHPUnit_Framework_TestCase
{
public function testEmptyTag()
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Handler;
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelector\Parser\Reader;
use Symfony\Component\CssSelector\Parser\Token;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Handler;
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelector\Parser\Handler\CommentHandler;
use Symfony\Component\CssSelector\Parser\Reader;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Handler;
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelector\Parser\Handler\HashHandler;
use Symfony\Component\CssSelector\Parser\Token;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Handler;
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelector\Parser\Handler\IdentifierHandler;
use Symfony\Component\CssSelector\Parser\Token;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Handler;
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelector\Parser\Handler\NumberHandler;
use Symfony\Component\CssSelector\Parser\Token;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Handler;
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelector\Parser\Handler\StringHandler;
use Symfony\Component\CssSelector\Parser\Token;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\CssSelector\Tests\Handler;
namespace Symfony\Component\CssSelector\Tests\Parser\Handler;
use Symfony\Component\CssSelector\Parser\Handler\WhitespaceHandler;
use Symfony\Component\CssSelector\Parser\Token;

View File

@ -121,10 +121,12 @@
<xsd:complexType name="property" mixed="true">
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:element name="property" type="property" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="service" type="service" />
</xsd:choice>
<xsd:attribute name="type" type="argument_type" />
<xsd:attribute name="id" type="xsd:string" />
<xsd:attribute name="key" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="on-invalid" type="xsd:string" />
<xsd:attribute name="strict" type="boolean" />

View File

@ -16,7 +16,7 @@ $container->
setFactoryClass('FooClass')->
setFactoryMethod('getInstance')->
setArguments(array('foo', new Reference('foo.baz'), array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%'), true, new Reference('service_container')))->
setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz')))->
setProperties(array('foo' => 'bar', 'moo' => new Reference('foo.baz'), 'qux' => array('%foo%' => 'foo is %foo%', 'foobar' => '%foo%')))->
addMethodCall('setBar', array(new Reference('bar')))->
addMethodCall('initialize')->
setConfigurator('sc_configure')

View File

@ -123,6 +123,7 @@ class ProjectServiceContainer extends Container
$instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array($this->getParameter('foo') => 'foo is '.$this->getParameter('foo').'', 'foobar' => $this->getParameter('foo'));
sc_configure($instance);
return $instance;

View File

@ -131,6 +131,7 @@ class ProjectServiceContainer extends Container
$instance->initialize();
$instance->foo = 'bar';
$instance->moo = $a;
$instance->qux = array('bar' => 'foo is bar', 'foobar' => 'bar');
sc_configure($instance);
return $instance;

View File

@ -19,6 +19,10 @@
<argument type="service" id="service_container"/>
<property name="foo">bar</property>
<property name="moo" type="service" id="foo.baz"/>
<property name="qux" type="collection">
<property key="%foo%">foo is %foo%</property>
<property key="foobar">%foo%</property>
</property>
<call method="setBar">
<argument type="service" id="bar"/>
</call>

View File

@ -12,7 +12,7 @@ services:
factory_class: FooClass
factory_method: getInstance
arguments: [foo, '@foo.baz', { '%foo%': 'foo is %foo%', foobar: '%foo%' }, true, '@service_container']
properties: { foo: bar, moo: '@foo.baz' }
properties: { foo: bar, moo: '@foo.baz', qux: { '%foo%': 'foo is %foo%', foobar: '%foo%' } }
calls:
- [setBar, ['@bar']]
- [initialize, { }]

View File

@ -43,7 +43,7 @@ class Filesystem
$this->mkdir(dirname($targetFile));
if (!$override && is_file($targetFile)) {
if (!$override && is_file($targetFile) && null === parse_url($originFile, PHP_URL_HOST)) {
$doCopy = filemtime($originFile) > filemtime($targetFile);
} else {
$doCopy = true;

View File

@ -121,6 +121,19 @@ class FilesystemTest extends FilesystemTestCase
$this->assertEquals('SOURCE FILE', file_get_contents($targetFilePath));
}
public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToNotCopy()
{
$sourceFilePath = 'http://symfony.com/images/common/logo/logo_symfony_header.png';
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
file_put_contents($targetFilePath, 'TARGET FILE');
$this->filesystem->copy($sourceFilePath, $targetFilePath, false);
$this->assertFileExists($targetFilePath);
$this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath));
}
public function testMkdirCreatesDirectoriesRecursively()
{
$directory = $this->workspace
@ -290,7 +303,7 @@ class FilesystemTest extends FilesystemTestCase
mkdir($basePath);
mkdir($basePath.'dir');
// create symlink to unexisting file
// create symlink to nonexistent file
@symlink($basePath.'file', $basePath.'link');
$this->filesystem->remove($basePath);

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Finder\Tests;
namespace Symfony\Component\Finder\Tests\Expression;
use Symfony\Component\Finder\Expression\Expression;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Finder\Tests;
namespace Symfony\Component\Finder\Tests\Expression;
use Symfony\Component\Finder\Expression\Expression;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Finder\Tests;
namespace Symfony\Component\Finder\Tests\Expression;
use Symfony\Component\Finder\Expression\Expression;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Test;
namespace Symfony\Component\Form\Tests;
class FormRendererTest extends \PHPUnit_Framework_TestCase
{

View File

@ -85,12 +85,18 @@ class JsonResponse extends Response
* @param mixed $data
*
* @return JsonResponse
*
* @throws \InvalidArgumentException
*/
public function setData($data = array())
{
// Encode <, >, ', &, and " for RFC4627-compliant JSON, which may also be embedded into HTML.
$this->data = json_encode($data, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT);
if (JSON_ERROR_NONE !== json_last_error()) {
throw new \InvalidArgumentException($this->transformJsonError());
}
return $this->update();
}
@ -116,4 +122,31 @@ class JsonResponse extends Response
return $this->setContent($this->data);
}
private function transformJsonError()
{
if (function_exists('json_last_error_msg')) {
return json_last_error_msg();
}
switch (json_last_error()) {
case JSON_ERROR_DEPTH:
return 'Maximum stack depth exceeded.';
case JSON_ERROR_STATE_MISMATCH:
return 'Underflow or the modes mismatch.';
case JSON_ERROR_CTRL_CHAR:
return 'Unexpected control character found.';
case JSON_ERROR_SYNTAX:
return 'Syntax error, malformed JSON.';
case JSON_ERROR_UTF8:
return 'Malformed UTF-8 characters, possibly incorrectly encoded.';
default:
return 'Unknown error.';
}
}
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpFoundation\Tests\File;
namespace Symfony\Component\HttpFoundation\Tests\File\MimeType;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser;

View File

@ -159,18 +159,27 @@ class JsonResponseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('text/javascript', $response->headers->get('Content-Type'));
}
public function testSetCallbackInvalidIdentifier()
{
$response = new JsonResponse('foo');
$this->setExpectedException('InvalidArgumentException');
$response->setCallback('+invalid');
}
public function testJsonEncodeFlags()
{
$response = new JsonResponse('<>\'&"');
$this->assertEquals('"\u003C\u003E\u0027\u0026\u0022"', $response->getContent());
}
/**
* @expectedException \InvalidArgumentException
*/
public function testSetCallbackInvalidIdentifier()
{
$response = new JsonResponse('foo');
$response->setCallback('+invalid');
}
/**
* @expectedException \InvalidArgumentException
*/
public function testSetContent()
{
JsonResponse::create("\xB1\x31");
}
}

View File

@ -22,7 +22,7 @@ use Symfony\Component\HttpFoundation\Session\Session;
*
* @runTestsInSeparateProcesses
*/
class NullSessionStorageTest extends \PHPUnit_Framework_TestCase
class NullSessionHandlerTest extends \PHPUnit_Framework_TestCase
{
public function testSaveHandlers()
{

View File

@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag;
*
* @runTestsInSeparateProcesses
*/
class PhpSessionStorageTest extends \PHPUnit_Framework_TestCase
class PhpBridgeSessionStorageTest extends \PHPUnit_Framework_TestCase
{
private $savePath;

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests;
namespace Symfony\Component\HttpKernel\Tests\Controller;
use Symfony\Component\HttpKernel\Controller\ControllerResolver;
use Symfony\Component\HttpKernel\Tests\Logger;
use Symfony\Component\HttpFoundation\Request;
class ControllerResolverTest extends \PHPUnit_Framework_TestCase
@ -25,9 +26,9 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($resolver->getController($request), '->getController() returns false when the request has no _controller attribute');
$this->assertEquals(array('Unable to look for the controller as the "_controller" parameter is missing'), $logger->getLogs('warning'));
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\ControllerResolverTest::testGetController');
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::testGetController');
$controller = $resolver->getController($request);
$this->assertInstanceOf('Symfony\Component\HttpKernel\Tests\ControllerResolverTest', $controller[0], '->getController() returns a PHP callable');
$this->assertInstanceOf('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', $controller[0], '->getController() returns a PHP callable');
$request->attributes->set('_controller', $lambda = function () {});
$controller = $resolver->getController($request);
@ -37,21 +38,21 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
$controller = $resolver->getController($request);
$this->assertSame($this, $controller);
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\ControllerResolverTest');
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest');
$controller = $resolver->getController($request);
$this->assertInstanceOf('Symfony\Component\HttpKernel\Tests\ControllerResolverTest', $controller);
$this->assertInstanceOf('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', $controller);
$request->attributes->set('_controller', array($this, 'controllerMethod1'));
$controller = $resolver->getController($request);
$this->assertSame(array($this, 'controllerMethod1'), $controller);
$request->attributes->set('_controller', array('Symfony\Component\HttpKernel\Tests\ControllerResolverTest', 'controllerMethod4'));
$request->attributes->set('_controller', array('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4'));
$controller = $resolver->getController($request);
$this->assertSame(array('Symfony\Component\HttpKernel\Tests\ControllerResolverTest', 'controllerMethod4'), $controller);
$this->assertSame(array('Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest', 'controllerMethod4'), $controller);
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\some_controller_function');
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\Controller\some_controller_function');
$controller = $resolver->getController($request);
$this->assertSame('Symfony\Component\HttpKernel\Tests\some_controller_function', $controller);
$this->assertSame('Symfony\Component\HttpKernel\Tests\Controller\some_controller_function', $controller);
$request->attributes->set('_controller', 'foo');
try {
@ -69,7 +70,7 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
$this->assertInstanceOf('\InvalidArgumentException', $e, '->getController() throws an \InvalidArgumentException if the _controller attribute contains a non-existent class');
}
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\ControllerResolverTest::bar');
$request->attributes->set('_controller', 'Symfony\Component\HttpKernel\Tests\Controller\ControllerResolverTest::bar');
try {
$resolver->getController($request);
$this->fail('->getController() throws an \InvalidArgumentException if the _controller attribute contains a non-existent method');
@ -119,7 +120,7 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
$request = Request::create('/');
$request->attributes->set('foo', 'foo');
$request->attributes->set('foobar', 'foobar');
$controller = 'Symfony\Component\HttpKernel\Tests\some_controller_function';
$controller = 'Symfony\Component\HttpKernel\Tests\Controller\some_controller_function';
$this->assertEquals(array('foo', 'foobar'), $resolver->getArguments($request, $controller));
$request = Request::create('/');
@ -146,7 +147,7 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase
public function testCreateControllerCanReturnAnyCallable()
{
$mock = $this->getMock('Symfony\Component\HttpKernel\Controller\ControllerResolver', array('createController'));
$mock->expects($this->once())->method('createController')->will($this->returnValue('Symfony\Component\HttpKernel\Tests\some_controller_function'));
$mock->expects($this->once())->method('createController')->will($this->returnValue('Symfony\Component\HttpKernel\Tests\Controller\some_controller_function'));
$request = Request::create('/');
$request->attributes->set('_controller', 'foobar');

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests;
namespace Symfony\Component\HttpKernel\Tests\DependencyInjection;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Tests\Fragment\FragmentRenderer;
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Fragment\Tests\FragmentRenderer;
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Fragment\Tests\FragmentRenderer;
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use Symfony\Component\HttpKernel\Controller\ControllerReference;
use Symfony\Component\HttpKernel\HttpKernel;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\HttpKernel\Fragment\Tests\FragmentRenderer;
namespace Symfony\Component\HttpKernel\Tests\Fragment;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Controller\ControllerReference;

View File

@ -58,6 +58,8 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
*/
public function testFormatCurrencyWithCurrencyStyle($value, $currency, $expected)
{
IntlTestHelper::requireFullIntl($this);
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
$this->assertEquals($expected, $formatter->formatCurrency($value, $currency));
}
@ -84,6 +86,8 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
*/
public function testFormatCurrencyWithCurrencyStyleCostaRicanColonsRounding($value, $currency, $symbol, $expected)
{
IntlTestHelper::requireFullIntl($this);
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
}
@ -102,6 +106,8 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
*/
public function testFormatCurrencyWithCurrencyStyleBrazilianRealRounding($value, $currency, $symbol, $expected)
{
IntlTestHelper::requireFullIntl($this);
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
}
@ -129,6 +135,8 @@ abstract class AbstractNumberFormatterTest extends \PHPUnit_Framework_TestCase
*/
public function testFormatCurrencyWithCurrencyStyleSwissRounding($value, $currency, $symbol, $expected)
{
IntlTestHelper::requireFullIntl($this);
$formatter = $this->getNumberFormatter('en', NumberFormatter::CURRENCY);
$this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency));
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Routing\Test\Matcher\Dumper;
namespace Symfony\Component\Routing\Tests\Matcher\Dumper;
use Symfony\Component\Routing\Matcher\Dumper\DumperCollection;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Tests\Domain;
namespace Symfony\Component\Security\Tests\Acl\Domain;
use Symfony\Component\Security\Acl\Domain\Entry;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Acl\Tests\Util;
namespace Symfony\Component\Security\Acl\Tests\Permission;
use Symfony\Component\Security\Acl\Permission\MaskBuilder;

View File

@ -32,22 +32,6 @@ class UserChecker implements UserCheckerInterface
return;
}
if (!$user->isCredentialsNonExpired()) {
$ex = new CredentialsExpiredException('User credentials have expired.');
$ex->setUser($user);
throw $ex;
}
}
/**
* {@inheritdoc}
*/
public function checkPostAuth(UserInterface $user)
{
if (!$user instanceof AdvancedUserInterface) {
return;
}
if (!$user->isAccountNonLocked()) {
$ex = new LockedException('User account is locked.');
$ex->setUser($user);
@ -66,4 +50,20 @@ class UserChecker implements UserCheckerInterface
throw $ex;
}
}
/**
* {@inheritdoc}
*/
public function checkPostAuth(UserInterface $user)
{
if (!$user instanceof AdvancedUserInterface) {
return;
}
if (!$user->isCredentialsNonExpired()) {
$ex = new CredentialsExpiredException('User credentials have expired.');
$ex->setUser($user);
throw $ex;
}
}
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests;
namespace Symfony\Component\Security\Http\Tests\Authentication;
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler;
use Symfony\Component\Security\Core\SecurityContextInterface;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Http\Tests;
namespace Symfony\Component\Security\Http\Tests\Authentication;
use Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Tests\Authentication\Token;
namespace Symfony\Component\Security\Tests\Core\Authentication\Token;
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;
use Symfony\Component\Security\Core\Role\Role;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Tests\User;
namespace Symfony\Component\Security\Tests\Core\User;
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
use Symfony\Component\Security\Core\User\User;

View File

@ -9,42 +9,12 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Security\Core\Tests\User;
namespace Symfony\Component\Security\Tests\Core\User;
use Symfony\Component\Security\Core\User\UserChecker;
class UserCheckerTest extends \PHPUnit_Framework_TestCase
{
public function testCheckPreAuthNotAdvancedUserInterface()
{
$checker = new UserChecker();
$this->assertNull($checker->checkPreAuth($this->getMock('Symfony\Component\Security\Core\User\UserInterface')));
}
public function testCheckPreAuthPass()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(true));
$this->assertNull($checker->checkPreAuth($account));
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\CredentialsExpiredException
*/
public function testCheckPreAuthCredentialsExpired()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(false));
$checker->checkPreAuth($account);
}
public function testCheckPostAuthNotAdvancedUserInterface()
{
$checker = new UserChecker();
@ -57,30 +27,60 @@ class UserCheckerTest extends \PHPUnit_Framework_TestCase
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true));
$account->expects($this->once())->method('isEnabled')->will($this->returnValue(true));
$account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(true));
$account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(true));
$this->assertNull($checker->checkPostAuth($account));
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\CredentialsExpiredException
*/
public function testCheckPostAuthCredentialsExpired()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isCredentialsNonExpired')->will($this->returnValue(false));
$checker->checkPostAuth($account);
}
public function testCheckPreAuthNotAdvancedUserInterface()
{
$checker = new UserChecker();
$this->assertNull($checker->checkPreAuth($this->getMock('Symfony\Component\Security\Core\User\UserInterface')));
}
public function testCheckPreAuthPass()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true));
$account->expects($this->once())->method('isEnabled')->will($this->returnValue(true));
$account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(true));
$this->assertNull($checker->checkPreAuth($account));
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\LockedException
*/
public function testCheckPostAuthAccountLocked()
public function testCheckPreAuthAccountLocked()
{
$checker = new UserChecker();
$account = $this->getMock('Symfony\Component\Security\Core\User\AdvancedUserInterface');
$account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(false));
$checker->checkPostAuth($account);
$checker->checkPreAuth($account);
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\DisabledException
*/
public function testCheckPostAuthDisabled()
public function testCheckPreAuthDisabled()
{
$checker = new UserChecker();
@ -88,13 +88,13 @@ class UserCheckerTest extends \PHPUnit_Framework_TestCase
$account->expects($this->once())->method('isAccountNonLocked')->will($this->returnValue(true));
$account->expects($this->once())->method('isEnabled')->will($this->returnValue(false));
$checker->checkPostAuth($account);
$checker->checkPreAuth($account);
}
/**
* @expectedException \Symfony\Component\Security\Core\Exception\AccountExpiredException
*/
public function testCheckPostAuthAccountExpired()
public function testCheckPreAuthAccountExpired()
{
$checker = new UserChecker();
@ -103,6 +103,6 @@ class UserCheckerTest extends \PHPUnit_Framework_TestCase
$account->expects($this->once())->method('isEnabled')->will($this->returnValue(true));
$account->expects($this->once())->method('isAccountNonExpired')->will($this->returnValue(false));
$checker->checkPostAuth($account);
$checker->checkPreAuth($account);
}
}

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Test\Catalogue;
namespace Symfony\Component\Translation\Tests\Catalogue;
use Symfony\Component\Translation\MessageCatalogue;
use Symfony\Component\Translation\MessageCatalogueInterface;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Test\Catalogue;
namespace Symfony\Component\Translation\Tests\Catalogue;
use Symfony\Component\Translation\Catalogue\DiffOperation;
use Symfony\Component\Translation\MessageCatalogue;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Translation\Test\Catalogue;
namespace Symfony\Component\Translation\Tests\Catalogue;
use Symfony\Component\Translation\Catalogue\MergeOperation;
use Symfony\Component\Translation\MessageCatalogue;

View File

@ -176,7 +176,7 @@
</trans-unit>
<trans-unit id="47">
<source>This value should be the user current password.</source>
<target>Ši reikšmė turi sutapti su dabartiniu vartotojo slaptažodžiu.</target>
<target>Ši reikšmė turi sutapti su dabartiniu naudotojo slaptažodžiu.</target>
</trans-unit>
<trans-unit id="48">
<source>This value should have exactly {{ limit }} character.|This value should have exactly {{ limit }} characters.</source>