diff --git a/core/themes/stark/css/layout-rtl.css b/core/composer.json similarity index 5% copy from core/themes/stark/css/layout-rtl.css copy to core/composer.json index d5e9c6d..37495f1 100644 --- a/core/themes/stark/css/layout-rtl.css +++ b/core/composer.json @@ -1,52 +1,12 @@ -@media all and (min-width: 480px) and (max-width: 959px) { - body.sidebar-first #content, - body.two-sidebars #content { - float: left; - } - body.sidebar-second #content { - float: right; - } - - #sidebar-first { - float: right; - } - - #sidebar-second { - float: left; - } - body.two-sidebars #sidebar-second { - float: right; - clear: right; - } - body.two-sidebars #sidebar-second .block { - float: right; - } -} - -@media all and (min-width: 960px) { - #content { - float: right; - } - body.sidebar-first #content { - left: 0; - right: 20%; - } - body.two-sidebars #content { - left: 0; - right: 20%; - } - - #sidebar-first { - float: right; - left: 0; - right: -80%; - } - body.two-sidebars #sidebar-first { - left: 0; - right: -60%; - } - - #sidebar-second { - float: left; +{ + "require": { + "symfony/class-loader": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/event-dispatcher": "2.1.*", + "symfony/http-foundation": "2.1.*", + "symfony/http-kernel": "2.1.*", + "symfony/routing": "2.1.*", + "symfony/yaml": "2.1.*", + "twig/twig": "1.8.*" } } diff --git a/core/composer.lock b/core/composer.lock new file mode 100644 index 0000000..0d80bf3 --- /dev/null +++ b/core/composer.lock @@ -0,0 +1,101 @@ +{ + "hash": "3d5540af4221e83c736789c8570b9c09", + "packages": [ + { + "package": "symfony/class-loader", + "version": "dev-master", + "source-reference": "94bf74926fc5793c201e1997f54cfdfa92f05e83" + }, + { + "package": "symfony/class-loader", + "version": "dev-master", + "alias-pretty-version": "2.1.x-dev", + "alias-version": "2.1.9999999.9999999-dev" + }, + { + "package": "symfony/dependency-injection", + "version": "dev-master", + "alias-pretty-version": "2.1.x-dev", + "alias-version": "2.1.9999999.9999999-dev" + }, + { + "package": "symfony/dependency-injection", + "version": "dev-master", + "source-reference": "c7fc49daf41dc76e2e2f629474e8777837ba3fd0" + }, + { + "package": "symfony/event-dispatcher", + "version": "dev-master", + "alias-pretty-version": "2.1.x-dev", + "alias-version": "2.1.9999999.9999999-dev" + }, + { + "package": "symfony/event-dispatcher", + "version": "dev-master", + "source-reference": "30d3f5da80c2aeab15bcdb5a7d448d15bc294b23" + }, + { + "package": "symfony/http-foundation", + "version": "dev-master", + "alias-pretty-version": "2.1.x-dev", + "alias-version": "2.1.9999999.9999999-dev" + }, + { + "package": "symfony/http-foundation", + "version": "dev-master", + "source-reference": "a00163103a9628fae03bb101b550302be0249b1b" + }, + { + "package": "symfony/http-kernel", + "version": "dev-master", + "alias-pretty-version": "2.1.x-dev", + "alias-version": "2.1.9999999.9999999-dev" + }, + { + "package": "symfony/http-kernel", + "version": "dev-master", + "source-reference": "9677d2e7f972493e697eb1975ebbdc547020f0f8" + }, + { + "package": "symfony/routing", + "version": "dev-master", + "alias-pretty-version": "2.1.x-dev", + "alias-version": "2.1.9999999.9999999-dev" + }, + { + "package": "symfony/routing", + "version": "dev-master", + "source-reference": "5ae64e509722bc78ab15b3028f90ccf2233a46b5" + }, + { + "package": "symfony/yaml", + "version": "dev-master", + "alias-pretty-version": "2.1.x-dev", + "alias-version": "2.1.9999999.9999999-dev" + }, + { + "package": "symfony/yaml", + "version": "dev-master", + "source-reference": "8272d98f8087878db37e8e5f6d4e37c5cc783dc3" + }, + { + "package": "twig/twig", + "version": "dev-master", + "alias-pretty-version": "1.8.x-dev", + "alias-version": "1.8.9999999.9999999-dev" + }, + { + "package": "twig/twig", + "version": "dev-master", + "source-reference": "4679ad51c5390648b7ea4c8f0ecd2c0c344145ba" + } + ], + "packages-dev": null, + "aliases": [ + + ], + "minimum-stability": "dev", + "stability-flags": [ + + ] +} diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index fa1335b..17b98e2 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2994,13 +2994,13 @@ function drupal_classloader() { if (!isset($loader)) { // Include the Symfony ClassLoader for loading PSR-0-compatible classes. - require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php'; + require_once DRUPAL_ROOT . '/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php'; // @todo Use a cleaner way than variable_get() to switch autoloaders. switch (variable_get('autoloader_mode', 'default')) { case 'apc': if (function_exists('apc_store')) { - require_once DRUPAL_ROOT . '/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; + require_once DRUPAL_ROOT . '/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php'; $loader = new ApcUniversalClassLoader('drupal.' . $GLOBALS['drupal_hash_salt']); break; } @@ -3015,13 +3015,19 @@ function drupal_classloader() { // Register explicit PSR-0 vendor namespaces. $loader->registerNamespaces(array( - // All Symfony-borrowed code lives in /core/vendor/Symfony. - 'Symfony' => DRUPAL_ROOT . '/core/vendor', + // All Symfony-borrowed code lives in /core/vendor/symfony. + 'Symfony\\Component\\ClassLoader' => DRUPAL_ROOT . '/core/vendor/symfony/class-loader', + 'Symfony\\Component\\DependencyInjection' => DRUPAL_ROOT . '/core/vendor/symfony/dependency-injection', + 'Symfony\\Component\\EventDispatcher' => DRUPAL_ROOT . '/core/vendor/symfony/event-dispatcher', + 'Symfony\\Component\\HttpFoundation' => DRUPAL_ROOT . '/core/vendor/symfony/http-foundation', + 'Symfony\\Component\\HttpKernel' => DRUPAL_ROOT . '/core/vendor/symfony/http-kernel', + 'Symfony\\Component\\Routing' => DRUPAL_ROOT . '/core/vendor/symfony/routing', + 'Symfony\\Component\\Yaml' => DRUPAL_ROOT . '/core/vendor/symfony/yaml', )); // Register PEAR-style vendor namespaces. $loader->registerPrefixes(array( - // All Twig-borrowed code lives in /core/vendor/Twig. - 'Twig' => DRUPAL_ROOT . '/core/vendor', + // All Twig-borrowed code lives in /core/vendor/twig. + 'Twig' => DRUPAL_ROOT . '/core/vendor/twig/twig/lib', )); // Register the Drupal namespace for classes in core as a fallback. // This allows to register additional namespaces within the Drupal namespace diff --git a/core/vendor/.gitignore b/core/vendor/.gitignore new file mode 100644 index 0000000..baa1585 --- /dev/null +++ b/core/vendor/.gitignore @@ -0,0 +1,18 @@ +# SimpleTest breaks with the following files, so avoid adding them. +symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1-1.php +symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/php5.4/traits.php + +# Avoid using git submodules with Drupal's dependencies. +symfony/class-loader/Symfony/Component/ClassLoader/.git +symfony/dependency-injection/Symfony/Component/DependencyInjection/.git +symfony/event-dispatcher/Symfony/Component/EventDispatcher/.git +symfony/http-foundation/Symfony/Component/HttpFoundation/.git +symfony/http-kernel/Symfony/Component/HttpKernel/.git +symfony/routing/Symfony/Component/Routing/.git +symfony/yaml/Symfony/Component/Yaml/.git + +# Composer adds a deprecated .composer folder, which we don't need. +.composer + +# Having composer.lock means we don't need installed.json. +composer/installed.json diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcacheSessionHandler.php b/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcacheSessionHandler.php deleted file mode 100644 index 4fea88b..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcacheSessionHandler.php +++ /dev/null @@ -1,68 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * NativeMemcacheSessionHandler. - * - * Driver for the memcache session save hadlers provided by the memcache PHP extension. - * - * @see http://php.net/memcache - * - * @author Drak - */ -class NativeMemcacheSessionHandler extends NativeSessionHandler -{ - /** - * Constructor. - * - * @param string $savePath Path of memcache server. - * @param array $options Session configuration options. - */ - public function __construct($savePath = 'tcp://127.0.0.1:11211?persistent=0', array $options = array()) - { - if (!extension_loaded('memcache')) { - throw new \RuntimeException('PHP does not have "memcache" session module registered'); - } - - if (null === $savePath) { - $savePath = ini_get('session.save_path'); - } - - ini_set('session.save_handler', 'memcache'); - ini_set('session.save_path', $savePath); - - $this->setOptions($options); - } - - /** - * Set any memcached ini values. - * - * @see http://php.net/memcache.ini - */ - protected function setOptions(array $options) - { - $validOptions = array_flip(array( - 'memcache.allow_failover', 'memcache.max_failover_attempts', - 'memcache.chunk_size', 'memcache.default_port', 'memcache.hash_strategy', - 'memcache.hash_function', 'memcache.protocol', 'memcache.redundancy', - 'memcache.session_redundancy', 'memcache.compress_threshold', - 'memcache.lock_timeout', - )); - - foreach ($options as $key => $value) { - if (isset($validOptions[$key])) { - ini_set($key, $value); - } - } - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcachedSessionHandler.php b/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcachedSessionHandler.php deleted file mode 100644 index 8f64660..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeMemcachedSessionHandler.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * NativeMemcachedSessionHandler. - * - * Driver for the memcached session save hadlers provided by the memcached PHP extension. - * - * @see http://php.net/memcached.sessions - * - * @author Drak - */ -class NativeMemcachedSessionHandler extends NativeSessionHandler -{ - /** - * Constructor. - * - * @param string $savePath Comma separated list of servers: e.g. memcache1.example.com:11211,memcache2.example.com:11211 - * @param array $options Session configuration options. - */ - public function __construct($savePath = '127.0.0.1:11211', array $options = array()) - { - if (!extension_loaded('memcached')) { - throw new \RuntimeException('PHP does not have "memcached" session module registered'); - } - - if (null === $savePath) { - $savePath = ini_get('session.save_path'); - } - - ini_set('session.save_handler', 'memcached'); - ini_set('session.save_path', $savePath); - - $this->setOptions($options); - } - - /** - * Set any memcached ini values. - * - * @see https://github.com/php-memcached-dev/php-memcached/blob/master/memcached.ini - */ - protected function setOptions(array $options) - { - $validOptions = array_flip(array( - 'memcached.sess_locking', 'memcached.sess_lock_wait', - 'memcached.sess_prefix', 'memcached.compression_type', - 'memcached.compression_factor', 'memcached.compression_threshold', - 'memcached.serializer', - )); - - foreach ($options as $key => $value) { - if (isset($validOptions[$key])) { - ini_set($key, $value); - } - } - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeRedisSessionHandler.php b/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeRedisSessionHandler.php deleted file mode 100644 index d155052..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeRedisSessionHandler.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * NativeRedisSessionStorage. - * - * Driver for the redis session save hadlers provided by the redis PHP extension. - * - * @see https://github.com/nicolasff/phpredis - * - * @author Andrej Hudec - */ -class NativeRedisSessionHandler extends NativeSessionHandler -{ - /** - * Constructor. - * - * @param string $savePath Path of redis server. - */ - public function __construct($savePath = 'tcp://127.0.0.1:6379?persistent=0') - { - if (!extension_loaded('redis')) { - throw new \RuntimeException('PHP does not have "redis" session module registered'); - } - - if (null === $savePath) { - $savePath = ini_get('session.save_path'); - } - - ini_set('session.save_handler', 'redis'); - ini_set('session.save_path', $savePath); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php deleted file mode 100644 index 1260ad0..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * Adds SessionHandler functionality if available. - * - * @see http://php.net/sessionhandler - */ - -if (version_compare(phpversion(), '5.4.0', '>=')) { - class NativeSessionHandler extends \SessionHandler {} -} else { - class NativeSessionHandler {} -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSqliteSessionHandler.php b/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSqliteSessionHandler.php deleted file mode 100644 index 098cc8a..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSqliteSessionHandler.php +++ /dev/null @@ -1,58 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * NativeSqliteSessionHandler. - * - * Driver for the sqlite session save hadlers provided by the SQLite PHP extension. - * - * @author Drak - */ -class NativeSqliteSessionHandler extends NativeSessionHandler -{ - /** - * Constructor. - * - * @param string $savePath Path to SQLite database file itself. - * @param array $options Session configuration options. - */ - public function __construct($savePath, array $options = array()) - { - if (!extension_loaded('sqlite')) { - throw new \RuntimeException('PHP does not have "sqlite" session module registered'); - } - - if (null === $savePath) { - $savePath = ini_get('session.save_path'); - } - - ini_set('session.save_handler', 'sqlite'); - ini_set('session.save_path', $savePath); - - $this->setOptions($options); - } - - /** - * Set any sqlite ini values. - * - * @see http://php.net/sqlite.configuration - */ - protected function setOptions(array $options) - { - foreach ($options as $key => $value) { - if (in_array($key, array('sqlite.assoc_case'))) { - ini_set($key, $value); - } - } - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php deleted file mode 100644 index 7bdf3a1..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * Test class for NativeFileSessionHandler. - * - * @author Drak - * - * @runTestsInSeparateProcesses - */ -class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testConstruct() - { - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); - - if (version_compare(phpversion(), '5.4.0', '<')) { - $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('files', ini_get('session.save_handler')); - } else { - $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('user', ini_get('session.save_handler')); - } - - $this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path')); - $this->assertEquals('TESTING', ini_get('session.name')); - } - - public function testConstructDefault() - { - $path = ini_get('session.save_path'); - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler()); - - $this->assertEquals($path, ini_get('session.save_path')); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeMemcacheSessionHandlerTest.php b/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeMemcacheSessionHandlerTest.php deleted file mode 100644 index b915e59..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeMemcacheSessionHandlerTest.php +++ /dev/null @@ -1,45 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeMemcacheSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * Test class for NativeMemcacheSessionHandler. - * - * @author Drak - * - * @runTestsInSeparateProcesses - */ -class NativeMemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testSaveHandlers() - { - if (!extension_loaded('memcache')) { - $this->markTestSkipped('Skipped tests memcache extension is not present'); - } - - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeMemcacheSessionHandler('tcp://127.0.0.1:11211?persistent=0')); - - if (version_compare(phpversion(), '5.4.0', '<')) { - $this->assertEquals('memcache', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('memcache', ini_get('session.save_handler')); - } else { - $this->assertEquals('memcache', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('user', ini_get('session.save_handler')); - } - - $this->assertEquals('tcp://127.0.0.1:11211?persistent=0', ini_get('session.save_path')); - $this->assertEquals('TESTING', ini_get('session.name')); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeMemcachedSessionHandlerTest.php b/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeMemcachedSessionHandlerTest.php deleted file mode 100644 index 5f65e9a..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeMemcachedSessionHandlerTest.php +++ /dev/null @@ -1,49 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeMemcachedSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * Test class for NativeMemcachedSessionHandler. - * - * @author Drak - * - * @runTestsInSeparateProcesses - */ -class NativeMemcachedSessionHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testSaveHandlers() - { - if (!extension_loaded('memcached')) { - $this->markTestSkipped('Skipped tests memcached extension is not present'); - } - - // test takes too long if memcached server is not running - ini_set('memcached.sess_locking', '0'); - - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeMemcachedSessionHandler('127.0.0.1:11211')); - - if (version_compare(phpversion(), '5.4.0', '<')) { - $this->assertEquals('memcached', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('memcached', ini_get('session.save_handler')); - } else { - $this->assertEquals('memcached', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('user', ini_get('session.save_handler')); - } - - $this->assertEquals('127.0.0.1:11211', ini_get('session.save_path')); - $this->assertEquals('TESTING', ini_get('session.name')); - } -} - diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeRedisSessionHandlerTest.php b/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeRedisSessionHandlerTest.php deleted file mode 100644 index 8a57776..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeRedisSessionHandlerTest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeRedisSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * Test class for NativeRedisSessionHandlerTest. - * - * @runTestsInSeparateProcesses - */ -class NativeRedisSessionHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testSaveHandlers() - { - if (!extension_loaded('redis')) { - $this->markTestSkipped('Skipped tests Redis extension is not present'); - } - - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeRedisSessionHandler('tcp://127.0.0.1:6379?persistent=0')); - - if (version_compare(phpversion(), '5.4.0', '<')) { - $this->assertEquals('redis', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('redis', ini_get('session.save_handler')); - } else { - $this->assertEquals('redis', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('user', ini_get('session.save_handler')); - } - - $this->assertEquals('tcp://127.0.0.1:6379?persistent=0', ini_get('session.save_path')); - $this->assertEquals('TESTING', ini_get('session.name')); - } -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSqliteSessionHandlerTest.php b/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSqliteSessionHandlerTest.php deleted file mode 100644 index 983148e..0000000 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSqliteSessionHandlerTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSqliteSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; - -/** - * Test class for NativeSqliteSessionHandler. - * - * @author Drak - * - * @runTestsInSeparateProcesses - */ -class NativeSqliteSessionHandlerTest extends \PHPUnit_Framework_TestCase -{ - public function testSaveHandlers() - { - if (!extension_loaded('sqlite')) { - $this->markTestSkipped('Skipped tests SQLite extension is not present'); - } - - $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeSqliteSessionHandler(sys_get_temp_dir().'/sqlite.db')); - - if (version_compare(phpversion(), '5.4.0', '<')) { - $this->assertEquals('sqlite', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('sqlite', ini_get('session.save_handler')); - } else { - $this->assertEquals('sqlite', $storage->getSaveHandler()->getSaveHandlerName()); - $this->assertEquals('user', ini_get('session.save_handler')); - } - - - $this->assertEquals(sys_get_temp_dir().'/sqlite.db', ini_get('session.save_path')); - $this->assertEquals('TESTING', ini_get('session.name')); - } -} - diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/bootstrap.php b/core/vendor/Symfony/Component/HttpKernel/Tests/bootstrap.php deleted file mode 100644 index 2386a26..0000000 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/bootstrap.php +++ /dev/null @@ -1,37 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -spl_autoload_register(function ($class) { - foreach (array( - 'SYMFONY_EVENT_DISPATCHER' => 'EventDispatcher', - 'SYMFONY_HTTP_FOUNDATION' => 'HttpFoundation', - 'SYMFONY_DEPENDENCY_INJECTION' => 'DependencyInjection', - 'SYMFONY_CONSOLE' => 'Console', - 'SYMFONY_BROWSER_KIT' => 'BrowserKit', - 'SYMFONY_FINDER' => 'Finder', - 'SYMFONY_CLASS_LOADER' => 'ClassLoader', - 'SYMFONY_PROCESS' => 'Process', - 'SYMFONY_ROUTING' => 'Routing', - 'SYMFONY_CONFIG' => 'Config', - ) as $env => $name) { - if (isset($_SERVER[$env]) && 0 === strpos(ltrim($class, '/'), 'Symfony\Component\\'.$name)) { - if (file_exists($file = $_SERVER[$env].'/'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\\'.$name)).'.php')) { - require_once $file; - } - } - } - - if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\HttpKernel')) { - if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\HttpKernel')).'.php')) { - require_once $file; - } - } -}); diff --git a/core/vendor/autoload.php b/core/vendor/autoload.php new file mode 100644 index 0000000..85087dd --- /dev/null +++ b/core/vendor/autoload.php @@ -0,0 +1,25 @@ + $path) { + $loader->add($namespace, $path); + } + + $classMap = require $composerDir . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + + $loader->register(); + + return $loader; +}); diff --git a/core/vendor/Symfony/Component/ClassLoader/ClassLoader.php b/core/vendor/composer/ClassLoader.php similarity index 80% copy from core/vendor/Symfony/Component/ClassLoader/ClassLoader.php copy to core/vendor/composer/ClassLoader.php index b94bdb9..146276e 100644 --- a/core/vendor/Symfony/Component/ClassLoader/ClassLoader.php +++ b/core/vendor/composer/ClassLoader.php @@ -1,22 +1,23 @@ + * (c) Nils Adermann + * Jordi Boggiano * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\ClassLoader; +namespace Composer\Autoload; /** - * ClassLoader implements an PSR-0 class loader + * ClassLoader implements a PSR-0 class loader * * See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md * - * $loader = new ClassLoader(); + * $loader = new \Composer\Autoload\ClassLoader(); * * // register classes with namespaces * $loader->add('Symfony\Component', __DIR__.'/component'); @@ -34,6 +35,8 @@ namespace Symfony\Component\ClassLoader; * directory, and it will then fallback to the framework/ directory if not * found before giving up. * + * This class is loosely based on the Symfony UniversalClassLoader. + * * @author Fabien Potencier * @author Jordi Boggiano */ @@ -42,6 +45,7 @@ class ClassLoader private $prefixes = array(); private $fallbackDirs = array(); private $useIncludePath = false; + private $classMap = array(); public function getPrefixes() { @@ -53,20 +57,30 @@ class ClassLoader return $this->fallbackDirs; } - public function addPrefixes(array $prefixes) + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) { - foreach ($prefixes as $prefix => $path) { - $this->addPrefix($prefix, $path); + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; } } /** * Registers a set of classes * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes + * @param string $prefix The classes prefix + * @param array|string $paths The location(s) of the classes */ - public function addPrefix($prefix, $paths) + public function add($prefix, $paths) { if (!$prefix) { foreach ((array) $paths as $path) { @@ -86,7 +100,7 @@ class ClassLoader } /** - * Turns on searching the include for class files. + * Turns on searching the include path for class files. * * @param Boolean $useIncludePath */ @@ -127,7 +141,7 @@ class ClassLoader /** * Loads the given class or interface. * - * @param string $class The name of the class + * @param string $class The name of the class * @return Boolean|null True, if loaded */ public function loadClass($class) @@ -148,6 +162,10 @@ class ClassLoader */ public function findFile($class) { + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ('\\' == $class[0]) { $class = substr($class, 1); } diff --git a/core/lib/Drupal/Core/Config/FileStorageException.php b/core/vendor/composer/autoload_classmap.php similarity index 6% copy from core/lib/Drupal/Core/Config/FileStorageException.php copy to core/vendor/composer/autoload_classmap.php index bf3ae5f..4a9177d 100644 --- a/core/lib/Drupal/Core/Config/FileStorageException.php +++ b/core/vendor/composer/autoload_classmap.php @@ -1,10 +1,9 @@ $vendorDir . '/twig/twig/lib/', + 'Symfony\\Component\\Yaml' => $vendorDir . '/symfony/yaml/', + 'Symfony\\Component\\Routing' => $vendorDir . '/symfony/routing/', + 'Symfony\\Component\\HttpKernel' => $vendorDir . '/symfony/http-kernel/', + 'Symfony\\Component\\HttpFoundation' => $vendorDir . '/symfony/http-foundation/', + 'Symfony\\Component\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/', + 'Symfony\\Component\\DependencyInjection' => $vendorDir . '/symfony/dependency-injection/', + 'Symfony\\Component\\ClassLoader' => $vendorDir . '/symfony/class-loader/', + 'SessionHandlerInterface' => $vendorDir . '/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs', +); diff --git a/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/.gitignore b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/core/vendor/Symfony/Component/ClassLoader/ApcClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php similarity index 95% rename from core/vendor/Symfony/Component/ClassLoader/ApcClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php index 3508db6..04104a1 100644 --- a/core/vendor/Symfony/Component/ClassLoader/ApcClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcClassLoader.php @@ -47,8 +47,8 @@ class ApcClassLoader /** * Constructor. * - * @param string $prefix A prefix to create a namespace in APC - * @param object $classFinder + * @param string $prefix A prefix to create a namespace in APC + * @param object $classFinder An object that implements findFile() method. * * @api */ @@ -88,6 +88,7 @@ class ApcClassLoader * Loads the given class or interface. * * @param string $class The name of the class + * * @return Boolean|null True, if loaded */ public function loadClass($class) diff --git a/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php similarity index 98% rename from core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php index 1295d0a..379fbe4 100644 --- a/core/vendor/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ApcUniversalClassLoader.php @@ -84,6 +84,8 @@ class ApcUniversalClassLoader extends UniversalClassLoader * Finds a file by class name while caching lookups to APC. * * @param string $class A class name to resolve to file + * + * @return string|null The path, if found */ public function findFile($class) { diff --git a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/CHANGELOG.md similarity index 6% copy from core/vendor/Symfony/Component/Yaml/CHANGELOG.md copy to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/CHANGELOG.md index 096cf65..694e713 100644 --- a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/CHANGELOG.md @@ -4,5 +4,12 @@ CHANGELOG 2.1.0 ----- - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) + * added a DebugClassLoader able to wrap any autoloader providing a findFile + method + * added a new ApcClassLoader and XcacheClassLoader using composition to wrap + other loaders + * added a new ClassLoader which does not distinguish between namespaced and + pear-like classes (as the PEAR convention is a subset of PSR-0) and + supports using Composer's namespace maps + * added a class map generator + * added support for loading globally-installed PEAR packages diff --git a/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php similarity index 98% rename from core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php index 894900b..47588f7 100644 --- a/core/vendor/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -154,6 +154,7 @@ class ClassCollectionLoader $inNamespace = false; --$i; } else { + $output = rtrim($output); $output .= "\n{"; $inNamespace = true; } @@ -172,7 +173,7 @@ class ClassCollectionLoader /** * Writes a cache file. * - * @param string $file Filename + * @param string $file Filename * @param string $content Temporary file content * * @throws \RuntimeException when a cache file cannot be written @@ -181,7 +182,7 @@ class ClassCollectionLoader { $tmpFile = tempnam(dirname($file), basename($file)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { - chmod($file, 0666 & ~umask()); + @chmod($file, 0666 & ~umask()); return; } diff --git a/core/vendor/Symfony/Component/ClassLoader/ClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassLoader.php similarity index 89% rename from core/vendor/Symfony/Component/ClassLoader/ClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassLoader.php index b94bdb9..a2038a0 100644 --- a/core/vendor/Symfony/Component/ClassLoader/ClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassLoader.php @@ -19,13 +19,13 @@ namespace Symfony\Component\ClassLoader; * $loader = new ClassLoader(); * * // register classes with namespaces - * $loader->add('Symfony\Component', __DIR__.'/component'); - * $loader->add('Symfony', __DIR__.'/framework'); + * $loader->addPrefix('Symfony\Component', __DIR__.'/component'); + * $loader->addPrefix('Symfony', __DIR__.'/framework'); * * // activate the autoloader * $loader->register(); * - * // to enable searching the include path (eg. for PEAR packages) + * // to enable searching the include path (e.g. for PEAR packages) * $loader->setUseIncludePath(true); * * In this example, if you try to use a class in the Symfony\Component @@ -43,16 +43,31 @@ class ClassLoader private $fallbackDirs = array(); private $useIncludePath = false; + /** + * Returns prefixes. + * + * @return array + */ public function getPrefixes() { return $this->prefixes; } + /** + * Returns fallback directories. + * + * @return array + */ public function getFallbackDirs() { return $this->fallbackDirs; } + /** + * Adds prefixes. + * + * @param array $prefixes Prefixes to add + */ public function addPrefixes(array $prefixes) { foreach ($prefixes as $prefix => $path) { @@ -63,8 +78,8 @@ class ClassLoader /** * Registers a set of classes * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes + * @param string $prefix The classes prefix + * @param array|string $paths The location(s) of the classes */ public function addPrefix($prefix, $paths) { @@ -128,6 +143,7 @@ class ClassLoader * Loads the given class or interface. * * @param string $class The name of the class + * * @return Boolean|null True, if loaded */ public function loadClass($class) diff --git a/core/vendor/Symfony/Component/ClassLoader/ClassMapGenerator.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php similarity index 98% rename from core/vendor/Symfony/Component/ClassLoader/ClassMapGenerator.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php index c0e9fc6..91ea9af 100644 --- a/core/vendor/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -22,7 +22,7 @@ class ClassMapGenerator * Generate a class map file * * @param array|string $dirs Directories or a single path to search in - * @param string $file The name of the class map file + * @param string $file The name of the class map file */ static public function dump($dirs, $file) { diff --git a/core/vendor/Symfony/Component/ClassLoader/DebugClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php similarity index 99% rename from core/vendor/Symfony/Component/ClassLoader/DebugClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php index b6f7968..da7d289 100644 --- a/core/vendor/Symfony/Component/ClassLoader/DebugClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugClassLoader.php @@ -73,6 +73,7 @@ class DebugClassLoader * Loads the given class or interface. * * @param string $class The name of the class + * * @return Boolean|null True, if loaded */ public function loadClass($class) diff --git a/core/vendor/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php diff --git a/core/vendor/Symfony/Component/ClassLoader/LICENSE b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/LICENSE rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/LICENSE diff --git a/core/vendor/Symfony/Component/ClassLoader/MapClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/MapClassLoader.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/MapClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/MapClassLoader.php diff --git a/core/vendor/Symfony/Component/ClassLoader/README.md b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/README.md similarity index 93% rename from core/vendor/Symfony/Component/ClassLoader/README.md rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/README.md index 5a83c5f..64dffe9 100644 --- a/core/vendor/Symfony/Component/ClassLoader/README.md +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/README.md @@ -64,10 +64,9 @@ Resources You can run the unit tests with the following command: - phpunit -c src/Symfony/Component/ClassLoader/ + phpunit If you also want to run the unit tests that depend on other Symfony -Components, declare the following environment variables before running -PHPUnit: +Components, install dev dependencies before running PHPUnit: - export SYMFONY_FINDER=../path/to/Finder + php composer.phar install --dev diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ApcUniversalClassLoaderTest.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php similarity index 98% rename from core/vendor/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index cd1c439..5f4db1f 100644 --- a/core/vendor/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -43,7 +43,7 @@ namespace Foo { class Foo {} } -namespace Bar +namespace Bar { class Foo {} } diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassLoaderTest.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Baz.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Baz.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Baz.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Baz.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/FooBar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/FooBar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/FooBar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Namespaced/FooBar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Baz.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Baz.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Baz.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Baz.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/Pearlike/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/ApcPrefixCollision/A/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/alpha/Apc/NamespaceCollision/A/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/ApcPrefixCollision/A/B/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/beta/Apc/NamespaceCollision/A/B/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Apc/Pearlike/FooBar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Apc/Pearlike/FooBar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Apc/Pearlike/FooBar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Apc/Pearlike/FooBar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Namespaced/FooBar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Namespaced/FooBar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Namespaced/FooBar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Apc/fallback/Namespaced/FooBar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php similarity index 100% copy from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php copy to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Baz.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Baz.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Baz.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Baz.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced2/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Baz.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Baz.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Baz.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Baz.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Baz.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Baz.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Baz.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Baz.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/Pearlike2/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/A/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/NamespaceCollision/C/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Bar.php similarity index 100% copy from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Bar.php copy to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/C/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/A/B/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/NamespaceCollision/C/B/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Bar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Bar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/A/B/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Bar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Bar.php similarity index 100% copy from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Bar.php copy to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Bar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeClass.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeClass.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeClass.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeClass.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeInterface.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeInterface.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeInterface.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeInterface.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeParent.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeParent.php similarity index 100% copy from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeParent.php copy to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeParent.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/multipleNs.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/multipleNs.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/multipleNs.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/multipleNs.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notAClass.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notAClass.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notAClass.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notAClass.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notPhpFile.md b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notPhpFile.md similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notPhpFile.md rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/notPhpFile.md diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/sameNsMultipleClasses.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/sameNsMultipleClasses.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/sameNsMultipleClasses.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/sameNsMultipleClasses.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced/FooBar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced/FooBar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced/FooBar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced/FooBar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced2/FooBar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced2/FooBar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced2/FooBar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Namespaced2/FooBar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike/FooBar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike/FooBar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike/FooBar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike/FooBar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike2/FooBar.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike2/FooBar.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike2/FooBar.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/fallback/Pearlike2/FooBar.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/includepath/Foo.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/includepath/Foo.php similarity index 100% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/includepath/Foo.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/Fixtures/includepath/Foo.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php similarity index 100% copy from core/vendor/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php copy to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/bootstrap.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/bootstrap.php similarity index 58% rename from core/vendor/Symfony/Component/ClassLoader/Tests/bootstrap.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/bootstrap.php index 3364e14..54dac3f 100644 --- a/core/vendor/Symfony/Component/ClassLoader/Tests/bootstrap.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/Tests/bootstrap.php @@ -10,19 +10,13 @@ */ spl_autoload_register(function ($class) { - foreach (array( - 'SYMFONY_FINDER' => 'Finder', - ) as $env => $name) { - if (isset($_SERVER[$env]) && 0 === strpos(ltrim($class, '/'), 'Symfony\Component\\'.$name)) { - if (file_exists($file = $_SERVER[$env].'/'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\\'.$name)).'.php')) { - require_once $file; - } - } - } - if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\ClassLoader')) { if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\ClassLoader')).'.php')) { require_once $file; } } }); + +if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) { + require_once $loader; +} diff --git a/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php similarity index 97% rename from core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php index 60f245a..b6128ad 100644 --- a/core/vendor/Symfony/Component/ClassLoader/UniversalClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php @@ -42,7 +42,7 @@ namespace Symfony\Component\ClassLoader; * )); * * - * // to enable searching the include path (eg. for PEAR packages) + * // to enable searching the include path (e.g. for PEAR packages) * $loader->useIncludePath(true); * * // activate the autoloader @@ -216,8 +216,8 @@ class UniversalClassLoader /** * Registers a set of classes using the PEAR naming convention. * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes + * @param string $prefix The classes prefix + * @param array|string $paths The location(s) of the classes * * @api */ diff --git a/core/vendor/Symfony/Component/ClassLoader/XcacheClassLoader.php b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php similarity index 95% rename from core/vendor/Symfony/Component/ClassLoader/XcacheClassLoader.php rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php index 2eaaba2..2decbce 100644 --- a/core/vendor/Symfony/Component/ClassLoader/XcacheClassLoader.php +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/XcacheClassLoader.php @@ -48,8 +48,8 @@ class XcacheClassLoader /** * Constructor. * - * @param string $prefix A prefix to create a namespace in Xcache - * @param object $classFinder + * @param string $prefix A prefix to create a namespace in Xcache + * @param object $classFinder An object that implements findFile() method. * * @api */ @@ -89,12 +89,14 @@ class XcacheClassLoader * Loads the given class or interface. * * @param string $class The name of the class + * * @return Boolean|null True, if loaded */ public function loadClass($class) { if ($file = $this->findFile($class)) { require $file; + return true; } } diff --git a/core/vendor/Symfony/Component/ClassLoader/composer.json b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json similarity index 88% rename from core/vendor/Symfony/Component/ClassLoader/composer.json rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json index 2608f04..a4b32ec 100644 --- a/core/vendor/Symfony/Component/ClassLoader/composer.json +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/composer.json @@ -16,7 +16,10 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/finder": "2.1.*" }, "autoload": { "psr-0": { "Symfony\\Component\\ClassLoader": "" } diff --git a/core/vendor/Symfony/Component/ClassLoader/phpunit.xml.dist b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/phpunit.xml.dist similarity index 94% rename from core/vendor/Symfony/Component/ClassLoader/phpunit.xml.dist rename to core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/phpunit.xml.dist index bc7a21e..ae7e2ad 100644 --- a/core/vendor/Symfony/Component/ClassLoader/phpunit.xml.dist +++ b/core/vendor/symfony/class-loader/Symfony/Component/ClassLoader/phpunit.xml.dist @@ -23,6 +23,7 @@ ./Resources ./Tests + ./vendor diff --git a/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/.gitignore b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/core/vendor/Symfony/Component/DependencyInjection/Alias.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Alias.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Alias.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Alias.php index 9a377ed..fd75578 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Alias.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Alias.php @@ -22,7 +22,7 @@ class Alias /** * Constructor. * - * @param string $id Alias identifier + * @param string $id Alias identifier * @param Boolean $public If this alias is public * * @api diff --git a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md similarity index 10% copy from core/vendor/Symfony/Component/Yaml/CHANGELOG.md copy to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md index 096cf65..96839e9 100644 --- a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/CHANGELOG.md @@ -4,5 +4,9 @@ CHANGELOG 2.1.0 ----- - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) + * added IntrospectableContainerInterface (to be able to check if a service + has been initialized or not) + * added ConfigurationExtensionInterface + * added Definition::clearTag() + * component exceptions that inherit base SPL classes are now used exclusively + (this includes dumped containers) diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php index b565f3f..19079b4 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/AnalyzeServiceReferencesPass.php @@ -74,6 +74,9 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface if (!$this->onlyConstructorArguments) { $this->processArguments($definition->getMethodCalls()); $this->processArguments($definition->getProperties()); + if ($definition->getConfigurator()) { + $this->processArguments(array($definition->getConfigurator())); + } } } diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckCircularReferencesPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckDefinitionValidityPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CheckReferenceValidityPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/Compiler.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/Compiler.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/Compiler.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/InlineServiceDefinitionsPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/MergeExtensionConfigurationPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php similarity index 99% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/PassConfig.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php index eb2266b..e863f75 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Compiler/PassConfig.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/PassConfig.php @@ -96,7 +96,7 @@ class PassConfig * Adds a pass. * * @param CompilerPassInterface $pass A Compiler pass - * @param string $type The pass type + * @param string $type The pass type * * @throws InvalidArgumentException when a pass type doesn't exist * diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveAbstractDefinitionsPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemovePrivateAliasesPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RemoveUnusedDefinitionsPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/RepeatedPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php similarity index 92% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php index dc83807..5d00ed6 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ReplaceAliasByActualDefinitionPass.php @@ -63,8 +63,8 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface * Updates references to remove aliases. * * @param ContainerBuilder $container The container - * @param string $currentId The alias identifier being replaced - * @param string $newId The id of the service the alias points to + * @param string $currentId The alias identifier being replaced + * @param string $newId The id of the service the alias points to */ private function updateReferences($container, $currentId, $newId) { @@ -94,9 +94,9 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface /** * Updates argument references. * - * @param array $arguments An array of Arguments + * @param array $arguments An array of Arguments * @param string $currentId The alias identifier - * @param string $newId The identifier the alias points to + * @param string $newId The identifier the alias points to */ private function updateArgumentReferences(array $arguments, $currentId, $newId) { diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveDefinitionTemplatesPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php similarity index 98% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php index 6d3c78a..996199c 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveInvalidReferencesPass.php @@ -69,7 +69,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface /** * Processes arguments to determine invalid references. * - * @param array $arguments An array of Reference objects + * @param array $arguments An array of Reference objects * @param Boolean $inMethodCall */ private function processArguments(array $arguments, $inMethodCall = false) diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveParameterPlaceHoldersPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ResolveReferencesToAliasesPass.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraph.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php index 60a9295..19da234 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphEdge.php @@ -29,7 +29,7 @@ class ServiceReferenceGraphEdge * * @param ServiceReferenceGraphNode $sourceNode * @param ServiceReferenceGraphNode $destNode - * @param string $value + * @param string $value */ public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null) { diff --git a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php index da8dc70..3fd5077 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php @@ -31,8 +31,8 @@ class ServiceReferenceGraphNode /** * Constructor. * - * @param string $id The node identifier - * @param mixed $value The node value + * @param string $id The node identifier + * @param mixed $value The node value */ public function __construct($id, $value) { diff --git a/core/vendor/Symfony/Component/DependencyInjection/Container.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Container.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php index cf29685..8500644 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Container.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Container.php @@ -133,7 +133,7 @@ class Container implements IntrospectableContainerInterface /** * Gets a parameter. * - * @param string $name The parameter name + * @param string $name The parameter name * * @return mixed The parameter value * @@ -149,7 +149,7 @@ class Container implements IntrospectableContainerInterface /** * Checks if a parameter exists. * - * @param string $name The parameter name + * @param string $name The parameter name * * @return Boolean The presence of parameter in container * @@ -204,7 +204,7 @@ class Container implements IntrospectableContainerInterface /** * Returns true if the given service is defined. * - * @param string $id The service identifier + * @param string $id The service identifier * * @return Boolean true if the service is defined, false otherwise * @@ -223,8 +223,8 @@ class Container implements IntrospectableContainerInterface * If a service is both defined through a set() method and * with a set*Service() method, the former has always precedence. * - * @param string $id The service identifier - * @param integer $invalidBehavior The behavior when the service does not exist + * @param string $id The service identifier + * @param integer $invalidBehavior The behavior when the service does not exist * * @return object The associated service * @@ -265,11 +265,11 @@ class Container implements IntrospectableContainerInterface throw new ServiceNotFoundException($id); } } - + /** * Returns true if the given service has actually been initialized * - * @param string $id The service identifier + * @param string $id The service identifier * * @return Boolean true if service has already been initialized, false otherwise */ @@ -288,7 +288,7 @@ class Container implements IntrospectableContainerInterface $ids = array(); $r = new \ReflectionClass($this); foreach ($r->getMethods() as $method) { - if (preg_match('/^get(.+)Service$/', $method->getName(), $match)) { + if (preg_match('/^get(.+)Service$/', $method->name, $match)) { $ids[] = self::underscore($match[1]); } } diff --git a/core/vendor/Symfony/Component/DependencyInjection/ContainerAware.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAware.php similarity index 92% copy from core/vendor/Symfony/Component/DependencyInjection/ContainerAware.php copy to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAware.php index 1ae1db4..4096915 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/ContainerAware.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAware.php @@ -18,7 +18,7 @@ namespace Symfony\Component\DependencyInjection; * * @api */ -class ContainerAware implements ContainerAwareInterface +abstract class ContainerAware implements ContainerAwareInterface { /** * @var ContainerInterface diff --git a/core/vendor/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/ContainerAwareInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerAwareInterface.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/ContainerBuilder.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/ContainerBuilder.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php index 1d77ebc..a706229 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -291,7 +291,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Returns true if the given service is defined. * - * @param string $id The service identifier + * @param string $id The service identifier * * @return Boolean true if the service is defined, false otherwise * @@ -307,8 +307,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Gets a service. * - * @param string $id The service identifier - * @param integer $invalidBehavior The behavior when the service does not exist + * @param string $id The service identifier + * @param integer $invalidBehavior The behavior when the service does not exist * * @return object The associated service * @@ -532,7 +532,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Returns true if an alias exists under the given identifier. * - * @param string $id The service identifier + * @param string $id The service identifier * * @return Boolean true if the alias exists, false otherwise * @@ -558,7 +558,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Gets an alias. * - * @param string $id The service identifier + * @param string $id The service identifier * * @return string The aliased service identifier * @@ -583,8 +583,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * This methods allows for simple registration of service definition * with a fluid interface. * - * @param string $id The service identifier - * @param string $class The service class + * @param string $id The service identifier + * @param string $class The service class * * @return Definition A Definition instance * @@ -637,8 +637,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Sets a service definition. * - * @param string $id The service identifier - * @param Definition $definition A Definition instance + * @param string $id The service identifier + * @param Definition $definition A Definition instance * * @throws BadMethodCallException When this ContainerBuilder is frozen * @@ -660,7 +660,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Returns true if a service definition exists under the given identifier. * - * @param string $id The service identifier + * @param string $id The service identifier * * @return Boolean true if the service definition exists, false otherwise * @@ -674,7 +674,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Gets a service definition. * - * @param string $id The service identifier + * @param string $id The service identifier * * @return Definition A Definition instance * @@ -698,7 +698,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * * The method "unaliases" recursively to return a Definition instance. * - * @param string $id The service identifier or alias + * @param string $id The service identifier or alias * * @return Definition A Definition instance * @@ -718,8 +718,8 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Creates a service for a service definition. * - * @param Definition $definition A service definition instance - * @param string $id The service identifier + * @param Definition $definition A service definition instance + * @param string $id The service identifier * * @return object The service described by the service definition * @@ -803,7 +803,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface /** * Replaces service references by the real service instance. * - * @param mixed $value A value + * @param mixed $value A value * * @return mixed The same value with all service references replaced by the real service instances */ diff --git a/core/vendor/Symfony/Component/DependencyInjection/ContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php similarity index 91% rename from core/vendor/Symfony/Component/DependencyInjection/ContainerInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php index 93cbf3a..6a5988e 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -43,8 +43,8 @@ interface ContainerInterface /** * Gets a service. * - * @param string $id The service identifier - * @param int $invalidBehavior The behavior when the service does not exist + * @param string $id The service identifier + * @param int $invalidBehavior The behavior when the service does not exist * * @return object The associated service * @@ -59,7 +59,7 @@ interface ContainerInterface /** * Returns true if the given service is defined. * - * @param string $id The service identifier + * @param string $id The service identifier * * @return Boolean true if the service is defined, false otherwise * @@ -70,7 +70,7 @@ interface ContainerInterface /** * Gets a parameter. * - * @param string $name The parameter name + * @param string $name The parameter name * * @return mixed The parameter value * @@ -83,7 +83,7 @@ interface ContainerInterface /** * Checks if a parameter exists. * - * @param string $name The parameter name + * @param string $name The parameter name * * @return Boolean The presence of parameter in container * diff --git a/core/vendor/Symfony/Component/DependencyInjection/Definition.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php similarity index 93% rename from core/vendor/Symfony/Component/DependencyInjection/Definition.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php index 1c974a6..e7265f2 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Definition.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Definition.php @@ -64,7 +64,7 @@ class Definition * Sets the name of the class that acts as a factory using the factory method, * which will be invoked statically. * - * @param string $factoryClass The factory class name + * @param string $factoryClass The factory class name * * @return Definition The current instance * @@ -92,7 +92,7 @@ class Definition /** * Sets the factory method able to create an instance of this class. * - * @param string $factoryMethod The factory method name + * @param string $factoryMethod The factory method name * * @return Definition The current instance * @@ -148,7 +148,7 @@ class Definition /** * Sets the service class. * - * @param string $class The service class + * @param string $class The service class * * @return Definition The current instance * @@ -176,7 +176,7 @@ class Definition /** * Sets the arguments to pass to the service constructor/factory method. * - * @param array $arguments An array of arguments + * @param array $arguments An array of arguments * * @return Definition The current instance * @@ -220,7 +220,7 @@ class Definition /** * Adds an argument to pass to the service constructor/factory method. * - * @param mixed $argument An argument + * @param mixed $argument An argument * * @return Definition The current instance * @@ -237,7 +237,7 @@ class Definition * Sets a specific argument * * @param integer $index - * @param mixed $argument + * @param mixed $argument * * @return Definition The current instance * @@ -287,7 +287,7 @@ class Definition /** * Sets the methods to call after service initialization. * - * @param array $calls An array of method calls + * @param array $calls An array of method calls * * @return Definition The current instance * @@ -306,8 +306,8 @@ class Definition /** * Adds a method to call after service initialization. * - * @param string $method The method name to call - * @param array $arguments An array of arguments to pass to the method call + * @param string $method The method name to call + * @param array $arguments An array of arguments to pass to the method call * * @return Definition The current instance * @@ -328,7 +328,7 @@ class Definition /** * Removes a method to call after service initialization. * - * @param string $method The method name to remove + * @param string $method The method name to remove * * @return Definition The current instance * @@ -349,7 +349,7 @@ class Definition /** * Check if the current definition has a given method to call after service initialization. * - * @param string $method The method name to search for + * @param string $method The method name to search for * * @return Boolean * @@ -409,7 +409,7 @@ class Definition /** * Gets a tag by name. * - * @param string $name The tag name + * @param string $name The tag name * * @return array An array of attributes * @@ -423,8 +423,8 @@ class Definition /** * Adds a tag for this definition. * - * @param string $name The tag name - * @param array $attributes An array of attributes + * @param string $name The tag name + * @param array $attributes An array of attributes * * @return Definition The current instance * @@ -484,7 +484,7 @@ class Definition /** * Sets a file to require before creating the service. * - * @param string $file A full pathname to include + * @param string $file A full pathname to include * * @return Definition The current instance * @@ -512,7 +512,7 @@ class Definition /** * Sets the scope of the service * - * @param string $scope Whether the service must be shared or not + * @param string $scope Whether the service must be shared or not * * @return Definition The current instance * @@ -628,7 +628,7 @@ class Definition /** * Sets a configurator to call after the service is fully initialized. * - * @param mixed $callable A PHP callable + * @param mixed $callable A PHP callable * * @return Definition The current instance * diff --git a/core/vendor/Symfony/Component/DependencyInjection/DefinitionDecorator.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php similarity index 99% rename from core/vendor/Symfony/Component/DependencyInjection/DefinitionDecorator.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php index 8652d80..0306f75 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/DefinitionDecorator.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/DefinitionDecorator.php @@ -185,7 +185,7 @@ class DefinitionDecorator extends Definition * parent definition, otherwise your arguments will only be appended. * * @param integer $index - * @param mixed $value + * @param mixed $value * * @return DefinitionDecorator the current instance * @throws InvalidArgumentException when $index isn't an integer diff --git a/core/vendor/Symfony/Component/DependencyInjection/Dumper/Dumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/Dumper.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Dumper/Dumper.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/Dumper.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php similarity index 92% rename from core/vendor/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php index c05dc6d..6972cbf 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php @@ -23,7 +23,7 @@ interface DumperInterface /** * Dumps the service container. * - * @param array $options An array of options + * @param array $options An array of options * * @return string The representation of the service container * diff --git a/core/vendor/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php similarity index 97% rename from core/vendor/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php index 133c621..debdc52 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php @@ -50,7 +50,7 @@ class GraphvizDumper extends Dumper * * node.definition: The default options for services that are defined via service definition instances * * node.missing: The default options for missing services * - * @param array $options An array of options + * @param array $options An array of options * * @return string The dot representation of the service container */ @@ -119,10 +119,10 @@ class GraphvizDumper extends Dumper /** * Finds all edges belonging to a specific service id. * - * @param string $id The service id used to find edges - * @param array $arguments An array of arguments + * @param string $id The service id used to find edges + * @param array $arguments An array of arguments * @param Boolean $required - * @param string $name + * @param string $name * * @return array An array of edges */ diff --git a/core/vendor/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php similarity index 98% rename from core/vendor/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php index a567dfe..4d34e55 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php @@ -70,7 +70,7 @@ class PhpDumper extends Dumper * * class: The class name * * base_class: The base class name * - * @param array $options An array of options + * @param array $options An array of options * * @return string A PHP class representing of the service container * @@ -152,7 +152,7 @@ class PhpDumper extends Dumper /** * Generates the require_once statement for service includes. * - * @param string $id The service id + * @param string $id The service id * @param Definition $definition * * @return string @@ -182,7 +182,7 @@ class PhpDumper extends Dumper /** * Generates the inline definition of a service. * - * @param string $id + * @param string $id * @param Definition $definition * * @return string @@ -261,7 +261,7 @@ class PhpDumper extends Dumper /** * Adds the service return statement. * - * @param string $id Service id + * @param string $id Service id * @param Definition $definition * * @return string @@ -278,7 +278,7 @@ class PhpDumper extends Dumper /** * Generates the service instance. * - * @param string $id + * @param string $id * @param Definition $definition * * @return string @@ -326,7 +326,7 @@ class PhpDumper extends Dumper throw new RuntimeException('Factory method requires a factory service or factory class in service definition for '.$id); } } elseif (false !== strpos($class, '$')) { - $code = sprintf(" \$class = %s;\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments)); + $code = sprintf(" \$class = %s;\n\n $return{$instantiation}new \$class(%s);\n", $class, implode(', ', $arguments)); } else { $code = sprintf(" $return{$instantiation}new \\%s(%s);\n", substr(str_replace('\\\\', '\\', $class), 1, -1), implode(', ', $arguments)); } @@ -341,7 +341,7 @@ class PhpDumper extends Dumper /** * Checks if the definition is a simple instance. * - * @param string $id + * @param string $id * @param Definition $definition * * @return Boolean @@ -364,9 +364,9 @@ class PhpDumper extends Dumper /** * Adds method calls to a service definition. * - * @param string $id + * @param string $id * @param Definition $definition - * @param string $variableName + * @param string $variableName * * @return string */ @@ -398,7 +398,7 @@ class PhpDumper extends Dumper /** * Generates the inline definition setup. * - * @param string $id + * @param string $id * @param Definition $definition * @return string */ @@ -436,9 +436,9 @@ class PhpDumper extends Dumper /** * Adds configurator definition * - * @param string $id + * @param string $id * @param Definition $definition - * @param string $variableName + * @param string $variableName * * @return string */ @@ -462,7 +462,7 @@ class PhpDumper extends Dumper /** * Adds a service * - * @param string $id + * @param string $id * @param Definition $definition * * @return string @@ -613,7 +613,7 @@ EOF; /** * Adds the class headers. * - * @param string $class Class name + * @param string $class Class name * @param string $baseClass The name of the base class * * @return string @@ -802,8 +802,8 @@ EOF; /** * Exports parameters. * - * @param array $parameters - * @param string $path + * @param array $parameters + * @param string $path * @param integer $indent * * @return string @@ -871,7 +871,7 @@ EOF; /** * Builds service calls from arguments * - * @param array $arguments + * @param array $arguments * @param string &$calls By reference * @param string &$behavior By reference */ @@ -950,7 +950,7 @@ EOF; * Checks if a service id has a reference * * @param string $id - * @param array $arguments + * @param array $arguments * * @return Boolean */ @@ -974,7 +974,7 @@ EOF; /** * Dumps values. * - * @param array $value + * @param array $value * @param Boolean $interpolate * * @return string @@ -1037,8 +1037,7 @@ EOF; return $this->dumpParameter(strtolower($match[1])); } else { $that = $this; - $replaceParameters = function ($match) use ($that) - { + $replaceParameters = function ($match) use ($that) { return "'.".$that->dumpParameter(strtolower($match[2])).".'"; }; diff --git a/core/vendor/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php similarity index 98% rename from core/vendor/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 6a91b99..113a242 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -35,7 +35,7 @@ class XmlDumper extends Dumper /** * Dumps the service container as an XML string. * - * @param array $options An array of options + * @param array $options An array of options * * @return string An xml string representing of the service container * @@ -84,7 +84,7 @@ class XmlDumper extends Dumper /** * Adds method calls. * - * @param array $methodcalls + * @param array $methodcalls * @param DOMElement $parent */ private function addMethodCalls(array $methodcalls, \DOMElement $parent) @@ -103,7 +103,7 @@ class XmlDumper extends Dumper * Adds a service. * * @param Definition $definition - * @param string $id + * @param string $id * @param DOMElement $parent */ private function addService($definition, $id, \DOMElement $parent) @@ -172,8 +172,8 @@ class XmlDumper extends Dumper /** * Adds a service alias. * - * @param string $alias - * @param string $id + * @param string $alias + * @param string $id * @param DOMElement $parent */ private function addServiceAlias($alias, $id, \DOMElement $parent) diff --git a/core/vendor/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php similarity index 85% rename from core/vendor/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php index 5768c1e..9717a25 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php @@ -11,11 +11,12 @@ namespace Symfony\Component\DependencyInjection\Dumper; -use Symfony\Component\Yaml\Yaml; +use Symfony\Component\Yaml\Dumper as YmlDumper; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * YamlDumper dumps a service container as a YAML string. @@ -26,10 +27,26 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; */ class YamlDumper extends Dumper { + private $dumper; + + /** + * Constructor. + * + * @param ContainerBuilder $container The service container to dump + * + * @api + */ + public function __construct(ContainerBuilder $container) + { + parent::__construct($container); + + $this->dumper = new YmlDumper(); + } + /** * Dumps the service container as an YAML string. * - * @param array $options An array of options + * @param array $options An array of options * * @return string A YAML string representing of the service container * @@ -43,7 +60,7 @@ class YamlDumper extends Dumper /** * Adds a service * - * @param string $id + * @param string $id * @param Definition $definition * * @return string @@ -60,11 +77,11 @@ class YamlDumper extends Dumper foreach ($tags as $attributes) { $att = array(); foreach ($attributes as $key => $value) { - $att[] = sprintf('%s: %s', Yaml::dump($key), Yaml::dump($value)); + $att[] = sprintf('%s: %s', $this->dumper->dump($key), $this->dumper->dump($value)); } $att = $att ? ', '.implode(' ', $att) : ''; - $tagsCode .= sprintf(" - { name: %s%s }\n", Yaml::dump($name), $att); + $tagsCode .= sprintf(" - { name: %s%s }\n", $this->dumper->dump($name), $att); } } if ($tagsCode) { @@ -84,15 +101,15 @@ class YamlDumper extends Dumper } if ($definition->getArguments()) { - $code .= sprintf(" arguments: %s\n", Yaml::dump($this->dumpValue($definition->getArguments()), 0)); + $code .= sprintf(" arguments: %s\n", $this->dumper->dump($this->dumpValue($definition->getArguments()), 0)); } if ($definition->getProperties()) { - $code .= sprintf(" properties: %s\n", Yaml::dump($this->dumpValue($definition->getProperties()), 0)); + $code .= sprintf(" properties: %s\n", $this->dumper->dump($this->dumpValue($definition->getProperties()), 0)); } if ($definition->getMethodCalls()) { - $code .= sprintf(" calls:\n %s\n", str_replace("\n", "\n ", Yaml::dump($this->dumpValue($definition->getMethodCalls()), 1))); + $code .= sprintf(" calls:\n%s\n", $this->dumper->dump($this->dumpValue($definition->getMethodCalls()), 1, 12)); } if (ContainerInterface::SCOPE_CONTAINER !== $scope = $definition->getScope()) { @@ -108,7 +125,7 @@ class YamlDumper extends Dumper } } - $code .= sprintf(" configurator: %s\n", Yaml::dump($callable, 0)); + $code .= sprintf(" configurator: %s\n", $this->dumper->dump($callable, 0)); } return $code; @@ -171,7 +188,7 @@ class YamlDumper extends Dumper $parameters = $this->container->getParameterBag()->all(); } - return Yaml::dump(array('parameters' => $parameters), 2); + return $this->dumper->dump(array('parameters' => $parameters), 2); } /** diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/BadMethodCallException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ExceptionInterface.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InactiveScopeException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/InvalidArgumentException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/LogicException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/LogicException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/LogicException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/LogicException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/OutOfBoundsException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterCircularReferenceException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ParameterNotFoundException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/RuntimeException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/RuntimeException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/RuntimeException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/RuntimeException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeCrossingInjectionException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ScopeWideningInjectionException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceCircularReferenceException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Exception/ServiceNotFoundException.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php similarity index 90% rename from core/vendor/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php index b633f90..4f33a9b 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php @@ -23,7 +23,7 @@ interface ConfigurationExtensionInterface /** * Returns extension configuration * - * @param array $config $config An array of configuration values + * @param array $config $config An array of configuration values * @param ContainerBuilder $container A ContainerBuilder instance * * @return ConfigurationInterface|null The configuration or null diff --git a/core/vendor/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php similarity index 98% rename from core/vendor/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php index 726652c..0ffc729 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php @@ -24,10 +24,10 @@ interface IntrospectableContainerInterface extends ContainerInterface * Check for whether or not a service has been initialized. * * @param string $id - * + * * @return Boolean true if the service has been initialized, false otherwise * */ function initialized($id); - -} \ No newline at end of file + +} diff --git a/core/vendor/Symfony/Component/DependencyInjection/LICENSE b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/LICENSE rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/LICENSE diff --git a/core/vendor/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php similarity index 94% rename from core/vendor/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php index fa24565..775a352 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/ClosureLoader.php @@ -49,8 +49,8 @@ class ClosureLoader extends Loader /** * Returns true if this class supports the given resource. * - * @param mixed $resource A resource - * @param string $type The resource type + * @param mixed $resource A resource + * @param string $type The resource type * * @return Boolean true if this class supports the given resource, false otherwise */ diff --git a/core/vendor/Symfony/Component/DependencyInjection/Loader/FileLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/FileLoader.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Loader/FileLoader.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/FileLoader.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php similarity index 94% rename from core/vendor/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php index 4eabd6d..e4b99f6 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/IniFileLoader.php @@ -24,8 +24,8 @@ class IniFileLoader extends FileLoader /** * Loads a resource. * - * @param mixed $file The resource - * @param string $type The resource type + * @param mixed $file The resource + * @param string $type The resource type * * @throws InvalidArgumentException When ini file is not valid */ diff --git a/core/vendor/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/PhpFileLoader.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php similarity index 92% rename from core/vendor/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 98fb2da..3a27d37 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -44,7 +44,7 @@ class XmlFileLoader extends FileLoader $this->container->addResource(new FileResource($path)); // anonymous services - $xml = $this->processAnonymousServices($xml, $path); + $this->processAnonymousServices($xml, $path); // imports $this->parseImports($xml, $path); @@ -76,7 +76,7 @@ class XmlFileLoader extends FileLoader * Parses parameters * * @param SimpleXMLElement $xml - * @param string $file + * @param string $file */ private function parseParameters(SimpleXMLElement $xml, $file) { @@ -91,7 +91,7 @@ class XmlFileLoader extends FileLoader * Parses imports * * @param SimpleXMLElement $xml - * @param string $file + * @param string $file */ private function parseImports(SimpleXMLElement $xml, $file) { @@ -109,7 +109,7 @@ class XmlFileLoader extends FileLoader * Parses multiple definitions * * @param SimpleXMLElement $xml - * @param string $file + * @param string $file */ private function parseDefinitions(SimpleXMLElement $xml, $file) { @@ -125,9 +125,9 @@ class XmlFileLoader extends FileLoader /** * Parses an individual Definition * - * @param string $id + * @param string $id * @param SimpleXMLElement $service - * @param string $file + * @param string $file */ private function parseDefinition($id, $service, $file) { @@ -221,37 +221,33 @@ class XmlFileLoader extends FileLoader * Processes anonymous services * * @param SimpleXMLElement $xml - * @param string $file - * - * @return array An array of anonymous services + * @param string $file */ private function processAnonymousServices(SimpleXMLElement $xml, $file) { $definitions = array(); $count = 0; - // anonymous services as arguments - if (false === $nodes = $xml->xpath('//container:argument[@type="service"][not(@id)]')) { - return $xml; - } - foreach ($nodes as $node) { - // give it a unique name - $node['id'] = sprintf('%s_%d', md5($file), ++$count); + // anonymous services as arguments/properties + if (false !== $nodes = $xml->xpath('//container:argument[@type="service"][not(@id)]|//container:property[@type="service"][not(@id)]')) { + foreach ($nodes as $node) { + // give it a unique name + $node['id'] = sprintf('%s_%d', md5($file), ++$count); - $definitions[(string) $node['id']] = array($node->service, $file, false); - $node->service['id'] = (string) $node['id']; + $definitions[(string) $node['id']] = array($node->service, $file, false); + $node->service['id'] = (string) $node['id']; + } } // anonymous services "in the wild" - if (false === $nodes = $xml->xpath('//container:services/container:service[not(@id)]')) { - return $xml; - } - foreach ($nodes as $node) { - // give it a unique name - $node['id'] = sprintf('%s_%d', md5($file), ++$count); + if (false !== $nodes = $xml->xpath('//container:services/container:service[not(@id)]')) { + foreach ($nodes as $node) { + // give it a unique name + $node['id'] = sprintf('%s_%d', md5($file), ++$count); - $definitions[(string) $node['id']] = array($node, $file, true); - $node->service['id'] = (string) $node['id']; + $definitions[(string) $node['id']] = array($node, $file, true); + $node->service['id'] = (string) $node['id']; + } } // resolve definitions @@ -271,15 +267,13 @@ class XmlFileLoader extends FileLoader $oNode->parentNode->removeChild($oNode); } } - - return $xml; } /** * Validates an XML document. * * @param DOMDocument $dom - * @param string $file + * @param string $file */ private function validate(\DOMDocument $dom, $file) { @@ -291,7 +285,7 @@ class XmlFileLoader extends FileLoader * Validates a documents XML schema. * * @param \DOMDocument $dom - * @param string $file + * @param string $file * * @throws RuntimeException When extension references a non-existent XSD file * @throws InvalidArgumentException When XML doesn't validate its XSD schema @@ -365,7 +359,7 @@ EOF * Validates an extension. * * @param \DOMDocument $dom - * @param string $file + * @param string $file * * @throws InvalidArgumentException When no extension is found corresponding to a tag */ diff --git a/core/vendor/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php similarity index 98% rename from core/vendor/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php index e163219..63f3893 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php @@ -81,7 +81,7 @@ class YamlFileLoader extends FileLoader /** * Parses all imports * - * @param array $content + * @param array $content * @param string $file */ private function parseImports($content, $file) @@ -99,7 +99,7 @@ class YamlFileLoader extends FileLoader /** * Parses definitions * - * @param array $content + * @param array $content * @param string $file */ private function parseDefinitions($content, $file) @@ -117,7 +117,7 @@ class YamlFileLoader extends FileLoader * Parses a definition. * * @param string $id - * @param array $service + * @param array $service * @param string $file */ private function parseDefinition($id, $service, $file) @@ -239,7 +239,7 @@ class YamlFileLoader extends FileLoader /** * Validates a YAML file. * - * @param mixed $content + * @param mixed $content * @param string $file * * @return array diff --git a/core/vendor/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd similarity index 98% rename from core/vendor/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd index 7d46e8c..316f2d7 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Loader/schema/dic/services/services-1.0.xsd @@ -118,6 +118,9 @@ + + + diff --git a/core/vendor/Symfony/Component/DependencyInjection/Parameter.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Parameter.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Parameter.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Parameter.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php index dade577..a83f1fc 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php @@ -115,7 +115,7 @@ class ParameterBag implements ParameterBagInterface /** * Returns true if a parameter name is defined. * - * @param string $name The parameter name + * @param string $name The parameter name * * @return Boolean true if the parameter name is defined, false otherwise * @@ -127,6 +127,18 @@ class ParameterBag implements ParameterBagInterface } /** + * Removes a parameter. + * + * @param string $key The key + * + * @api + */ + public function remove($key) + { + unset($this->parameters[$key]); + } + + /** * Replaces parameter placeholders (%name%) by their values for all parameters. */ public function resolve() @@ -154,7 +166,7 @@ class ParameterBag implements ParameterBagInterface /** * Replaces parameter placeholders (%name%) by their values. * - * @param mixed $value A value + * @param mixed $value A value * @param array $resolving An array of keys that are being resolved (used internally to detect circular references) * * @return mixed The resolved value diff --git a/core/vendor/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php similarity index 95% rename from core/vendor/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php index b530d5d..da83cbe 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php @@ -73,7 +73,7 @@ interface ParameterBagInterface /** * Returns true if a parameter name is defined. * - * @param string $name The parameter name + * @param string $name The parameter name * * @return Boolean true if the parameter name is defined, false otherwise * @@ -89,7 +89,7 @@ interface ParameterBagInterface /** * Replaces parameter placeholders (%name%) by their values. * - * @param mixed $value A value + * @param mixed $value A value * * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist */ diff --git a/core/vendor/Symfony/Component/DependencyInjection/README.md b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/README.md similarity index 84% rename from core/vendor/Symfony/Component/DependencyInjection/README.md rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/README.md index 06ebe3d..5cb62cf 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/README.md +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/README.md @@ -48,8 +48,8 @@ If your service is retrieved by calling a static method: File Include: -For some services, especially those that are difficult or impossible to -autoload, you may need the container to include a file before +For some services, especially those that are difficult or impossible to +autoload, you may need the container to include a file before instantiating your class. $sc = new ContainerBuilder(); @@ -68,11 +68,9 @@ Resources You can run the unit tests with the following command: - phpunit -c src/Symfony/Component/DependencyInjection/ + phpunit If you also want to run the unit tests that depend on other Symfony -Components, declare the following environment variables before running -PHPUnit: +Components, install dev dependencies before running PHPUnit: - export SYMFONY_CONFIG=../path/to/Config - export SYMFONY_YAML=../path/to/Yaml + php composer.phar install --dev diff --git a/core/vendor/Symfony/Component/DependencyInjection/Reference.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Reference.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Reference.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Reference.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Scope.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Scope.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Scope.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Scope.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/ScopeInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/ScopeInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/ScopeInterface.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/SimpleXMLElement.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/SimpleXMLElement.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/SimpleXMLElement.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/TaggedContainerInterface.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/TaggedContainerInterface.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/TaggedContainerInterface.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php similarity index 91% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php index 5257781..c99659e 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php @@ -45,12 +45,19 @@ class AnalyzeServiceReferencesPassTest extends \PHPUnit_Framework_TestCase ->setProperty('foo', $ref5 = new Reference('b')) ; + $e = $container + ->register('e') + ->setConfigurator(array($ref6 = new Reference('b'), 'methodName')) + ; + $graph = $this->process($container); - $this->assertCount(3, $edges = $graph->getNode('b')->getInEdges()); + $this->assertCount(4, $edges = $graph->getNode('b')->getInEdges()); + $this->assertSame($ref1, $edges[0]->getValue()); $this->assertSame($ref4, $edges[1]->getValue()); $this->assertSame($ref5, $edges[2]->getValue()); + $this->assertSame($ref6, $edges[3]->getValue()); } public function testProcessDetectsReferencesFromInlinedDefinitions() diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckCircularReferencesPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckDefinitionValidityPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/CheckReferenceValidityPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/InlineServiceDefinitionsPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/IntegrationTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ReplaceAliasByActualDefinitionPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveDefinitionTemplatesPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveInvalidReferencesPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php similarity index 100% copy from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php copy to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/ContainerTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ContainerTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionDecoratorTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/DefinitionTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container10.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container11.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container12.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container8.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces1.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/interfaces2.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot similarity index 100% copy from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot copy to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10-1.dot diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services10.dot diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services9.dot diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php similarity index 100% copy from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php copy to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtension.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectWithXsdExtensionInPhar.phar diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/createphar.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/schema/project-1.0.xsd diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/nonvalid.ini diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters.ini diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters1.ini diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/ini/parameters2.ini diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services1.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services10.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services8.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php similarity index 99% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php index 5ab7bab..c1513b6 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php @@ -104,6 +104,7 @@ class ProjectServiceContainer extends Container protected function getFooBarService() { $class = $this->getParameter('foo_class'); + return $this->services['foo_bar'] = new $class(); } diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/php/simple.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension1/services.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extension2/services.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services1.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services2.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services3.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services4.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services5.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services6.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/extensions/services7.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/nonvalid.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services1.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services13.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services2.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services3.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services4_bad_import.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml similarity index 85% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml index 787b4ef..acb93e7 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml @@ -13,6 +13,9 @@ + + + diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services7.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services8.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag1.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag2.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/badtag3.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid1.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/nonvalid2.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services1.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services10.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services11.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services13.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services2.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services3.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services4_bad_import.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services7.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services8.yml diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml similarity index 97% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml index 2aa47a5..0fd2ae3 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml @@ -15,7 +15,7 @@ services: calls: - [setBar, ['@bar']] - [initialize, { }] - + scope: prototype configurator: sc_configure bar: @@ -36,7 +36,7 @@ services: - [setBar, ['@?foo2']] - [setBar, ['@?foo3']] - [setBar, ['@?foobaz']] - + factory_service: factory_method: getInstance factory_service: foo.baz diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php index 85f02a2..33594d6 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/ClosureLoaderTest.php @@ -41,8 +41,7 @@ class ClosureLoaderTest extends \PHPUnit_Framework_TestCase { $loader = new ClosureLoader($container = new ContainerBuilder()); - $loader->load(function ($container) - { + $loader->load(function ($container) { $container->setParameter('foo', 'foo'); }); diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/PhpFileLoaderTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 12fa718..1a157e6 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -122,7 +122,9 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); $loader->load('services5.xml'); $services = $container->getDefinitions(); - $this->assertEquals(3, count($services), '->load() attributes unique ids to anonymous services'); + $this->assertEquals(4, count($services), '->load() attributes unique ids to anonymous services'); + + // anonymous service as an argument $args = $services['foo']->getArguments(); $this->assertEquals(1, count($args), '->load() references anonymous services as "normal" ones'); $this->assertEquals('Symfony\\Component\\DependencyInjection\\Reference', get_class($args[0]), '->load() converts anonymous services to references to "normal" services'); @@ -130,12 +132,21 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase $inner = $services[(string) $args[0]]; $this->assertEquals('BarClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); + // inner anonymous services $args = $inner->getArguments(); $this->assertEquals(1, count($args), '->load() references anonymous services as "normal" ones'); $this->assertEquals('Symfony\\Component\\DependencyInjection\\Reference', get_class($args[0]), '->load() converts anonymous services to references to "normal" services'); $this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones'); $inner = $services[(string) $args[0]]; $this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); + + // anonymous service as a property + $properties = $services['foo']->getProperties(); + $property = $properties['p']; + $this->assertEquals('Symfony\\Component\\DependencyInjection\\Reference', get_class($property), '->load() converts anonymous services to references to "normal" services'); + $this->assertTrue(isset($services[(string) $property]), '->load() makes a reference to the created ones'); + $inner = $services[(string) $property]; + $this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones'); } public function testLoadServices() diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php similarity index 96% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php index 5f5f265..29d2380 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterBag/ParameterBagTest.php @@ -44,6 +44,19 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase } /** + * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::remove + */ + public function testRemove() + { + $bag = new ParameterBag(array( + 'foo' => 'foo', + 'bar' => 'bar', + )); + $bag->remove('foo'); + $this->assertEquals(array('bar' => 'bar'), $bag->all(), '->remove() removes a parameter'); + } + + /** * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::get * @covers Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::set */ diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/ParameterTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/ParameterTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ParameterTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/ReferenceTest.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/bootstrap.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/bootstrap.php similarity index 56% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/bootstrap.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/bootstrap.php index 77fe275..fd3118f 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/bootstrap.php +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Tests/bootstrap.php @@ -10,20 +10,13 @@ */ spl_autoload_register(function ($class) { - foreach (array( - 'SYMFONY_CONFIG' => 'Config', - 'SYMFONY_YAML' => 'Yaml', - ) as $env => $name) { - if (isset($_SERVER[$env]) && 0 === strpos(ltrim($class, '/'), 'Symfony\Component\\'.$name)) { - if (file_exists($file = $_SERVER[$env].'/'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\\'.$name)).'.php')) { - require_once $file; - } - } - } - if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\DependencyInjection')) { if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\DependencyInjection')).'.php')) { require_once $file; } } }); + +if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) { + require_once $loader; +} diff --git a/core/vendor/Symfony/Component/DependencyInjection/Variable.php b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Variable.php similarity index 100% rename from core/vendor/Symfony/Component/DependencyInjection/Variable.php rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Variable.php diff --git a/core/vendor/Symfony/Component/DependencyInjection/composer.json b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/composer.json similarity index 87% rename from core/vendor/Symfony/Component/DependencyInjection/composer.json rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/composer.json index adf6f11..7238bd0 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/composer.json +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/composer.json @@ -16,7 +16,11 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/yaml": "2.1.*", + "symfony/config": "2.1.*" }, "suggest": { "symfony/yaml": "self.version", diff --git a/core/vendor/Symfony/Component/DependencyInjection/phpunit.xml.dist b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/phpunit.xml.dist similarity index 94% rename from core/vendor/Symfony/Component/DependencyInjection/phpunit.xml.dist rename to core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/phpunit.xml.dist index bb81f45..554d104 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/phpunit.xml.dist +++ b/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/phpunit.xml.dist @@ -23,6 +23,7 @@ ./Resources ./Tests + ./vendor diff --git a/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/.gitignore b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md similarity index 7% copy from core/vendor/Symfony/Component/Yaml/CHANGELOG.md copy to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md index 096cf65..9f8c812 100644 --- a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/CHANGELOG.md @@ -4,5 +4,13 @@ CHANGELOG 2.1.0 ----- - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) + * added TraceableEventDispatcherInterface + * added ContainerAwareEventDispatcher + * added a reference to the EventDispatcher on the Event + * added a reference to the Event name on the event + * added fluid interface to the dispatch() method which now returns the Event + object + * added GenericEvent event class + * added the possibility for subscribers to subscribe several times for the + same event + * added UnmodifiableEventDispatcher diff --git a/core/vendor/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php similarity index 95% rename from core/vendor/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php index 53a0f67..85ba2ad 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/ContainerAwareEventDispatcher.php @@ -18,7 +18,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface; * container * * @author Fabien Potencier - * @author Bernhard Schussek + * @author Bernhard Schussek * @author Jordan Alliot */ class ContainerAwareEventDispatcher extends EventDispatcher @@ -54,10 +54,10 @@ class ContainerAwareEventDispatcher extends EventDispatcher /** * Adds a service as event listener * - * @param string $eventName Event for which the listener is added - * @param array $callback The service ID of the listener service & the method + * @param string $eventName Event for which the listener is added + * @param array $callback The service ID of the listener service & the method * name that has to be called - * @param integer $priority The higher this value, the earlier an event listener + * @param integer $priority The higher this value, the earlier an event listener * will be triggered in the chain. * Defaults to 0. */ diff --git a/core/vendor/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php similarity index 100% rename from core/vendor/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php diff --git a/core/vendor/Symfony/Component/EventDispatcher/Event.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Event.php similarity index 100% rename from core/vendor/Symfony/Component/EventDispatcher/Event.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Event.php diff --git a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcher.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php similarity index 96% rename from core/vendor/Symfony/Component/EventDispatcher/EventDispatcher.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php index b2fb51a..356f919 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcher.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcher.php @@ -155,8 +155,8 @@ class EventDispatcher implements EventDispatcherInterface * for each listener. * * @param array[callback] $listeners The event listeners. - * @param string $eventName The name of the event to dispatch. - * @param Event $event The event object to pass to the event handlers/listeners. + * @param string $eventName The name of the event to dispatch. + * @param Event $event The event object to pass to the event handlers/listeners. */ protected function doDispatch($listeners, $eventName, Event $event) { diff --git a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php similarity index 97% rename from core/vendor/Symfony/Component/EventDispatcher/EventDispatcherInterface.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php index d47ee66..e53d71d 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventDispatcherInterface.php @@ -28,7 +28,7 @@ interface EventDispatcherInterface * @param string $eventName The name of the event to dispatch. The name of * the event is the name of the method that is * invoked on listeners. - * @param Event $event The event to pass to the event handlers/listeners. + * @param Event $event The event to pass to the event handlers/listeners. * If not supplied, an empty Event instance is created. * * @return Event diff --git a/core/vendor/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php similarity index 100% rename from core/vendor/Symfony/Component/EventDispatcher/EventSubscriberInterface.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/EventSubscriberInterface.php diff --git a/core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php similarity index 96% copy from core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php copy to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php index 0e792d0..0ad76ee 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/GenericEvent.php @@ -37,8 +37,8 @@ class GenericEvent extends Event implements \ArrayAccess /** * Encapsulate an event with $subject, $args, and $data. * - * @param mixed $subject The subject of the event, usually an object. - * @param array $arguments Arguments to store in the event. + * @param mixed $subject The subject of the event, usually an object. + * @param array $arguments Arguments to store in the event. */ public function __construct($subject = null, array $arguments = array()) { diff --git a/core/vendor/Symfony/Component/EventDispatcher/LICENSE b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/EventDispatcher/LICENSE rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/LICENSE diff --git a/core/vendor/Symfony/Component/EventDispatcher/README.md b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/README.md similarity index 68% rename from core/vendor/Symfony/Component/EventDispatcher/README.md rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/README.md index 421b8c6..a2bcfca 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/README.md +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/README.md @@ -20,11 +20,9 @@ Resources You can run the unit tests with the following command: - phpunit -c src/Symfony/Component/EventDispatcher/ + phpunit If you also want to run the unit tests that depend on other Symfony -Components, declare the following environment variables before running -PHPUnit: +Components, install dev dependencies before running PHPUnit: - export SYMFONY_DEPENDENCY_INJECTION=../path/to/DependencyInjection - export SYMFONY_HTTP_KERNEL=../path/to/HttpKernel + php composer.phar install --dev diff --git a/core/vendor/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php similarity index 99% rename from core/vendor/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php index 10f5e17..c62fc10 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php @@ -242,7 +242,8 @@ class Service class SubscriberService implements EventSubscriberInterface { - static function getSubscribedEvents() { + static function getSubscribedEvents() + { return array( 'onEvent' => 'onEvent', 'onEvent' => array('onEvent', 10), diff --git a/core/vendor/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php similarity index 100% rename from core/vendor/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventDispatcherTest.php diff --git a/core/vendor/Symfony/Component/EventDispatcher/Tests/EventTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php similarity index 100% copy from core/vendor/Symfony/Component/EventDispatcher/Tests/EventTest.php copy to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/EventTest.php diff --git a/core/vendor/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php similarity index 100% rename from core/vendor/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/GenericEventTest.php diff --git a/core/vendor/Symfony/Component/EventDispatcher/Tests/EventTest.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php similarity index 18% rename from core/vendor/Symfony/Component/EventDispatcher/Tests/EventTest.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php index cbc3910..d2502b1 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/Tests/EventTest.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/UnmodifiableEventDispatcherTest.php @@ -12,74 +12,95 @@ namespace Symfony\Component\EventDispatcher\Tests; use Symfony\Component\EventDispatcher\Event; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\UnmodifiableEventDispatcher; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** - * Test class for Event. + * @author Bernhard Schussek */ -class EventTest extends \PHPUnit_Framework_TestCase +class UnmodifiableEventDispatcherTest extends \PHPUnit_Framework_TestCase { /** - * @var \Symfony\Component\EventDispatcher\Event + * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $event; + private $innerDispatcher; /** - * @var \Symfony\Component\EventDispatcher\EventDispatcher + * @var UnmodifiableEventDispatcher */ - protected $dispatcher; + private $dispatcher; - - /** - * Sets up the fixture, for example, opens a network connection. - * This method is called before a test is executed. - */ protected function setUp() { - $this->event = new Event; - $this->dispatcher = new EventDispatcher(); + $this->innerDispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $this->dispatcher = new UnmodifiableEventDispatcher($this->innerDispatcher); } - /** - * Tears down the fixture, for example, closes a network connection. - * This method is called after a test is executed. - */ - protected function tearDown() + public function testDispatchDelegates() { - $this->event = null; - $this->eventDispatcher = null; + $event = new Event(); + + $this->innerDispatcher->expects($this->once()) + ->method('dispatch') + ->with('event', $event) + ->will($this->returnValue('result')); + + $this->assertSame('result', $this->dispatcher->dispatch('event', $event)); } - public function testIsPropagationStopped() + public function testGetListenersDelegates() { - $this->assertFalse($this->event->isPropagationStopped()); + $this->innerDispatcher->expects($this->once()) + ->method('getListeners') + ->with('event') + ->will($this->returnValue('result')); + + $this->assertSame('result', $this->dispatcher->getListeners('event')); } - public function testStopPropagationAndIsPropagationStopped() + public function testHasListenersDelegates() { - $this->event->stopPropagation(); - $this->assertTrue($this->event->isPropagationStopped()); + $this->innerDispatcher->expects($this->once()) + ->method('hasListeners') + ->with('event') + ->will($this->returnValue('result')); + + $this->assertSame('result', $this->dispatcher->hasListeners('event')); } - public function testSetDispatcher() + /** + * @expectedException \BadMethodCallException + */ + public function testAddListenerDisallowed() { - $this->event->setDispatcher($this->dispatcher); - $this->assertSame($this->dispatcher, $this->event->getDispatcher()); + $this->dispatcher->addListener('event', function () { return 'foo'; }); } - public function testGetDispatcher() + /** + * @expectedException \BadMethodCallException + */ + public function testAddSubscriberDisallowed() { - $this->assertNull($this->event->getDispatcher()); + $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface'); + + $this->dispatcher->addSubscriber($subscriber); } - public function testGetName() + /** + * @expectedException \BadMethodCallException + */ + public function testRemoveListenerDisallowed() { - $this->assertNull($this->event->getName()); + $this->dispatcher->removeListener('event', function () { return 'foo'; }); } - public function testSetName() + /** + * @expectedException \BadMethodCallException + */ + public function testRemoveSubscriberDisallowed() { - $this->event->setName('foo'); - $this->assertEquals('foo', $this->event->getName()); + $subscriber = $this->getMock('Symfony\Component\EventDispatcher\EventSubscriberInterface'); + + $this->dispatcher->removeSubscriber($subscriber); } } diff --git a/core/vendor/Symfony/Component/EventDispatcher/Tests/bootstrap.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/bootstrap.php similarity index 53% rename from core/vendor/Symfony/Component/EventDispatcher/Tests/bootstrap.php rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/bootstrap.php index b71ee52..033180f 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/Tests/bootstrap.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/Tests/bootstrap.php @@ -10,20 +10,13 @@ */ spl_autoload_register(function ($class) { - foreach (array( - 'SYMFONY_DEPENDENCY_INJECTION' => 'DependencyInjection', - 'SYMFONY_HTTP_KERNEL' => 'HttpKernel', - ) as $env => $name) { - if (isset($_SERVER[$env]) && 0 === strpos(ltrim($class, '/'), 'Symfony\Component\\'.$name)) { - if (file_exists($file = $_SERVER[$env].'/'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\\'.$name)).'.php')) { - require_once $file; - } - } - } - if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\EventDispatcher')) { if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\EventDispatcher')).'.php')) { require_once $file; } } }); + +if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) { + require_once $loader; +} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php similarity index 27% copy from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php copy to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php index e925d62..c7097aa 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/UnmodifiableEventDispatcher.php @@ -9,87 +9,84 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\Session\Storage\Proxy; +namespace Symfony\Component\EventDispatcher; /** - * SessionHandler proxy. + * A read-only proxy for an event dispatcher. * - * @author Drak + * @author Bernhard Schussek */ -class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface +class UnmodifiableEventDispatcher implements EventDispatcherInterface { /** - * @var \SessionHandlerInterface + * The proxied dispatcher. + * @var EventDispatcherInterface */ - protected $handler; + private $dispatcher; /** - * Constructor. + * Creates an unmodifiable proxy for an event dispatcher. * - * @param \SessionHandlerInterface $handler + * @param EventDispatcherInterface $dispatcher The proxied event dispatcher. */ - public function __construct(\SessionHandlerInterface $handler) + public function __construct(EventDispatcherInterface $dispatcher) { - $this->handler = $handler; - $this->wrapper = ($handler instanceof \SessionHandler); - $this->saveHandlerName = $this->wrapper ? ini_get('session.save_handler') : 'user'; + $this->dispatcher = $dispatcher; } - // \SessionHandlerInterface - /** * {@inheritdoc} */ - public function open($savePath, $sessionName) + public function dispatch($eventName, Event $event = null) { - $return = (bool)$this->handler->open($savePath, $sessionName); - - if (true === $return) { - $this->active = true; - } - - return $return; + return $this->dispatcher->dispatch($eventName, $event); } /** * {@inheritdoc} */ - public function close() + public function addListener($eventName, $listener, $priority = 0) { - $this->active = false; + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); + } - return (bool) $this->handler->close(); + /** + * {@inheritdoc} + */ + public function addSubscriber(EventSubscriberInterface $subscriber) + { + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); } /** * {@inheritdoc} */ - public function read($id) + public function removeListener($eventName, $listener) { - return (string) $this->handler->read($id); + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); } /** * {@inheritdoc} */ - public function write($id, $data) + public function removeSubscriber(EventSubscriberInterface $subscriber) { - return (bool) $this->handler->write($id, $data); + throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.'); } /** * {@inheritdoc} */ - public function destroy($id) + public function getListeners($eventName = null) { - return (bool) $this->handler->destroy($id); + return $this->dispatcher->getListeners($eventName); } /** * {@inheritdoc} */ - public function gc($maxlifetime) + public function hasListeners($eventName = null) { - return (bool) $this->handler->gc($maxlifetime); + return $this->dispatcher->hasListeners($eventName); } } diff --git a/core/vendor/Symfony/Component/EventDispatcher/composer.json b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/composer.json similarity index 89% rename from core/vendor/Symfony/Component/EventDispatcher/composer.json rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/composer.json index d93d09f..9a34819 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/composer.json +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/composer.json @@ -16,7 +16,10 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/dependency-injection": "2.1.*" }, "suggest": { "symfony/dependency-injection": "self.version", diff --git a/core/vendor/Symfony/Component/EventDispatcher/phpunit.xml.dist b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/phpunit.xml.dist similarity index 94% rename from core/vendor/Symfony/Component/EventDispatcher/phpunit.xml.dist rename to core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/phpunit.xml.dist index cb261a4..c557135 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/phpunit.xml.dist +++ b/core/vendor/symfony/event-dispatcher/Symfony/Component/EventDispatcher/phpunit.xml.dist @@ -23,6 +23,7 @@ ./Resources ./Tests + ./vendor diff --git a/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ApacheRequest.php similarity index 100% copy from core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ApacheRequest.php diff --git a/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md new file mode 100644 index 0000000..d8664e6 --- /dev/null +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -0,0 +1,73 @@ +CHANGELOG +========= + +2.1.0 +----- + + * added a fluent interface to the Response class + * added Request::isProxyTrusted() + * added JsonResponse + * added a getTargetUrl method to RedirectResponse + * added support for streamed responses + * made Response::prepare() method the place to enforce HTTP specification + * [BC BREAK] moved management of the locale from the Session class to the Request class + * added a generic access to the PHP built-in filter mechanism: ParameterBag::filter() + * made FileBinaryMimeTypeGuesser command configurable + * added Request::getUser() and Request::getPassword() + * added support for the PATCH method in Request + * removed the ContentTypeMimeTypeGuesser class as it is deprecated and never used on PHP 5.3 + * added ResponseHeaderBag::makeDisposition() (implements RFC 6266) + * made mimetype to extension conversion configurable + * [BC BREAK] Moved all session related classes and interfaces into own namespace, as + `Symfony\Component\HttpFoundation\Session` and renamed classes accordingly. + Session handlers are located in the subnamespace `Symfony\Component\HttpFoundation\Session\Handler`. + * SessionHandlers must implement `\SessionHandlerInterface`. + * Added internal storage driver proxy mechanism for forward compatibility with + PHP 5.4 `\SessionHandler` class. + * Added session handlers for custom Memcache, Memcached and Null session save handlers. + * [BC BREAK] Removed `NativeSessionStorage` and replaced with `NativeFileSessionHandler`. + * [BC BREAK] `SessionStorageInterface` methods removed: `write()`, `read()` and + `remove()`. Added `getBag()`, `registerBag()`. The `NativeSessionStorage` class + is a mediator for the session storage internals including the session handlers + which do the real work of participating in the internal PHP session workflow. + * [BC BREAK] Introduced mock implementations of `SessionStorage` to enable unit + and functional testing without starting real PHP sessions. Removed + `ArraySessionStorage`, and replaced with `MockArraySessionStorage` for unit + tests; removed `FilesystemSessionStorage`, and replaced with`MockFileSessionStorage` + for functional tests. These do not interact with global session ini + configuration values, session functions or `$_SESSION` superglobal. This means + they can be configured directly allowing multiple instances to work without + conflicting in the same PHP process. + * [BC BREAK] Removed the `close()` method from the `Session` class, as this is + now redundant. + * Deprecated the following methods from the Session class: `setFlash()`, `setFlashes()` + `getFlash()`, `hasFlash()`, and `removeFlash()`. Use `getFlashBag()` instead + which returns a `FlashBagInterface`. + * `Session->clear()` now only clears session attributes as before it cleared + flash messages and attributes. `Session->getFlashBag()->all()` clears flashes now. + * Session data is now managed by `SessionBagInterface` to better encapsulate + session data. + * Refactored session attribute and flash messages system to their own + `SessionBagInterface` implementations. + * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This + implementation is ESI compatible. + * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire + behaviour of messages auto expiring. + after one page page load. Messages must be retrieved by `get()` or `all()`. + * Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate + attributes storage behaviour from 2.0.x (default). + * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for + namespace session attributes. + * Flash API can stores messages in an array so there may be multiple messages + per flash type. The old `Session` class API remains without BC break as it + will allow single messages as before. + * Added basic session meta-data to the session to record session create time, + last updated time, and the lifetime of the session cookie that was provided + to the client. + * Request::getClientIp() method doesn't take a parameter anymore but bases + itself on the trustProxy parameter. + * Added isMethod() to Request object. + * [BC BREAK] The methods `getPathInfo()`, `getBaseUrl()` and `getBasePath()` of + a `Request` now all return a raw value (vs a urldecoded value before). Any call + to one of these methods must be checked and wrapped in a `rawurldecode()` if + needed. diff --git a/core/vendor/Symfony/Component/HttpFoundation/Cookie.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php similarity index 85% rename from core/vendor/Symfony/Component/HttpFoundation/Cookie.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php index 0511162..47c2199 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Cookie.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Cookie.php @@ -31,13 +31,13 @@ class Cookie /** * Constructor. * - * @param string $name The name of the cookie - * @param string $value The value of the cookie - * @param integer|string|\DateTime $expire The time the cookie expires - * @param string $path The path on the server in which the cookie will be available on - * @param string $domain The domain that the cookie is available to - * @param Boolean $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client - * @param Boolean $httpOnly Whether the cookie will be made accessible only through the HTTP protocol + * @param string $name The name of the cookie + * @param string $value The value of the cookie + * @param integer|string|\DateTime $expire The time the cookie expires + * @param string $path The path on the server in which the cookie will be available on + * @param string $domain The domain that the cookie is available to + * @param Boolean $secure Whether the cookie should only be transmitted over a secure HTTPS connection from the client + * @param Boolean $httpOnly Whether the cookie will be made accessible only through the HTTP protocol * * @api */ diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php similarity index 83% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php index 9c7fe68..41f7a46 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/AccessDeniedException.php @@ -14,14 +14,14 @@ namespace Symfony\Component\HttpFoundation\File\Exception; /** * Thrown when the access on a file was denied. * - * @author Bernhard Schussek + * @author Bernhard Schussek */ class AccessDeniedException extends FileException { /** * Constructor. * - * @param string $path The path to the accessed file + * @param string $path The path to the accessed file */ public function __construct($path) { diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileException.php similarity index 87% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileException.php index 43c6cc8..68f827b 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileException.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileException.php @@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\File\Exception; /** * Thrown when an error occurred in the component File * - * @author Bernhard Schussek + * @author Bernhard Schussek */ class FileException extends \RuntimeException { diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php similarity index 81% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php index 5b1aef8..bd70094 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/FileNotFoundException.php @@ -14,14 +14,14 @@ namespace Symfony\Component\HttpFoundation\File\Exception; /** * Thrown when a file was not found * - * @author Bernhard Schussek + * @author Bernhard Schussek */ class FileNotFoundException extends FileException { /** * Constructor. * - * @param string $path The path to the file that was not found + * @param string $path The path to the file that was not found */ public function __construct($path) { diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UnexpectedTypeException.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UploadException.php similarity index 87% rename from core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UploadException.php index 694e864..382282e 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/Exception/UploadException.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/Exception/UploadException.php @@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\File\Exception; /** * Thrown when an error occurred during file upload * - * @author Bernhard Schussek + * @author Bernhard Schussek */ class UploadException extends FileException { diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/File.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/File/File.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php index 20a80ca..188f0c3 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/File.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/File.php @@ -19,7 +19,7 @@ use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; /** * A file in the file system. * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ @@ -122,7 +122,7 @@ class File extends \SplFileInfo throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); } - chmod($target, 0666 & ~umask()); + @chmod($target, 0666 & ~umask()); return new File($target); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php index b73cd99..dcea613 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php @@ -82,7 +82,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * returns a value that is not NULL, this method terminates and returns the * 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 */ public function guess($mimeType) diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php similarity index 92% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php index 5b14ef9..e8db065 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php @@ -19,7 +19,7 @@ interface ExtensionGuesserInterface /** * Makes a best guess for a file extension, given a mime type * - * @param string $mimeType The mime type + * @param string $mimeType The mime type * @return string The guessed extension or NULL, if none could be guessed */ function guess($mimeType); diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index 12b84cd..0761c26 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; /** * Guesses the mime type with the binary "file" (only available on *nix) * - * @author Bernhard Schussek + * @author Bernhard Schussek */ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface { diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php similarity index 95% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php index 45d5a08..873b94b 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; /** * Guesses the mime type using the PECL extension FileInfo * - * @author Bernhard Schussek + * @author Bernhard Schussek */ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface { diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index d73a093..84bd4ce 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -28,7 +28,7 @@ use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; * * The last registered guesser is preferred over previously registered ones. * - * @author Bernhard Schussek + * @author Bernhard Schussek */ class MimeTypeGuesser implements MimeTypeGuesserInterface { @@ -92,7 +92,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * returns a value that is not NULL, this method terminates and returns the * value. * - * @param string $path The path to the file + * @param string $path The path to the file * * @return string The mime type or NULL, if none could be guessed * diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php similarity index 86% rename from core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php index 66178bb..40e8ffd 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php @@ -14,14 +14,14 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; /** * Guesses the mime type of a file * - * @author Bernhard Schussek + * @author Bernhard Schussek */ interface MimeTypeGuesserInterface { /** * Guesses the mime type of the file with the given path. * - * @param string $path The path to the file + * @param string $path The path to the file * * @return string The mime type or NULL, if none could be guessed * diff --git a/core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php index 4e51c50..7e57b02 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; /** * A file uploaded through a form. * - * @author Bernhard Schussek + * @author Bernhard Schussek * @author Florian Eckerstorfer * @author Fabien Potencier * diff --git a/core/vendor/Symfony/Component/HttpFoundation/FileBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/FileBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php index 702ab84..0f85eb0 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/FileBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/FileBag.php @@ -80,7 +80,7 @@ class FileBag extends ParameterBag /** * Converts uploaded files to UploadedFile instances. * - * @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information + * @param array|UploadedFile $file A (multi-dimensional) array of uploaded file information * * @return array A (multi-dimensional) array of UploadedFile instances */ @@ -121,7 +121,7 @@ class FileBag extends ParameterBag * It's safe to pass an already converted array, in which case this method * just returns the original array unmodified. * - * @param array $data + * @param array $data * * @return array */ diff --git a/core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php index 88ad1af..cb34012 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/HeaderBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/HeaderBag.php @@ -90,7 +90,7 @@ class HeaderBag implements \IteratorAggregate, \Countable /** * Replaces the current HTTP headers by a new set. * - * @param array $headers An array of HTTP headers + * @param array $headers An array of HTTP headers * * @api */ @@ -103,7 +103,7 @@ class HeaderBag implements \IteratorAggregate, \Countable /** * Adds new headers the current HTTP headers set. * - * @param array $headers An array of HTTP headers + * @param array $headers An array of HTTP headers * * @api */ diff --git a/core/vendor/Symfony/Component/HttpFoundation/JsonResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php similarity index 79% rename from core/vendor/Symfony/Component/HttpFoundation/JsonResponse.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php index d30899f..734628f 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/JsonResponse.php @@ -24,9 +24,9 @@ class JsonResponse extends Response /** * Constructor. * - * @param mixed $data The response data - * @param integer $status The response status code - * @param array $headers An array of response headers + * @param mixed $data The response data + * @param integer $status The response status code + * @param array $headers An array of response headers */ public function __construct($data = array(), $status = 200, $headers = array()) { @@ -55,8 +55,11 @@ class JsonResponse extends Response if ($callback) { // taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u'; - if (!preg_match($pattern, $callback)) { - throw new \InvalidArgumentException('The callback name is not valid.'); + $parts = explode('.', $callback); + foreach ($parts as $part) { + if (!preg_match($pattern, $part)) { + throw new \InvalidArgumentException('The callback name is not valid.'); + } } } @@ -79,7 +82,8 @@ class JsonResponse extends Response $data = new \ArrayObject(); } - $this->data = json_encode($data); + // 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); return $this->update(); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/LICENSE b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/LICENSE rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/LICENSE diff --git a/core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php similarity index 94% rename from core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php index b4fa676..a39756e 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/ParameterBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ParameterBag.php @@ -92,7 +92,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @param string $path The key * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items + * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @api */ @@ -189,7 +189,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items + * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value * @@ -205,7 +205,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items + * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value * @@ -221,7 +221,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items + * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return string The filtered value * @@ -238,7 +238,7 @@ class ParameterBag implements \IteratorAggregate, \Countable * * @param string $key The parameter key * @param mixed $default The default value if the parameter key does not exist - * @param boolean $deep If true, a path like foo[bar] will find deeper items + * @param boolean $deep If true, a path like foo[bar] will find deeper items * * @return integer The filtered value * diff --git a/core/vendor/Symfony/Component/HttpFoundation/README.md b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/README.md similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/README.md rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/README.md index 8e5d8cf..bb6f02c 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/README.md +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/README.md @@ -43,4 +43,4 @@ Resources You can run the unit tests with the following command: - phpunit -c src/Symfony/Component/HttpFoundation/ + phpunit diff --git a/core/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/RedirectResponse.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RedirectResponse.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Request.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/Request.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php index b4fd7ac..581b4c9 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Request.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Request.php @@ -470,9 +470,9 @@ class Request * It is better to explicity get request parameters from the appropriate * public property instead (query, request, attributes, ...). * - * @param string $key the key - * @param mixed $default the default value - * @param type $deep is parameter deep in multidimensional array + * @param string $key the key + * @param mixed $default the default value + * @param type $deep is parameter deep in multidimensional array * * @return mixed */ @@ -546,9 +546,16 @@ class Request if ($this->server->has('HTTP_CLIENT_IP')) { return $this->server->get('HTTP_CLIENT_IP'); } elseif ($this->server->has('HTTP_X_FORWARDED_FOR')) { - $clientIp = explode(',', $this->server->get('HTTP_X_FORWARDED_FOR'), 2); + $clientIp = explode(',', $this->server->get('HTTP_X_FORWARDED_FOR')); - return isset($clientIp[0]) ? trim($clientIp[0]) : ''; + foreach ($clientIp as $ipAddress) { + $cleanIpAddress = trim($ipAddress); + + if (false !== filter_var($cleanIpAddress, FILTER_VALIDATE_IP)) { + return $cleanIpAddress; + } + } + return ''; } } @@ -659,9 +666,9 @@ class Request { if (self::$trustProxy && $this->headers->has('X-Forwarded-Port')) { return $this->headers->get('X-Forwarded-Port'); - } else { - return $this->server->get('SERVER_PORT'); } + + return $this->server->get('SERVER_PORT'); } /** @@ -884,7 +891,7 @@ class Request /** * Gets the mime type associated with the format. * - * @param string $format The format + * @param string $format The format * * @return string The associated mime type (null if not found) * @@ -902,7 +909,7 @@ class Request /** * Gets the format associated with the mime type. * - * @param string $mimeType The associated mime type + * @param string $mimeType The associated mime type * * @return string The format (null if not found) * @@ -930,8 +937,8 @@ class Request /** * Associates a format with mime types. * - * @param string $format The format - * @param string|array $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type) + * @param string $format The format + * @param string|array $mimeTypes The associated mime types (the preferred one must be the first as it will be used as the content type) * * @api */ @@ -953,7 +960,7 @@ class Request * * _format request parameter * * $default * - * @param string $default The default format + * @param string $default The default format * * @return string The request format * @@ -1053,7 +1060,7 @@ class Request /** * Returns the request body content. * - * @param Boolean $asResource If true, a resource will be returned + * @param Boolean $asResource If true, a resource will be returned * * @return string|resource The request body content or a resource to read the body stream. */ @@ -1094,7 +1101,7 @@ class Request /** * Returns the preferred language. * - * @param array $locales An array of ordered available locales + * @param array $locales An array of ordered available locales * * @return string|null The preferred locale * @@ -1209,7 +1216,7 @@ class Request /** * Splits an Accept-* HTTP header. * - * @param string $header Header to split + * @param string $header Header to split * * @return array Array indexed by the values of the Accept-* header in preferred order */ diff --git a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php similarity index 100% copy from core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcher.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php similarity index 91% rename from core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php index 506ec79..0ee161c 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcherInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/RequestMatcherInterface.php @@ -23,7 +23,7 @@ interface RequestMatcherInterface /** * Decides whether the rule(s) implemented by the strategy matches the supplied request. * - * @param Request $request The request to check for a match + * @param Request $request The request to check for a match * * @return Boolean true if the request matches, false otherwise * diff --git a/core/vendor/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php index 4378b81..11fcf3b 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php @@ -12,7 +12,7 @@ /** * SessionHandlerInterface * - * Provides forward compatability with PHP 5.4 + * Provides forward compatibility with PHP 5.4 * * Extensive documentation can be found at php.net, see links: * diff --git a/core/vendor/Symfony/Component/HttpFoundation/Response.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php similarity index 95% rename from core/vendor/Symfony/Component/HttpFoundation/Response.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php index 5d443ef..882ac4d 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Response.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php @@ -102,26 +102,26 @@ class Response 415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed', - 418 => 'I\'m a teapot', - 422 => 'Unprocessable Entity', // RFC4918 - 423 => 'Locked', // RFC4918 - 424 => 'Failed Dependency', // RFC4918 + 418 => 'I\'m a teapot', // RFC2324 + 422 => 'Unprocessable Entity', // RFC4918 + 423 => 'Locked', // RFC4918 + 424 => 'Failed Dependency', // RFC4918 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 - 426 => 'Upgrade Required', // RFC2817 - 428 => 'Precondition Required', // RFC-nottingham-http-new-status-04 - 429 => 'Too Many Requests', // RFC-nottingham-http-new-status-04 - 431 => 'Request Header Fields Too Large', // RFC-nottingham-http-new-status-04 + 426 => 'Upgrade Required', // RFC2817 + 428 => 'Precondition Required', // RFC6585 + 429 => 'Too Many Requests', // RFC6585 + 431 => 'Request Header Fields Too Large', // RFC6585 500 => 'Internal Server Error', 501 => 'Not Implemented', 502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout', 505 => 'HTTP Version Not Supported', - 506 => 'Variant Also Negotiates (Experimental)', // [RFC2295] - 507 => 'Insufficient Storage', // RFC4918 - 508 => 'Loop Detected', // RFC5842 - 510 => 'Not Extended', // RFC2774 - 511 => 'Network Authentication Required', // RFC-nottingham-http-new-status-04 + 506 => 'Variant Also Negotiates (Experimental)', // RFC2295 + 507 => 'Insufficient Storage', // RFC4918 + 508 => 'Loop Detected', // RFC5842 + 510 => 'Not Extended', // RFC2774 + 511 => 'Network Authentication Required', // RFC6585 ); /** @@ -206,7 +206,7 @@ class Response $headers = $this->headers; if ($this->isInformational() || in_array($this->statusCode, array(204, 304))) { - $this->setContent(''); + $this->setContent(null); } // Content-type based on the Request @@ -234,7 +234,7 @@ class Response if ('HEAD' === $request->getMethod()) { // cf. RFC2616 14.13 $length = $headers->get('Content-Length'); - $this->setContent(''); + $this->setContent(null); if ($length) { $headers->set('Content-Length', $length); } @@ -533,7 +533,7 @@ class Response */ public function mustRevalidate() { - return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('must-proxy-revalidate'); + return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->has('proxy-revalidate'); } /** @@ -1100,7 +1100,7 @@ class Response */ public function isRedirect($location = null) { - return in_array($this->statusCode, array(201, 301, 302, 303, 307)) && (null === $location ?: $location == $this->headers->get('Location')); + return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); } /** diff --git a/core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/ResponseHeaderBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ResponseHeaderBag.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/ServerBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php similarity index 39% rename from core/vendor/Symfony/Component/HttpFoundation/ServerBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php index 6a077f4..352321f 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/ServerBag.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/ServerBag.php @@ -16,6 +16,7 @@ namespace Symfony\Component\HttpFoundation; * * @author Fabien Potencier * @author Bulat Shakirzyanov + * @author Robert Kiss */ class ServerBag extends ParameterBag { @@ -37,10 +38,43 @@ class ServerBag extends ParameterBag } } - // PHP_AUTH_USER/PHP_AUTH_PW if (isset($this->parameters['PHP_AUTH_USER'])) { - $pass = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : ''; - $headers['AUTHORIZATION'] = 'Basic '.base64_encode($this->parameters['PHP_AUTH_USER'].':'.$pass); + $headers['PHP_AUTH_USER'] = $this->parameters['PHP_AUTH_USER']; + $headers['PHP_AUTH_PW'] = isset($this->parameters['PHP_AUTH_PW']) ? $this->parameters['PHP_AUTH_PW'] : ''; + } else { + /* + * php-cgi under Apache does not pass HTTP Basic user/pass to PHP by default + * For this workaround to work, add these lines to your .htaccess file: + * RewriteCond %{HTTP:Authorization} ^(.+)$ + * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + * + * A sample .htaccess file: + * RewriteEngine On + * RewriteCond %{HTTP:Authorization} ^(.+)$ + * RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] + * RewriteCond %{REQUEST_FILENAME} !-f + * RewriteRule ^(.*)$ app.php [QSA,L] + */ + + $authorizationHeader = null; + if (isset($this->parameters['HTTP_AUTHORIZATION'])) { + $authorizationHeader = $this->parameters['HTTP_AUTHORIZATION']; + } elseif (isset($this->parameters['REDIRECT_HTTP_AUTHORIZATION'])) { + $authorizationHeader = $this->parameters['REDIRECT_HTTP_AUTHORIZATION']; + } + + // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic + if ((null !== $authorizationHeader) && (0 === stripos($authorizationHeader, 'basic'))) { + $exploded = explode(':', base64_decode(substr($authorizationHeader, 6))); + if (count($exploded) == 2) { + list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; + } + } + } + + // PHP_AUTH_USER/PHP_AUTH_PW + if (isset($headers['PHP_AUTH_USER'])) { + $headers['AUTHORIZATION'] = 'Basic '.base64_encode($headers['PHP_AUTH_USER'].':'.$headers['PHP_AUTH_PW']); } return $headers; diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBag.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBag.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php index 7da1227..2fab8bd 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php @@ -26,7 +26,7 @@ interface FlashBagInterface extends SessionBagInterface * @param string $type * @param string $message */ - public function add($type, $message); + function add($type, $message); /** * Registers a message for a given type. diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Session.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php similarity index 96% copy from core/vendor/Symfony/Component/HttpFoundation/Session/Session.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php index 0c40c1c..b70a334 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Session.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Session.php @@ -209,7 +209,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable } /** - * {@iheritdoc} + * {@inheritdoc} */ public function getMetadataBag() { @@ -217,7 +217,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable } /** - * {@iheritdoc} + * {@inheritdoc} */ public function registerBag(SessionBagInterface $bag) { @@ -225,7 +225,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable } /** - * {@iheritdoc} + * {@inheritdoc} */ public function getBag($name) { @@ -256,7 +256,11 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable $return = array(); if ($all) { foreach ($all as $name => $array) { - $return[$name] = reset($array); + if (is_numeric(key($array))) { + $return[$name] = reset($array); + } else { + $return[$name] = $array; + } } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php similarity index 100% copy from core/vendor/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/SessionInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/Session/SessionInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php index 15b4c29..833dd9c 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/SessionInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/SessionInterface.php @@ -179,7 +179,7 @@ interface SessionInterface * * @param SessionBagInterface $bag */ - public function registerBag(SessionBagInterface $bag); + function registerBag(SessionBagInterface $bag); /** * Gets a bag instance by name. @@ -188,12 +188,12 @@ interface SessionInterface * * @return SessionBagInterface */ - public function getBag($name); + function getBag($name); /** * Gets session meta. * * @return MetadataBag */ - public function getMetadataBag(); + function getMetadataBag(); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php similarity index 24% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php index 422e3a7..1417b5a 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php @@ -12,30 +12,104 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * NativeFileSessionHandler. - * - * Native session handler using PHP's built in file storage. + * FileSessionHandler. * * @author Drak */ -class NativeFileSessionHandler extends NativeSessionHandler +class FileSessionHandler implements \SessionHandlerInterface { /** + * @var string + */ + private $savePath; + + /** + * @var string + */ + private $prefix; + + /** * Constructor. * - * @param string $savePath Path of directory to save session files. Default null will leave setting as defined by PHP. + * @param string $savePath Path of directory to save session files. */ - public function __construct($savePath = null) + public function __construct($savePath = null, $prefix = 'sess_') { if (null === $savePath) { - $savePath = ini_get('session.save_path'); + $savePath = sys_get_temp_dir(); } - if ($savePath && !is_dir($savePath)) { - mkdir($savePath, 0777, true); + $this->savePath = $savePath; + if (false === is_dir($this->savePath)) { + mkdir($this->savePath, 0777, true); } - ini_set('session.save_handler', 'files'); - ini_set('session.save_path', $savePath); + $this->prefix = $prefix; + } + + /** + * {@inheritdoc] + */ + public function open($savePath, $sessionName) + { + return true; + } + + /** + * {@inheritdoc] + */ + public function close() + { + return true; + } + + /** + * {@inheritdoc] + */ + public function read($id) + { + $file = $this->getPath().$id; + + return is_readable($file) ? file_get_contents($file) : ''; + } + + /** + * {@inheritdoc] + */ + public function write($id, $data) + { + return false === file_put_contents($this->getPath().$id, $data) ? false : true; + } + + /** + * {@inheritdoc] + */ + public function destroy($id) + { + $file = $this->getPath().$id; + if (is_file($file)) { + unlink($file); + } + + return true; + } + + /** + * {@inheritdoc] + */ + public function gc($maxlifetime) + { + foreach (glob($this->getPath().'*') as $file) { + if ((filemtime($file) + $maxlifetime) < time()) { + unlink($file); + } + } + + return true; + } + + private function getPath() + { + return $this->savePath.'/'.$this->prefix; } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php similarity index 36% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php index fe29832..4a5e639 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -19,85 +19,55 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; class MemcacheSessionHandler implements \SessionHandlerInterface { /** - * Memcache driver. - * - * @var \Memcache + * @var \Memcache Memcache driver. */ private $memcache; /** - * Configuration options. - * - * @var array + * @var integer Time to live in seconds */ - private $memcacheOptions; + private $ttl; /** - * Key prefix for shared environments. - * - * @var string + * @var string Key prefix for shared environments. */ private $prefix; /** * Constructor. * - * @param \Memcache $memcache A \Memcache instance - * @param array $memcacheOptions An associative array of Memcache options - * @param array $options Session configuration options. + * List of available options: + * * prefix: The prefix to use for the memcache keys in order to avoid collision + * * expiretime: The time to live in seconds + * + * @param \Memcache $memcache A \Memcache instance + * @param array $options An associative array of Memcache options + * + * @throws \InvalidArgumentException When unsupported options are passed */ - public function __construct(\Memcache $memcache, array $memcacheOptions = array(), array $options = array()) + public function __construct(\Memcache $memcache, array $options = array()) { - $this->memcache = $memcache; - - // defaults - if (!isset($memcacheOptions['serverpool'])) { - $memcacheOptions['serverpool'] = array(array( - 'host' => '127.0.0.1', - 'port' => 11211, - 'timeout' => 1, - 'persistent' => false, - 'weight' => 1, - 'retry_interval' => 15, + if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { + throw new \InvalidArgumentException(sprintf( + 'The following options are not supported "%s"', implode(', ', $diff) )); } - $memcacheOptions['expiretime'] = isset($memcacheOptions['expiretime']) ? (int)$memcacheOptions['expiretime'] : 86400; - $this->prefix = isset($memcacheOptions['prefix']) ? $memcacheOptions['prefix'] : 'sf2s'; - - $this->memcacheOptions = $memcacheOptions; - } - - protected function addServer(array $server) - { - if (!array_key_exists('host', $server)) { - throw new \InvalidArgumentException('host key must be set'); - } - - $server['port'] = isset($server['port']) ? (int)$server['port'] : 11211; - $server['timeout'] = isset($server['timeout']) ? (int)$server['timeout'] : 1; - $server['persistent'] = isset($server['persistent']) ? (bool)$server['persistent'] : false; - $server['weight'] = isset($server['weight']) ? (int)$server['weight'] : 1; - $server['retry_interval'] = isset($server['retry_interval']) ? (int)$server['retry_interval'] : 15; - - $this->memcache->addserver($server['host'], $server['port'], $server['persistent'],$server['weight'],$server['timeout'],$server['retry_interval']); - + $this->memcache = $memcache; + $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; + $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s'; } /** - * {@inheritdoc} + * {@inheritDoc} */ public function open($savePath, $sessionName) { - foreach ($this->memcacheOptions['serverpool'] as $server) { - $this->addServer($server); - } - return true; } /** - * {@inheritdoc} + * {@inheritDoc} */ public function close() { @@ -105,7 +75,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function read($sessionId) { @@ -113,18 +83,15 @@ class MemcacheSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function write($sessionId, $data) { - if (!$this->memcache->replace($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime'])) { - return $this->memcache->set($this->prefix.$sessionId, $data, 0, $this->memcacheOptions['expiretime']); - } - return true; + return $this->memcache->set($this->prefix.$sessionId, $data, 0, time() + $this->ttl); } /** - * {@inheritdoc} + * {@inheritDoc} */ public function destroy($sessionId) { @@ -132,7 +99,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function gc($lifetime) { diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php similarity index 39% copy from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php index 71770dd..b666199 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -24,55 +24,57 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; class MemcachedSessionHandler implements \SessionHandlerInterface { /** - * Memcached driver. - * - * @var \Memcached + * @var \Memcached Memcached driver. */ private $memcached; /** - * Configuration options. - * - * @var array + * @var integer Time to live in seconds */ - private $memcachedOptions; + private $ttl; + + + /** + * @var string Key prefix for shared environments. + */ + private $prefix; /** * Constructor. * - * @param \Memcached $memcached A \Memcached instance - * @param array $memcachedOptions An associative array of Memcached options - * @param array $options Session configuration options. + * List of available options: + * * prefix: The prefix to use for the memcached keys in order to avoid collision + * * expiretime: The time to live in seconds + * + * @param \Memcached $memcached A \Memcached instance + * @param array $options An associative array of Memcached options + * + * @throws \InvalidArgumentException When unsupported options are passed */ - public function __construct(\Memcached $memcached, array $memcachedOptions = array(), array $options = array()) + public function __construct(\Memcached $memcached, array $options = array()) { $this->memcached = $memcached; - // defaults - if (!isset($memcachedOptions['serverpool'])) { - $memcachedOptions['serverpool'][] = array( - 'host' => '127.0.0.1', - 'port' => 11211, - 'weight' => 1); + if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { + throw new \InvalidArgumentException(sprintf( + 'The following options are not supported "%s"', implode(', ', $diff) + )); } - $memcachedOptions['expiretime'] = isset($memcachedOptions['expiretime']) ? (int)$memcachedOptions['expiretime'] : 86400; - - $this->memcached->setOption(\Memcached::OPT_PREFIX_KEY, isset($memcachedOptions['prefix']) ? $memcachedOptions['prefix'] : 'sf2s'); - - $this->memcachedOptions = $memcachedOptions; + $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; + $this->prefix = isset($options['prefix']) ? $options['prefix'] : 'sf2s'; } /** - * {@inheritdoc} + * {@inheritDoc} */ public function open($savePath, $sessionName) { - return $this->memcached->addServers($this->memcachedOptions['serverpool']); + return true; } /** - * {@inheritdoc} + * {@inheritDoc} */ public function close() { @@ -80,51 +82,35 @@ class MemcachedSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function read($sessionId) { - return $this->memcached->get($sessionId) ?: ''; + return $this->memcached->get($this->prefix.$sessionId) ?: ''; } /** - * {@inheritdoc} + * {@inheritDoc} */ public function write($sessionId, $data) { - return $this->memcached->set($sessionId, $data, $this->memcachedOptions['expiretime']); + return $this->memcached->set($this->prefix.$sessionId, $data, time() + $this->ttl); } /** - * {@inheritdoc} + * {@inheritDoc} */ public function destroy($sessionId) { - return $this->memcached->delete($sessionId); + return $this->memcached->delete($this->prefix.$sessionId); } /** - * {@inheritdoc} + * {@inheritDoc} */ public function gc($lifetime) { // not required here because memcached will auto expire the records anyhow. return true; } - - /** - * Adds a server to the memcached handler. - * - * @param array $server - */ - protected function addServer(array $server) - { - if (array_key_exists('host', $server)) { - throw new \InvalidArgumentException('host key must be set'); - } - $server['port'] = isset($server['port']) ? (int)$server['port'] : 11211; - $server['timeout'] = isset($server['timeout']) ? (int)$server['timeout'] : 1; - $server['presistent'] = isset($server['presistent']) ? (bool)$server['presistent'] : false; - $server['weight'] = isset($server['weight']) ? (bool)$server['weight'] : 1; - } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php similarity index 27% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php index 71770dd..6006773 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/MongoDbSessionHandler.php @@ -12,67 +12,60 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** - * MemcachedSessionHandler. + * MongoDB session handler * - * Memcached based session storage handler based on the Memcached class - * provided by the PHP memcached extension. - * - * @see http://php.net/memcached - * - * @author Drak + * @author Markus Bachmann */ -class MemcachedSessionHandler implements \SessionHandlerInterface +class MongoDbSessionHandler implements \SessionHandlerInterface { /** - * Memcached driver. - * - * @var \Memcached + * @var \Mongo */ - private $memcached; + private $mongo; + + /** + * @var \MongoCollection + */ + private $collection; /** - * Configuration options. - * * @var array */ - private $memcachedOptions; + private $options; /** * Constructor. * - * @param \Memcached $memcached A \Memcached instance - * @param array $memcachedOptions An associative array of Memcached options - * @param array $options Session configuration options. + * @param \Mongo $mongo A "Mongo" instance + * @param array $options An associative array of field options + * + * @throws \InvalidArgumentException When "database" or "collection" not provided */ - public function __construct(\Memcached $memcached, array $memcachedOptions = array(), array $options = array()) + public function __construct(\Mongo $mongo, array $options) { - $this->memcached = $memcached; - - // defaults - if (!isset($memcachedOptions['serverpool'])) { - $memcachedOptions['serverpool'][] = array( - 'host' => '127.0.0.1', - 'port' => 11211, - 'weight' => 1); + if (!isset($options['database']) || !isset($options['collection'])) { + throw new \InvalidArgumentException('You must provide the "database" and "collection" option for MongoDBSessionHandler'); } - $memcachedOptions['expiretime'] = isset($memcachedOptions['expiretime']) ? (int)$memcachedOptions['expiretime'] : 86400; - - $this->memcached->setOption(\Memcached::OPT_PREFIX_KEY, isset($memcachedOptions['prefix']) ? $memcachedOptions['prefix'] : 'sf2s'); + $this->mongo = $mongo; - $this->memcachedOptions = $memcachedOptions; + $this->options = array_merge(array( + 'id_field' => 'sess_id', + 'data_field' => 'sess_data', + 'time_field' => 'sess_time', + ), $options); } /** - * {@inheritdoc} + * {@inheritDoc} */ public function open($savePath, $sessionName) { - return $this->memcached->addServers($this->memcachedOptions['serverpool']); + return true; } /** - * {@inheritdoc} + * {@inheritDoc} */ public function close() { @@ -80,51 +73,73 @@ class MemcachedSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ - public function read($sessionId) + public function destroy($sessionId) { - return $this->memcached->get($sessionId) ?: ''; + $this->getCollection()->remove( + array($this->options['id_field'] => $sessionId), + array('justOne' => true) + ); + + return true; } /** - * {@inheritdoc} + * {@inheritDoc} */ - public function write($sessionId, $data) + public function gc($lifetime) { - return $this->memcached->set($sessionId, $data, $this->memcachedOptions['expiretime']); + $time = new \MongoTimestamp(time() - $lifetime); + + $this->getCollection()->remove(array( + $this->options['time_field'] => array('$lt' => $time), + )); } /** - * {@inheritdoc} + * {@inheritDoc] */ - public function destroy($sessionId) + public function write($sessionId, $data) { - return $this->memcached->delete($sessionId); + $data = array( + $this->options['id_field'] => $sessionId, + $this->options['data_field'] => new \MongoBinData($data), + $this->options['time_field'] => new \MongoTimestamp() + ); + + $this->getCollection()->update( + array($this->options['id_field'] => $sessionId), + array('$set' => $data), + array('upsert' => true) + ); + + return true; } /** - * {@inheritdoc} + * {@inheritDoc} */ - public function gc($lifetime) + public function read($sessionId) { - // not required here because memcached will auto expire the records anyhow. - return true; + $dbData = $this->getCollection()->findOne(array( + $this->options['id_field'] => $sessionId, + )); + + return null === $dbData ? '' : $dbData[$this->options['data_field']]->bin; } /** - * Adds a server to the memcached handler. + * Return a "MongoCollection" instance * - * @param array $server + * @return \MongoCollection */ - protected function addServer(array $server) + private function getCollection() { - if (array_key_exists('host', $server)) { - throw new \InvalidArgumentException('host key must be set'); + if (null === $this->collection) { + $this->collection = $this->mongo->selectDB($this->options['database'])->selectCollection($this->options['collection']); } - $server['port'] = isset($server['port']) ? (int)$server['port'] : 11211; - $server['timeout'] = isset($server['timeout']) ? (int)$server['timeout'] : 1; - $server['presistent'] = isset($server['presistent']) ? (bool)$server['presistent'] : false; - $server['weight'] = isset($server['weight']) ? (bool)$server['weight'] : 1; + + return $this->collection; } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php similarity index 92% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php index dd9f0c7..62068af 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/NullSessionHandler.php @@ -14,7 +14,7 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; /** * NullSessionHandler. * - * Can be used in unit testing or in a sitation where persisted sessions are not desired. + * Can be used in unit testing or in a situations where persisted sessions are not desired. * * @author Drak * diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php similarity index 65% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php index 28dccba..9c4c5aa 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php @@ -20,30 +20,30 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; class PdoSessionHandler implements \SessionHandlerInterface { /** - * PDO instance. - * - * @var \PDO + * @var \PDO PDO instance. */ private $pdo; /** - * Database options. - * - * - * @var array + * @var array Database options. */ private $dbOptions; /** * Constructor. * + * List of available options: + * * db_table: The name of the table [required] + * * db_id_col: The column where to store the session id [default: sess_id] + * * db_data_col: The column where to store the session data [default: sess_data] + * * db_time_col: The column where to store the timestamp [default: sess_time] + * * @param \PDO $pdo A \PDO instance * @param array $dbOptions An associative array of DB options - * @param array $options Session configuration options * * @throws \InvalidArgumentException When "db_table" option is not provided */ - public function __construct(\PDO $pdo, array $dbOptions = array(), array $options = array()) + public function __construct(\PDO $pdo, array $dbOptions = array()) { if (!array_key_exists('db_table', $dbOptions)) { throw new \InvalidArgumentException('You must provide the "db_table" option for a PdoSessionStorage.'); @@ -58,7 +58,7 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function open($path, $name) { @@ -66,7 +66,7 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function close() { @@ -74,12 +74,12 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function destroy($id) { // get table/column - $dbTable = $this->dbOptions['db_table']; + $dbTable = $this->dbOptions['db_table']; $dbIdCol = $this->dbOptions['db_id_col']; // delete the record associated with this id @@ -97,20 +97,20 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function gc($lifetime) { // get table/column - $dbTable = $this->dbOptions['db_table']; + $dbTable = $this->dbOptions['db_table']; $dbTimeCol = $this->dbOptions['db_time_col']; // delete the session records that have expired - $sql = "DELETE FROM $dbTable WHERE $dbTimeCol < (:time - $lifetime)"; + $sql = "DELETE FROM $dbTable WHERE $dbTimeCol < :time"; try { $stmt = $this->pdo->prepare($sql); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); + $stmt->bindValue(':time', time() - $lifetime, \PDO::PARAM_INT); $stmt->execute(); } catch (\PDOException $e) { throw new \RuntimeException(sprintf('PDOException was thrown when trying to manipulate session data: %s', $e->getMessage()), 0, $e); @@ -120,12 +120,12 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function read($id) { // get table/columns - $dbTable = $this->dbOptions['db_table']; + $dbTable = $this->dbOptions['db_table']; $dbDataCol = $this->dbOptions['db_data_col']; $dbIdCol = $this->dbOptions['db_id_col']; @@ -154,7 +154,7 @@ class PdoSessionHandler implements \SessionHandlerInterface } /** - * {@inheritdoc} + * {@inheritDoc} */ public function write($id, $data) { @@ -164,27 +164,37 @@ class PdoSessionHandler implements \SessionHandlerInterface $dbIdCol = $this->dbOptions['db_id_col']; $dbTimeCol = $this->dbOptions['db_time_col']; - $sql = ('mysql' === $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME)) - ? "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time) " - ."ON DUPLICATE KEY UPDATE $dbDataCol = VALUES($dbDataCol), $dbTimeCol = CASE WHEN $dbTimeCol = :time THEN (VALUES($dbTimeCol) + 1) ELSE VALUES($dbTimeCol) END" - : "UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id"; + //session data can contain non binary safe characters so we need to encode it + $encoded = base64_encode($data); try { - //session data can contain non binary safe characters so we need to encode it - $encoded = base64_encode($data); - $stmt = $this->pdo->prepare($sql); - $stmt->bindParam(':id', $id, \PDO::PARAM_STR); - $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR); - $stmt->bindValue(':time', time(), \PDO::PARAM_INT); - $stmt->execute(); - - if (!$stmt->rowCount()) { - // No session exists in the database to update. This happens when we have called - // session_regenerate_id() - $this->createNewSession($id, $data); + if ('mysql' === $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME)) { + // MySQL would report $stmt->rowCount() = 0 on UPDATE when the data is left unchanged + // it could result in calling createNewSession() whereas the session already exists in + // the DB which would fail as the id is unique + $stmt = $this->pdo->prepare( + "INSERT INTO $dbTable ($dbIdCol, $dbDataCol, $dbTimeCol) VALUES (:id, :data, :time) " . + "ON DUPLICATE KEY UPDATE $dbDataCol = VALUES($dbDataCol), $dbTimeCol = VALUES($dbTimeCol)" + ); + $stmt->bindParam(':id', $id, \PDO::PARAM_STR); + $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $stmt->bindValue(':time', time(), \PDO::PARAM_INT); + $stmt->execute(); + } else { + $stmt = $this->pdo->prepare("UPDATE $dbTable SET $dbDataCol = :data, $dbTimeCol = :time WHERE $dbIdCol = :id"); + $stmt->bindParam(':id', $id, \PDO::PARAM_STR); + $stmt->bindParam(':data', $encoded, \PDO::PARAM_STR); + $stmt->bindValue(':time', time(), \PDO::PARAM_INT); + $stmt->execute(); + + if (!$stmt->rowCount()) { + // No session exists in the database to update. This happens when we have called + // session_regenerate_id() + $this->createNewSession($id, $data); + } } } catch (\PDOException $e) { - throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e); + throw new \RuntimeException(sprintf('PDOException was thrown when trying to write the session data: %s', $e->getMessage()), 0, $e); } return true; @@ -201,7 +211,7 @@ class PdoSessionHandler implements \SessionHandlerInterface private function createNewSession($id, $data = '') { // get table/column - $dbTable = $this->dbOptions['db_table']; + $dbTable = $this->dbOptions['db_table']; $dbDataCol = $this->dbOptions['db_data_col']; $dbIdCol = $this->dbOptions['db_id_col']; $dbTimeCol = $this->dbOptions['db_time_col']; diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MetadataBag.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php similarity index 99% copy from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php index 5500a03..4572552 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php @@ -61,7 +61,7 @@ class MockArraySessionStorage implements SessionStorageInterface /** * Constructor. * - * @param string $name Session name + * @param string $name Session name * @param MetadataBag $metaBag MetadataBag instance. */ public function __construct($name = 'MOCKSESSID', MetadataBag $metaBag = null) diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php similarity index 62% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php index 5bf2962..23b86b3 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php @@ -11,6 +11,9 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; + /** * MockFileSessionStorage is used to mock sessions for * functional testing when done in a single PHP process. @@ -25,31 +28,27 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; class MockFileSessionStorage extends MockArraySessionStorage { /** - * @var string + * @var FileSessionHandler */ - private $savePath; - - private $sessionData; + private $handler; /** * Constructor. * - * @param string $savePath Path of directory to save session files. - * @param string $name Session name. + * @param string $savePath Path of directory to save session files. + * @param string $name Session name. + * @param FileSessionHandler $handler Save handler + * @param MetadataBag $metaData Metadatabag */ - public function __construct($savePath = null, $name = 'MOCKSESSID') + public function __construct($savePath = null, $name = 'MOCKSESSID', FileSessionHandler $handler = null, MetadataBag $metaData = null) { - if (null === $savePath) { - $savePath = sys_get_temp_dir(); - } - - if (!is_dir($savePath)) { - mkdir($savePath, 0777, true); + if (null == $handler) { + $handler = new FileSessionHandler($savePath, 'mocksess_'); } - $this->savePath = $savePath; + $this->handler = $handler; - parent::__construct($name); + parent::__construct($name, $metaData); } /** @@ -93,7 +92,12 @@ class MockFileSessionStorage extends MockArraySessionStorage */ public function save() { - file_put_contents($this->getFilePath(), serialize($this->data)); + $this->handler->write($this->id, serialize($this->data)); + + // this is needed for Silex, where the session object is re-used across requests + // in functional tests. In Symfony, the container is rebooted, so we don't have + // this issue + $this->started = false; } /** @@ -102,19 +106,7 @@ class MockFileSessionStorage extends MockArraySessionStorage */ private function destroy() { - if (is_file($this->getFilePath())) { - unlink($this->getFilePath()); - } - } - - /** - * Calculate path to file. - * - * @return string File path - */ - private function getFilePath() - { - return $this->savePath.'/'.$this->id.'.mocksess'; + $this->handler->destroy($this->id); } /** @@ -122,8 +114,8 @@ class MockFileSessionStorage extends MockArraySessionStorage */ private function read() { - $filePath = $this->getFilePath(); - $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); + $data = $this->handler->read($this->id); + $this->data = $data ? unserialize($data) : array(); $this->loadSession(); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php index 215ed26..7a9d775 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php @@ -89,8 +89,8 @@ class NativeSessionStorage implements SessionStorageInterface * upload_progress.min-freq, "1" * url_rewriter.tags, "a=href,area=href,frame=src,form=,fieldset=" * - * @param array $options Session configuration options. - * @param object $handler SessionHandlerInterface. + * @param array $options Session configuration options. + * @param object $handler SessionHandlerInterface. * @param MetadataBag $handler MetadataBag. */ public function __construct(array $options = array(), $handler = null, MetadataBag $metaBag = null) diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/AbstractProxy.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/NativeProxy.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index 20c533c..c07ed7f 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -82,7 +82,7 @@ interface SessionStorageInterface * Note regenerate+destroy should not clear the session data in memory * only delete the session data from persistent storage. * - * @param Boolean $destroy Destroy session when regenerating? + * @param Boolean $destroy Destroy session when regenerating? * @param integer $lifetime Sets the cookie lifetime for the session cookie. A null value * will leave the system settings unchanged, 0 sets the cookie * to expire with browser session. Time is in seconds, and is diff --git a/core/vendor/Symfony/Component/HttpFoundation/StreamedResponse.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/StreamedResponse.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/StreamedResponse.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/ApacheRequestTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ApacheRequestTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/ApacheRequestTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ApacheRequestTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/CookieTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/CookieTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/CookieTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/FileTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/File/FileTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/FileTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/.unknownextension b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/.unknownextension similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/.unknownextension rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/.unknownextension diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/directory/.empty b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/directory/.empty similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/directory/.empty rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/directory/.empty diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test.gif b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test.gif similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test.gif rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/Fixtures/test.gif diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php index 2990c21..7bf10a2 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php @@ -84,7 +84,7 @@ class MimeTypeTest extends \PHPUnit_Framework_TestCase $path = __DIR__.'/../Fixtures/to_delete'; touch($path); - chmod($path, 0333); + @chmod($path, 0333); if (get_current_user() != 'root' && substr(sprintf('%o', fileperms($path)), -4) == '0333') { $this->setExpectedException('Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException'); @@ -98,7 +98,7 @@ class MimeTypeTest extends \PHPUnit_Framework_TestCase { $path = __DIR__.'/../Fixtures/to_delete'; if (file_exists($path)) { - chmod($path, 0666); + @chmod($path, 0666); @unlink($path); } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/FileBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/FileBagTest.php similarity index 91% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/FileBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/FileBagTest.php index 5042506..1f29d56 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/FileBagTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/FileBagTest.php @@ -129,6 +129,20 @@ class FileBagTest extends \PHPUnit_Framework_TestCase protected function createTempFile() { - return tempnam(sys_get_temp_dir(), 'FormTest'); + return tempnam(sys_get_temp_dir().'/form_test', 'FormTest'); + } + + protected function setUp() + { + mkdir(sys_get_temp_dir().'/form_test', 0777, true); + } + + protected function tearDown() + { + foreach (glob(sys_get_temp_dir().'/form_test/*') as $file) { + unlink($file); + } + + rmdir(sys_get_temp_dir().'/form_test'); } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/HeaderBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php similarity index 94% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php index 16ad0d6..a89da93 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/JsonResponseTest.php @@ -104,4 +104,11 @@ class JsonResponseTest extends \PHPUnit_Framework_TestCase $this->setExpectedException('InvalidArgumentException'); $response->setCallback('+invalid'); } + + public function testJsonEncodeFlags() + { + $response = new JsonResponse('<>\'&"'); + + $this->assertEquals('"\u003C\u003E\u0027\u0026\u0022"', $response->getContent()); + } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RedirectResponseTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php similarity index 99% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/RequestTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 84f19a2..9d943ef 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -552,7 +552,6 @@ class RequestTest extends \PHPUnit_Framework_TestCase { $request = new Request(); $this->assertEquals('', $request->getClientIp()); - $this->assertEquals('', $request->getClientIp(true)); $server = array('REMOTE_ADDR' => $remoteAddr); if (null !== $httpClientIp) { @@ -584,6 +583,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase array('2620:0:1cfe:face:b00c::3', true, '::1', '2620:0:1cfe:face:b00c::3', null), array('2620:0:1cfe:face:b00c::3', true, '::1', null, '2620:0:1cfe:face:b00c::3, ::1'), array('88.88.88.88', true, '123.45.67.89', null, '88.88.88.88, 87.65.43.21, 127.0.0.1'), + array('88.88.88.88', true, '123.45.67.89', null, 'unknown, 88.88.88.88'), ); } @@ -1053,7 +1053,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase array('fo%2Bo/bar', 'fo+o', 'fo%2Bo'), ); } - + private function stopTrustingProxyData() { $class = new \ReflectionClass('Symfony\\Component\\HttpFoundation\\Request'); diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/ResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php similarity index 98% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/ResponseTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php index 6e76cd2..4edcd6d 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/ResponseTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ResponseTest.php @@ -352,14 +352,14 @@ class ResponseTest extends \PHPUnit_Framework_TestCase try { $response->setStatusCode(99); $this->fail(); - } catch(\InvalidArgumentException $e) { + } catch (\InvalidArgumentException $e) { $this->assertTrue($response->isInvalid()); } try { $response->setStatusCode(650); $this->fail(); - } catch(\InvalidArgumentException $e) { + } catch (\InvalidArgumentException $e) { $this->assertTrue($response->isInvalid()); } @@ -378,8 +378,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase public function testIsRedirectRedirection() { - foreach (array(301, 302, 303, 307) as $code) - { + foreach (array(301, 302, 303, 307) as $code) { $response = new Response('', $code); $this->assertTrue($response->isRedirection()); $this->assertTrue($response->isRedirect()); @@ -413,8 +412,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase public function testIsEmpty() { - foreach (array(201, 204, 304) as $code) - { + foreach (array(201, 204, 304) as $code) { $response = new Response('', $code); $this->assertTrue($response->isEmpty()); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php similarity index 43% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php index b99ad1c..f8e487d 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/ServerBagTest.php @@ -40,6 +40,8 @@ class ServerBagTest extends \PHPUnit_Framework_TestCase 'CONTENT_LENGTH' => '0', 'ETAG' => 'asdf', 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => 'bar', ), $bag->getHeaders()); } @@ -47,6 +49,53 @@ class ServerBagTest extends \PHPUnit_Framework_TestCase { $bag = new ServerBag(array('PHP_AUTH_USER' => 'foo')); - $this->assertEquals(array('AUTHORIZATION' => 'Basic '.base64_encode('foo:')), $bag->getHeaders()); + $this->assertEquals(array( + 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => '' + ), $bag->getHeaders()); + } + + public function testHttpBasicAuthWithPhpCgi() + { + $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'))); + + $this->assertEquals(array( + 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => 'bar' + ), $bag->getHeaders()); + } + + public function testHttpBasicAuthWithPhpCgiRedirect() + { + $bag = new ServerBag(array('REDIRECT_HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'))); + + $this->assertEquals(array( + 'AUTHORIZATION' => 'Basic '.base64_encode('foo:bar'), + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => 'bar' + ), $bag->getHeaders()); + } + + public function testHttpBasicAuthWithPhpCgiEmptyPassword() + { + $bag = new ServerBag(array('HTTP_AUTHORIZATION' => 'Basic '.base64_encode('foo:'))); + + $this->assertEquals(array( + 'AUTHORIZATION' => 'Basic '.base64_encode('foo:'), + 'PHP_AUTH_USER' => 'foo', + 'PHP_AUTH_PW' => '' + ), $bag->getHeaders()); + } + + public function testOAuthBearerAuth() + { + $headerContent = 'Bearer L-yLEOr9zhmUYRkzN1jwwxwQ-PBNiKDc8dgfB4hTfvo'; + $bag = new ServerBag(array('HTTP_AUTHORIZATION' => $headerContent)); + + $this->assertEquals(array( + 'AUTHORIZATION' => $headerContent, + ), $bag->getHeaders()); } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Attribute/AttributeBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php similarity index 100% copy from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php similarity index 100% copy from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Flash/FlashBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php similarity index 92% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php index bd45b2f..2f2b26f 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/SessionTest.php @@ -183,6 +183,21 @@ class SessionTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('notice' => 'foo'), $this->session->getFlashes()); } + public function testGetFlashesWithArray() + { + $array = array('notice' => 'hello', 'error' => 'none'); + $this->assertEquals(array(), $this->session->getFlashes()); + $this->session->setFlash('foo', $array); + $this->assertEquals(array('foo' => $array), $this->session->getFlashes()); + $this->assertEquals(array(), $this->session->getFlashes()); + + $array = array('hello', 'foo'); + $this->assertEquals(array(), $this->session->getFlashes()); + $this->session->setFlash('foo', $array); + $this->assertEquals(array('foo' => 'hello'), $this->session->getFlashes()); + $this->assertEquals(array(), $this->session->getFlashes()); + } + public function testGetSetFlash() { $this->assertNull($this->session->getFlash('notice')); diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php similarity index 21% copy from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php index bae5390..d935b34 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php @@ -9,114 +9,98 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; /** - * Tests for SessionHandlerProxy class. + * Test class for FileSessionHandler. * * @author Drak - * - * @runTestsInSeparateProcesses */ -class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase +class FileSessionStorageTest extends \PHPUnit_Framework_TestCase { /** - * @var PHPUnit_Framework_MockObject_Matcher + * @var FileSessionHandler */ - private $mock; + private $handler; /** - * @var SessionHandlerProxy + * @var string */ - private $proxy; + private $path; - protected function setUp() + public function setUp() { - $this->mock = $this->getMock('SessionHandlerInterface'); - $this->proxy = new SessionHandlerProxy($this->mock); - } + $this->path = sys_get_temp_dir().'/filesessionhandler'; + $this->handler = new FileSessionHandler($this->path, 'mocksess_'); - protected function tearDown() - { - $this->mock = null; - $this->proxy = null; + parent::setUp(); } - public function testOpen() + public function tearDown() { - $this->mock->expects($this->once()) - ->method('open') - ->will($this->returnValue(true)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->open('name', 'id'); - $this->assertTrue($this->proxy->isActive()); - } + foreach (glob($this->path.'/*') as $file) { + unlink($file); + } - public function testOpenFalse() - { - $this->mock->expects($this->once()) - ->method('open') - ->will($this->returnValue(false)); + rmdir($this->path); - $this->assertFalse($this->proxy->isActive()); - $this->proxy->open('name', 'id'); - $this->assertFalse($this->proxy->isActive()); + $this->handler = null; } - public function testClose() + public function test__construct() { - $this->mock->expects($this->once()) - ->method('close') - ->will($this->returnValue(true)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->close(); - $this->assertFalse($this->proxy->isActive()); + $this->assertTrue(is_dir($this->path)); } - public function testCloseFalse() + public function testOpen() { - $this->mock->expects($this->once()) - ->method('close') - ->will($this->returnValue(false)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->close(); - $this->assertFalse($this->proxy->isActive()); + $this->assertTrue($this->handler->open('a', 'b')); } - public function testRead() + public function testClose() { - $this->mock->expects($this->once()) - ->method('read'); - - $this->proxy->read('id'); + $this->assertTrue($this->handler->close()); } - public function testWrite() + public function testReadWrite() { - $this->mock->expects($this->once()) - ->method('write'); - - $this->proxy->write('id', 'data'); + $this->assertEmpty($this->handler->read('123')); + $this->assertTrue($this->handler->write('123', 'data')); + $this->assertEquals('data', $this->handler->read('123')); } public function testDestroy() { - $this->mock->expects($this->once()) - ->method('destroy'); - - $this->proxy->destroy('id'); + $this->handler->write('456', 'data'); + $this->handler->destroy('123'); + $this->assertEquals('data', $this->handler->read('456')); + $this->handler->destroy('456'); + $this->assertEmpty($this->handler->read('456')); } public function testGc() { - $this->mock->expects($this->once()) - ->method('gc'); + $prefix = $this->path.'/mocksess_'; + $this->handler->write('1', 'data'); + touch($prefix.'1', time()-86400); + + $this->handler->write('2', 'data'); + touch($prefix.'2', time()-3600); + + $this->handler->write('3', 'data'); + touch($prefix.'3', time()-300); + + $this->handler->write('4', 'data'); + + $this->handler->gc(90000); + $this->assertEquals(4, count(glob($this->path.'/*'))); + + $this->handler->gc(4000); + $this->assertEquals(3, count(glob($this->path.'/*'))); - $this->proxy->gc(86400); + $this->handler->gc(200); + $this->assertEquals(1, count(glob($this->path.'/*'))); } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php similarity index 43% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php index 49e1568..da0440d 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php @@ -15,6 +15,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHand class MemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase { + const PREFIX = 'prefix_'; + const TTL = 1000; /** * @var MemcacheSessionHandler */ @@ -29,7 +31,10 @@ class MemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase } $this->memcache = $this->getMock('Memcache'); - $this->storage = new MemcacheSessionHandler($this->memcache); + $this->storage = new MemcacheSessionHandler( + $this->memcache, + array('prefix' => self::PREFIX, 'expiretime' => self::TTL) + ); } protected function tearDown() @@ -40,82 +45,53 @@ class MemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testOpenSession() { - $this->memcache->expects($this->atLeastOnce()) - ->method('addServer') - ->with('127.0.0.1', 11211, false, 1, 1, 15); - $this->assertTrue($this->storage->open('', '')); } - public function testConstructingWithServerPool() - { - $mock = $this->getMock('Memcache'); - - $storage = new MemcacheSessionHandler($mock, array( - 'serverpool' => array( - array('host' => '127.0.0.2'), - array('host' => '127.0.0.3', - 'port' => 11212, - 'timeout' => 10, - 'persistent' => true, - 'weight' => 5, - 'retry_interval' => 39, - ), - array('host' => '127.0.0.4', - 'port' => 11211, - 'weight' => 2 - ), - ), - )); - - $matcher = $mock - ->expects($this->at(0)) - ->method('addServer') - ->with('127.0.0.2', 11211, false, 1, 1, 15); - $matcher = $mock - ->expects($this->at(1)) - ->method('addServer') - ->with('127.0.0.3', 11212, true, 5, 10, 39); - $matcher = $mock - ->expects($this->at(2)) - ->method('addServer') - ->with('127.0.0.4', 11211, false, 2, 1, 15); - $this->assertTrue($storage->open('', '')); - } - public function testCloseSession() { - $this->memcache->expects($this->once()) + $this->memcache + ->expects($this->once()) ->method('close') - ->will($this->returnValue(true)); + ->will($this->returnValue(true)) + ; $this->assertTrue($this->storage->close()); } public function testReadSession() { - $this->memcache->expects($this->once()) - ->method('get'); + $this->memcache + ->expects($this->once()) + ->method('get') + ->with(self::PREFIX.'id') + ; - $this->assertEquals('', $this->storage->read('')); + $this->assertEquals('', $this->storage->read('id')); } public function testWriteSession() { - $this->memcache->expects($this->once()) + $this->memcache + ->expects($this->once()) ->method('set') - ->will($this->returnValue(true)); + ->with(self::PREFIX.'id', 'data', 0, $this->equalTo(time() + self::TTL, 2)) + ->will($this->returnValue(true)) + ; - $this->assertTrue($this->storage->write('', '')); + $this->assertTrue($this->storage->write('id', 'data')); } public function testDestroySession() { - $this->memcache->expects($this->once()) + $this->memcache + ->expects($this->once()) ->method('delete') - ->will($this->returnValue(true)); + ->with(self::PREFIX.'id') + ->will($this->returnValue(true)) + ; - $this->assertTrue($this->storage->destroy('')); + $this->assertTrue($this->storage->destroy('id')); } public function testGcSession() @@ -123,4 +99,26 @@ class MemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->storage->gc(123)); } + /** + * @dataProvider getOptionFixtures + */ + public function testSupportedOptions($options, $supported) + { + try { + new MemcacheSessionHandler($this->memcache, $options); + $this->assertTrue($supported); + } catch (\InvalidArgumentException $e) { + $this->assertFalse($supported); + } + } + + public function getOptionFixtures() + { + return array( + array(array('prefix' => 'session'), true), + array(array('expiretime' => 100), true), + array(array('prefix' => 'session', 'expiretime' => 200), true), + array(array('expiretime' => 100, 'foo' => 'bar'), false), + ); + } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php similarity index 47% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 5731d92..6f158cd 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -15,6 +15,9 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHan class MemcacheddSessionHandlerTest extends \PHPUnit_Framework_TestCase { + const PREFIX = 'prefix_'; + const TTL = 1000; + /** * @var MemcachedSessionHandler */ @@ -29,7 +32,10 @@ class MemcacheddSessionHandlerTest extends \PHPUnit_Framework_TestCase } $this->memcached = $this->getMock('Memcached'); - $this->storage = new MemcachedSessionHandler($this->memcached); + $this->storage = new MemcachedSessionHandler( + $this->memcached, + array('prefix' => self::PREFIX, 'expiretime' => self::TTL) + ); } protected function tearDown() @@ -40,10 +46,6 @@ class MemcacheddSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testOpenSession() { - $this->memcached->expects($this->atLeastOnce()) - ->method('addServers') - ->will($this->returnValue(true)); - $this->assertTrue($this->storage->open('', '')); } @@ -54,28 +56,37 @@ class MemcacheddSessionHandlerTest extends \PHPUnit_Framework_TestCase public function testReadSession() { - $this->memcached->expects($this->once()) - ->method('get'); + $this->memcached + ->expects($this->once()) + ->method('get') + ->with(self::PREFIX.'id') + ; - $this->assertEquals('', $this->storage->read('')); + $this->assertEquals('', $this->storage->read('id')); } public function testWriteSession() { - $this->memcached->expects($this->once()) + $this->memcached + ->expects($this->once()) ->method('set') - ->will($this->returnValue(true)); + ->with(self::PREFIX.'id', 'data', $this->equalTo(time() + self::TTL, 2)) + ->will($this->returnValue(true)) + ; - $this->assertTrue($this->storage->write('', '')); + $this->assertTrue($this->storage->write('id', 'data')); } public function testDestroySession() { - $this->memcached->expects($this->once()) + $this->memcached + ->expects($this->once()) ->method('delete') - ->will($this->returnValue(true)); + ->with(self::PREFIX.'id') + ->will($this->returnValue(true)) + ; - $this->assertTrue($this->storage->destroy('')); + $this->assertTrue($this->storage->destroy('id')); } public function testGcSession() @@ -83,5 +94,26 @@ class MemcacheddSessionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertTrue($this->storage->gc(123)); } + /** + * @dataProvider getOptionFixtures + */ + public function testSupportedOptions($options, $supported) + { + try { + new MemcachedSessionHandler($this->memcached, $options); + $this->assertTrue($supported); + } catch (\InvalidArgumentException $e) { + $this->assertFalse($supported); + } + } + public function getOptionFixtures() + { + return array( + array(array('prefix' => 'session'), true), + array(array('expiretime' => 100), true), + array(array('prefix' => 'session', 'expiretime' => 200), true), + array(array('expiretime' => 100, 'foo' => 'bar'), false), + ); + } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php similarity index 20% copy from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php copy to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index bae5390..c9eb0b3 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -9,114 +9,91 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Proxy; +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; -use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler; /** - * Tests for SessionHandlerProxy class. - * - * @author Drak - * - * @runTestsInSeparateProcesses + * @author Markus Bachmann */ -class SessionHandlerProxyTest extends \PHPUnit_Framework_TestCase +class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase { - /** - * @var PHPUnit_Framework_MockObject_Matcher - */ - private $mock; - - /** - * @var SessionHandlerProxy - */ - private $proxy; + private static $mongo; - protected function setUp() + public static function setUpBeforeClass() { - $this->mock = $this->getMock('SessionHandlerInterface'); - $this->proxy = new SessionHandlerProxy($this->mock); + if (class_exists('\Mongo')) { + try { + self::$mongo = new \Mongo(); + } catch (\Exception $e) { + } + } } - protected function tearDown() + protected function setUp() { - $this->mock = null; - $this->proxy = null; - } + if (null === self::$mongo) { + $this->markTestSkipped('MongoDbSessionHandler requires the php "mongo" extension and a mongodb server on localhost'); + } - public function testOpen() - { - $this->mock->expects($this->once()) - ->method('open') - ->will($this->returnValue(true)); + $this->options = array('database' => 'sf2-test', 'collection' => 'session-test'); + $this->options = array('database' => 'sf2-test', 'collection' => 'session-test'); - $this->assertFalse($this->proxy->isActive()); - $this->proxy->open('name', 'id'); - $this->assertTrue($this->proxy->isActive()); + $this->storage = new MongoDbSessionHandler(self::$mongo, $this->options); } - public function testOpenFalse() + protected function tearDown() { - $this->mock->expects($this->once()) - ->method('open') - ->will($this->returnValue(false)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->open('name', 'id'); - $this->assertFalse($this->proxy->isActive()); + if (null !== self::$mongo) { + self::$mongo->dropDB($this->options['database']); + } } - public function testClose() + public function testOpenMethodAlwaysReturnTrue() { - $this->mock->expects($this->once()) - ->method('close') - ->will($this->returnValue(true)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->close(); - $this->assertFalse($this->proxy->isActive()); + $this->assertTrue($this->storage->open('test', 'test'), 'The "open" method should always return true'); } - public function testCloseFalse() + public function testCloseMethodAlwaysReturnTrue() { - $this->mock->expects($this->once()) - ->method('close') - ->will($this->returnValue(false)); - - $this->assertFalse($this->proxy->isActive()); - $this->proxy->close(); - $this->assertFalse($this->proxy->isActive()); + $this->assertTrue($this->storage->close(), 'The "close" method should always return true'); } - public function testRead() + public function testWrite() { - $this->mock->expects($this->once()) - ->method('read'); - - $this->proxy->read('id'); + $this->assertTrue($this->storage->write('foo', 'bar')); + $this->assertEquals('bar', $this->storage->read('foo')); } - public function testWrite() + public function testReplaceSessionData() { - $this->mock->expects($this->once()) - ->method('write'); + $this->storage->write('foo', 'bar'); + $this->storage->write('foo', 'foobar'); + + $coll = self::$mongo->selectDB($this->options['database'])->selectCollection($this->options['collection']); - $this->proxy->write('id', 'data'); + $this->assertEquals('foobar', $this->storage->read('foo')); + $this->assertEquals(1, $coll->find(array('sess_id' => 'foo'))->count()); } public function testDestroy() { - $this->mock->expects($this->once()) - ->method('destroy'); + $this->storage->write('foo', 'bar'); + $this->storage->destroy('foo'); - $this->proxy->destroy('id'); + $this->assertEquals('', $this->storage->read('foo')); } public function testGc() { - $this->mock->expects($this->once()) - ->method('gc'); + $this->storage->write('foo', 'bar'); + $this->storage->write('bar', 'foo'); + + $coll = self::$mongo->selectDB($this->options['database'])->selectCollection($this->options['collection']); + + $this->assertEquals(2, $coll->count()); + $this->storage->gc(-1); + $this->assertEquals(0, $coll->count()); - $this->proxy->gc(86400); } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockArraySessionStorageTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php similarity index 92% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php index 9578ec9..7bfe6a7 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -28,7 +28,7 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase private $sessionDir; /** - * @var FileMockSessionStorage + * @var MockFileSessionStorage */ protected $storage; @@ -40,12 +40,14 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase protected function tearDown() { + foreach (glob($this->sessionDir.'/mocksess_*') as $file) { + unlink($file); + } + + rmdir($this->sessionDir); + $this->sessionDir = null; $this->storage = null; - array_map('unlink', glob($this->sessionDir.'/*.session')); - if (is_dir($this->sessionDir)) { - rmdir($this->sessionDir); - } } public function testStart() @@ -109,8 +111,8 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase private function getStorage() { $storage = new MockFileSessionStorage($this->sessionDir); - $storage->registerBag(new FlashBag); - $storage->registerBag(new AttributeBag); + $storage->registerBag(new FlashBag()); + $storage->registerBag(new AttributeBag()); return $storage; } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php similarity index 96% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 4b88a23..528a1d7 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; @@ -137,8 +136,8 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } + ini_set('session.save_handler', 'files'); $storage = $this->getStorage(); - $storage->setSaveHandler(new NativeFileSessionHandler()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/AbstractProxyTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/NativeProxyTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php similarity index 93% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php index d95c937..2d8654e 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/StreamedResponseTest.php @@ -50,6 +50,14 @@ class StreamedResponseTest extends \PHPUnit_Framework_TestCase $this->assertEquals('no-cache, private', $response->headers->get('Cache-Control')); } + public function testPrepareWithHeadRequest() + { + $response = new StreamedResponse(function () { echo 'foo'; }); + $request = Request::create('/', 'HEAD'); + + $response->prepare($request); + } + public function testSendContent() { $called = 0; diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/bootstrap.php b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/bootstrap.php similarity index 100% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/bootstrap.php rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Tests/bootstrap.php diff --git a/core/vendor/Symfony/Component/HttpFoundation/composer.json b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/composer.json similarity index 97% rename from core/vendor/Symfony/Component/HttpFoundation/composer.json rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/composer.json index d0f1015..4e4f907 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/composer.json +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, "autoload": { "psr-0": { diff --git a/core/vendor/Symfony/Component/HttpFoundation/phpunit.xml.dist b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/phpunit.xml.dist similarity index 94% rename from core/vendor/Symfony/Component/HttpFoundation/phpunit.xml.dist rename to core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/phpunit.xml.dist index 95e0f03..2a760f2 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/phpunit.xml.dist +++ b/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/phpunit.xml.dist @@ -23,6 +23,7 @@ ./Resources ./Tests + ./vendor diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/.gitignore b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/core/vendor/Symfony/Component/HttpKernel/Bundle/Bundle.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/Bundle.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Bundle/Bundle.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/Bundle.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php similarity index 90% rename from core/vendor/Symfony/Component/HttpKernel/Bundle/BundleInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 99d591f..980b890 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -11,7 +11,9 @@ namespace Symfony\Component\HttpKernel\Bundle; +use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; /** * BundleInterface. @@ -20,7 +22,7 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; * * @api */ -interface BundleInterface +interface BundleInterface extends ContainerAwareInterface { /** * Boots the Bundle. diff --git a/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md new file mode 100644 index 0000000..d061c7d --- /dev/null +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CHANGELOG.md @@ -0,0 +1,19 @@ +CHANGELOG +========= + +2.1.0 +----- + + * added the HTTP method to the profiler storage + * updated all listeners to implement EventSubscriberInterface + * added TimeDataCollector + * added ContainerAwareTraceableEventDispatcher + * moved TraceableEventDispatcherInterface to the EventDispatcher component + * added RouterListener, LocaleListener, and StreamedResponseListener + * added CacheClearerInterface (and ChainCacheClearer) + * added a kernel.terminate event (via TerminableInterface and PostResponseEvent) + * added a Stopwatch class + * added WarmableInterface + * improved extensibility between bundles + * added profiler storages for Memcache(d), File-based, MongoDB, Redis + * moved Filesystem class to its own component diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheClearer/ChainCacheClearer.php diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php similarity index 94% rename from core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php index 2406c65..948b3ff 100644 --- a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmer.php @@ -22,7 +22,7 @@ abstract class CacheWarmer implements CacheWarmerInterface { $tmpFile = tempnam(dirname($file), basename($file)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { - chmod($file, 0666 & ~umask()); + @chmod($file, 0666 & ~umask()); return; } diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Client.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php similarity index 99% rename from core/vendor/Symfony/Component/HttpKernel/Client.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php index ff93bf7..f5dcd9a 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Client.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Client.php @@ -52,7 +52,7 @@ class Client extends BaseClient /** * Makes a request. * - * @param Request $request A Request instance + * @param Request $request A Request instance * * @return Response A Response instance */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Config/FileLocator.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Config/FileLocator.php similarity index 93% rename from core/vendor/Symfony/Component/HttpKernel/Config/FileLocator.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Config/FileLocator.php index 6cc615c..d241b9d 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Config/FileLocator.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Config/FileLocator.php @@ -29,7 +29,7 @@ class FileLocator extends BaseFileLocator * * @param KernelInterface $kernel A KernelInterface instance * @param string $path The path the global resource directory - * @param string|array $paths A path or an array of paths where to look for resources + * @param string|array $paths A path or an array of paths where to look for resources */ public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) { diff --git a/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolver.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php similarity index 96% rename from core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolver.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php index d535c55..cd3caf6 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolver.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolver.php @@ -114,8 +114,8 @@ class ControllerResolver implements ControllerResolverInterface $attributes = $request->attributes->all(); $arguments = array(); foreach ($parameters as $param) { - if (array_key_exists($param->getName(), $attributes)) { - $arguments[] = $attributes[$param->getName()]; + if (array_key_exists($param->name, $attributes)) { + $arguments[] = $attributes[$param->name]; } elseif ($param->getClass() && $param->getClass()->isInstance($request)) { $arguments[] = $request; } elseif ($param->isDefaultValueAvailable()) { @@ -129,7 +129,7 @@ class ControllerResolver implements ControllerResolverInterface $repr = $controller; } - throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->getName())); + throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument (because there is no default value or because there is a non optional argument after this one).', $repr, $param->name)); } } diff --git a/core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php similarity index 93% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollector.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index f1002fb..7da36b6 100644 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\DataCollector; -use Symfony\Component\HttpKernel\Profiler\Profiler; /** * DataCollector. diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php similarity index 95% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php index 5e0ff7a..7cfbbd1 100644 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\DataCollector; -use Symfony\Component\HttpKernel\Profiler\Profiler; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/EventDataCollector.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php similarity index 100% copy from core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php copy to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php similarity index 90% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index 4029d7c..f7cf88e 100644 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -59,6 +59,14 @@ class RequestDataCollector extends DataCollector $content = false; } + $sessionMetadata = array(); + + if ($request->hasSession()) { + $sessionMetadata['Created'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getCreated()); + $sessionMetadata['Last used'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getLastUsed()); + $sessionMetadata['Lifetime'] = $request->getSession()->getMetadataBag()->getLifetime(); + } + $this->data = array( 'format' => $request->getRequestFormat(), 'content' => $content, @@ -71,6 +79,7 @@ class RequestDataCollector extends DataCollector 'request_cookies' => $request->cookies->all(), 'request_attributes' => $attributes, 'response_headers' => $responseHeaders, + 'session_metadata' => $sessionMetadata, 'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(), 'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(), 'path_info' => $request->getPathInfo(), @@ -117,6 +126,11 @@ class RequestDataCollector extends DataCollector return new ResponseHeaderBag($this->data['response_headers']); } + public function getSessionMetadata() + { + return $this->data['session_metadata']; + } + public function getSessionAttributes() { return $this->data['session_attributes']; diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DataCollector/TimeDataCollector.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ContainerAwareTraceableEventDispatcher.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/ErrorHandler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php similarity index 95% rename from core/vendor/Symfony/Component/HttpKernel/Debug/ErrorHandler.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php index 942e82b..a2466d6 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Debug/ErrorHandler.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ErrorHandler.php @@ -26,6 +26,8 @@ class ErrorHandler E_USER_NOTICE => 'User Notice', E_STRICT => 'Runtime Notice', E_RECOVERABLE_ERROR => 'Catchable Fatal Error', + E_DEPRECATED => 'Deprecated', + E_USER_DEPRECATED => 'User Deprecated', ); private $level; diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/Stopwatch.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/Stopwatch.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Debug/Stopwatch.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/Stopwatch.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php similarity index 97% rename from core/vendor/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php index 36e6541..200c465 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Debug/StopwatchEvent.php @@ -26,8 +26,8 @@ class StopwatchEvent /** * Constructor. * - * @param float $origin The origin time in milliseconds - * @param string $category The event category + * @param float $origin The origin time in milliseconds + * @param string $category The event category * * @throws \InvalidArgumentException When the raw time is not valid */ diff --git a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/AddClassesToCachePass.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php similarity index 96% rename from core/vendor/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php index 4f6f6a3..8388ccf 100755 --- a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php @@ -38,7 +38,7 @@ abstract class ConfigurableExtension extends Extension /** * Configures the passed container according to the merged configuration. * - * @param array $mergedConfig + * @param array $mergedConfig * @param ContainerBuilder $container */ abstract protected function loadInternal(array $mergedConfig, ContainerBuilder $container); diff --git a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/Extension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DependencyInjection/Extension.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/Extension.php diff --git a/core/vendor/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/DependencyInjection/MergeExtensionConfigurationPass.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php similarity index 97% rename from core/vendor/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php index fbac347..cc47b71 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterControllerEvent.php @@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\Request; * * Controllers should be callables. * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php similarity index 96% rename from core/vendor/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php index 7e1f4a2..196bd67 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/FilterResponseEvent.php @@ -22,7 +22,7 @@ use Symfony\Component\HttpFoundation\Response; * setResponse() you can set a new response that will be returned to the * browser. * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseEvent.php similarity index 96% rename from core/vendor/Symfony/Component/HttpKernel/Event/GetResponseEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseEvent.php index eb726c0..c8c2f00 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseEvent.php @@ -20,7 +20,7 @@ use Symfony\Component\HttpFoundation\Response; * current request. The propagation of this event is stopped as soon as a * response is set. * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php similarity index 95% rename from core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php index 25ceca8..bcabcf3 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForControllerResultEvent.php @@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request; * current request. The propagation of this event is stopped as soon as a * response is set. * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php similarity index 93% rename from core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php index f7cf28d..3787f62 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/GetResponseForExceptionEvent.php @@ -25,7 +25,7 @@ use Symfony\Component\HttpFoundation\Request; * exception will be thrown if no response is set during processing of this * event. * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ @@ -61,7 +61,7 @@ class GetResponseForExceptionEvent extends GetResponseEvent * * This exception will be thrown if no response is set in the event. * - * @param \Exception $exception The thrown exception + * @param \Exception $exception The thrown exception * * @api */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/KernelEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/KernelEvent.php similarity index 97% rename from core/vendor/Symfony/Component/HttpKernel/Event/KernelEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/KernelEvent.php index 4dcfd11..2e1790a 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Event/KernelEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/KernelEvent.php @@ -18,7 +18,7 @@ use Symfony\Component\EventDispatcher\Event; /** * Base class for events thrown in the HttpKernel component * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Event/PostResponseEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/PostResponseEvent.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Event/PostResponseEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Event/PostResponseEvent.php diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/EsiListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/EventListener/EsiListener.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/EsiListener.php diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/LocaleListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php similarity index 91% rename from core/vendor/Symfony/Component/HttpKernel/EventListener/LocaleListener.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php index 8adefc5..cfe9734 100644 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/LocaleListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/LocaleListener.php @@ -13,7 +13,7 @@ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Routing\RouterInterface; +use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -26,7 +26,7 @@ class LocaleListener implements EventSubscriberInterface private $router; private $defaultLocale; - public function __construct($defaultLocale = 'en', RouterInterface $router = null) + public function __construct($defaultLocale = 'en', RequestContextAwareInterface $router = null) { $this->defaultLocale = $defaultLocale; $this->router = $router; diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/ResponseListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/EventListener/ResponseListener.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/ResponseListener.php diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php similarity index 77% rename from core/vendor/Symfony/Component/HttpKernel/EventListener/RouterListener.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php index 5d5a543..be43a72 100644 --- a/core/vendor/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/RouterListener.php @@ -20,6 +20,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; +use Symfony\Component\Routing\Matcher\RequestMatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** @@ -29,12 +30,16 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class RouterListener implements EventSubscriberInterface { - private $urlMatcher; + private $matcher; private $logger; - public function __construct(UrlMatcherInterface $urlMatcher, LoggerInterface $logger = null) + public function __construct($matcher, LoggerInterface $logger = null) { - $this->urlMatcher = $urlMatcher; + if (!$matcher instanceof UrlMatcherInterface && !$matcher instanceof RequestMatcherInterface) { + throw new \InvalidArgumentException('Matcher must either implement UrlMatcherInterface or RequestMatcherInterface.'); + } + + $this->matcher = $matcher; $this->logger = $logger; } @@ -43,7 +48,7 @@ class RouterListener implements EventSubscriberInterface $request = $event->getRequest(); if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) { - $this->urlMatcher->getContext()->fromRequest($request); + $this->matcher->getContext()->fromRequest($request); } if ($request->attributes->has('_controller')) { @@ -53,7 +58,12 @@ class RouterListener implements EventSubscriberInterface // add attributes based on the path info (routing) try { - $parameters = $this->urlMatcher->match($request->getPathInfo()); + // matching requests is more powerful than matching URLs only, so try that first + if ($this->matcher instanceof RequestMatcherInterface) { + $parameters = $this->matcher->matchRequest($request); + } else { + $parameters = $this->matcher->match($request->getPathInfo()); + } if (null !== $this->logger) { $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters))); diff --git a/core/vendor/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/AccessDeniedHttpException.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/FlattenException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Exception/FlattenException.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/FlattenException.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/HttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Exception/HttpException.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpException.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php similarity index 73% rename from core/vendor/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php index 7ae7b7a..cdfcc8a 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/MethodNotAllowedHttpException.php @@ -21,10 +21,10 @@ class MethodNotAllowedHttpException extends HttpException /** * Constructor. * - * @param array $allow An array of allowed methods - * @param string $message The internal exception message - * @param Exception $previous The previous exception - * @param integer $code The internal exception code + * @param array $allow An array of allowed methods + * @param string $message The internal exception message + * @param Exception $previous The previous exception + * @param integer $code The internal exception code */ public function __construct(array $allow, $message = null, \Exception $previous = null, $code = 0) { diff --git a/core/vendor/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Exception/NotFoundHttpException.php diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/Esi.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Esi.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/HttpCache/Esi.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Esi.php diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategy.php diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php similarity index 99% rename from core/vendor/Symfony/Component/HttpKernel/HttpCache/HttpCache.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php index ce3e005..ec66dcd 100644 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/HttpCache.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/HttpCache.php @@ -581,7 +581,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface private function restoreResponseBody(Request $request, Response $response) { if ('HEAD' === $request->getMethod() || 304 === $response->getStatusCode()) { - $response->setContent(''); + $response->setContent(null); $response->headers->remove('X-Body-Eval'); $response->headers->remove('X-Body-File'); @@ -647,7 +647,7 @@ class HttpCache implements HttpKernelInterface, TerminableInterface * Records that an event took place. * * @param Request $request A Request instance - * @param string $event The event name + * @param string $event The event name */ private function record(Request $request, $event) { diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/Store.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php similarity index 98% rename from core/vendor/Symfony/Component/HttpKernel/HttpCache/Store.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php index fe19f3a..b60c647 100644 --- a/core/vendor/Symfony/Component/HttpKernel/HttpCache/Store.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/Store.php @@ -167,7 +167,7 @@ class Store implements StoreInterface $entries = array(); $vary = $response->headers->get('vary'); foreach ($this->getMetadata($key) as $entry) { - if (!isset($entry[1]['vary'])) { + if (!isset($entry[1]['vary'][0])) { $entry[1]['vary'] = array(''); } @@ -293,7 +293,7 @@ class Store implements StoreInterface /** * Loads data for the given key. * - * @param string $key The store key + * @param string $key The store key * * @return string The data associated with the key */ @@ -332,7 +332,7 @@ class Store implements StoreInterface return false; } - chmod($path, 0666 & ~umask()); + @chmod($path, 0666 & ~umask()); } public function getPath($key) diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpKernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php similarity index 95% rename from core/vendor/Symfony/Component/HttpKernel/HttpKernel.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php index 9a465d1..eea71e8 100644 --- a/core/vendor/Symfony/Component/HttpKernel/HttpKernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php @@ -55,10 +55,10 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface * When $catch is true, the implementation must catch all exceptions * and do its best to convert them to a Response instance. * - * @param Request $request A Request instance - * @param integer $type The type of the request + * @param Request $request A Request instance + * @param integer $type The type of the request * (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * @param Boolean $catch Whether to catch exceptions or not + * @param Boolean $catch Whether to catch exceptions or not * * @return Response A Response instance * @@ -173,9 +173,9 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface /** * Handles and exception by trying to convert it to a Response. * - * @param \Exception $e An \Exception instance - * @param Request $request A Request instance - * @param integer $type The type of the request + * @param \Exception $e An \Exception instance + * @param Request $request A Request instance + * @param integer $type The type of the request * * @return Response A Response instance */ diff --git a/core/vendor/Symfony/Component/HttpKernel/HttpKernelInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php similarity index 87% rename from core/vendor/Symfony/Component/HttpKernel/HttpKernelInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php index a2a0f1c..efcf39d 100644 --- a/core/vendor/Symfony/Component/HttpKernel/HttpKernelInterface.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernelInterface.php @@ -32,10 +32,10 @@ interface HttpKernelInterface * When $catch is true, the implementation must catch all exceptions * and do its best to convert them to a Response instance. * - * @param Request $request A Request instance - * @param integer $type The type of the request + * @param Request $request A Request instance + * @param integer $type The type of the request * (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST) - * @param Boolean $catch Whether to catch exceptions or not + * @param Boolean $catch Whether to catch exceptions or not * * @return Response A Response instance * diff --git a/core/vendor/Symfony/Component/HttpKernel/Kernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php similarity index 98% rename from core/vendor/Symfony/Component/HttpKernel/Kernel.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php index 7fdb546..bc45891 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Kernel.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php @@ -58,7 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.1.0-DEV'; + const VERSION = '2.1.0-BETA1'; + const VERSION_ID = '20100'; + const MAJOR_VERSION = '2'; + const MINOR_VERSION = '1'; + const RELEASE_VERSION = '0'; + const EXTRA_VERSION = 'BETA'; /** * Constructor. @@ -387,7 +392,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface { if (null === $this->rootDir) { $r = new \ReflectionObject($this); - $this->rootDir = dirname($r->getFileName()); + $this->rootDir = str_replace('\\', '/', dirname($r->getFileName())); } return $this->rootDir; @@ -408,8 +413,8 @@ abstract class Kernel implements KernelInterface, TerminableInterface /** * Loads the PHP class cache. * - * @param string $name The cache name prefix - * @param string $extension File extension of the resulting file + * @param string $name The cache name prefix + * @param string $extension File extension of the resulting file */ public function loadClassCache($name = 'classes', $extension = '.php') { diff --git a/core/vendor/Symfony/Component/HttpKernel/KernelEvents.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php similarity index 97% rename from core/vendor/Symfony/Component/HttpKernel/KernelEvents.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php index 1594d3e..c2a4309 100644 --- a/core/vendor/Symfony/Component/HttpKernel/KernelEvents.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelEvents.php @@ -14,7 +14,7 @@ namespace Symfony\Component\HttpKernel; /** * Contains all events thrown in the HttpKernel component * - * @author Bernhard Schussek + * @author Bernhard Schussek * * @api */ diff --git a/core/vendor/Symfony/Component/HttpKernel/KernelInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/KernelInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/KernelInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/LICENSE b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/LICENSE rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/LICENSE diff --git a/core/vendor/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Log/LoggerInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Log/LoggerInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/LoggerInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Log/NullLogger.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/NullLogger.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Log/NullLogger.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Log/NullLogger.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php similarity index 89% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php index 5a54d62..ebf1912 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php @@ -95,7 +95,28 @@ abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface */ public function purge() { - $this->flush(); + // delete only items from index + $indexName = $this->getIndexName(); + + $indexContent = $this->getValue($indexName); + + if (!$indexContent) { + return false; + } + + $profileList = explode("\n", $indexContent); + + foreach ($profileList as $item) { + if ($item == '') { + continue; + } + + if (false !== $pos = strpos($item, "\t")) { + $this->delete($this->getItemName(substr($item, 0, $pos))); + } + } + + return $this->delete($indexName); } /** @@ -164,25 +185,27 @@ abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface * Store an item on the memcache server under the specified key * * @param string $key - * @param mixed $value - * @param int $expiration + * @param mixed $value + * @param int $expiration * * @return boolean */ abstract protected function setValue($key, $value, $expiration = 0); /** - * Flush all existing items at the memcache server + * Delete item from the memcache server + * + * @param string $key * * @return boolean */ - abstract protected function flush(); + abstract protected function delete($key); /** * Append data to an existing item on the memcache server * @param string $key * @param string $value - * @param int $expiration + * @param int $expiration * * @return boolean */ diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php similarity index 89% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php index dfcf487..ebf3b5c 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php @@ -51,6 +51,16 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage } /** + * Set instance of the Memcache + * + * @param Memcache $memcache + */ + public function setMemcache($memcache) + { + $this->memcache = $memcache; + } + + /** * {@inheritdoc} */ protected function getValue($key) @@ -69,9 +79,9 @@ class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage /** * {@inheritdoc} */ - protected function flush() + protected function delete($key) { - return $this->getMemcache()->flush(); + return $this->getMemcache()->delete($key); } /** diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php similarity index 88% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php index 4b45c6b..34ca1cb 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php @@ -55,6 +55,16 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage } /** + * Set instance of the Memcached + * + * @param Memcached $memcached + */ + public function setMemcached($memcached) + { + $this->memcached = $memcached; + } + + /** * {@inheritdoc} */ protected function getValue($key) @@ -73,9 +83,9 @@ class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage /** * {@inheritdoc} */ - protected function flush() + protected function delete($key) { - return $this->getMemcached()->flush(); + return $this->getMemcached()->delete($key); } /** diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php similarity index 90% copy from core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php copy to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php index 8e2bea4..4091232 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\Profiler; - /** * Base PDO storage for profiling information in a PDO database. * @@ -92,7 +91,7 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface ); try { - if ($this->read($profile->getToken())) { + if ($this->has($profile->getToken())) { $this->exec($db, 'UPDATE sf_profiler_data SET parent = :parent, data = :data, ip = :ip, method = :method, url = :url, time = :time, created_at = :created_at WHERE token = :token', $args); } else { $this->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, method, url, time, created_at) VALUES (:token, :parent, :data, :ip, :method, :url, :time, :created_at)', $args); @@ -121,9 +120,9 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface /** * Build SQL criteria to fetch records by ip and url * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return + * @param string $ip The IP + * @param string $url The URL + * @param string $limit The maximum number of tokens to return * @param string $method The request method * * @return array An array with (criteria, args) @@ -214,7 +213,7 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface /** * Reads the child profiles for the given token. * - * @param string $token The parent token + * @param string $token The parent token * @param string $parent The parent instance * * @return array An array of Profile instance @@ -236,4 +235,20 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface return $profiles; } + + /** + * Returns whether data for the given token already exists in storage. + * + * @param string $token The profile token + * + * @return Boolean + */ + protected function has($token) + { + $db = $this->initDb(); + $tokenExists = $this->fetch($db, 'SELECT 1 FROM sf_profiler_data WHERE token = :token LIMIT 1', array(':token' => $token)); + $this->close($db); + + return !empty($tokenExists); + } } diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/Profile.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profile.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/Profile.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profile.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/Profiler.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profiler.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/Profiler.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/Profiler.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php similarity index 86% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php index 67722e1..f7e5f3c 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php @@ -22,6 +22,11 @@ class RedisProfilerStorage implements ProfilerStorageInterface { const TOKEN_PREFIX = 'sf_profiler_'; + const REDIS_OPT_SERIALIZER = 1; + const REDIS_OPT_PREFIX = 2; + const REDIS_SERIALIZER_NONE = 0; + const REDIS_SERIALIZER_PHP = 1; + protected $dsn; protected $lifetime; @@ -33,10 +38,10 @@ class RedisProfilerStorage implements ProfilerStorageInterface /** * Constructor. * - * @param string $dsn A data source name - * @param string $username Not used - * @param string $password Not used - * @param int $lifetime The lifetime to use for the purge + * @param string $dsn A data source name + * @param string $username Not used + * @param string $password Not used + * @param int $lifetime The lifetime to use for the purge */ public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) { @@ -51,7 +56,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface { $indexName = $this->getIndexName(); - if (!$indexContent = $this->getValue($indexName, Redis::SERIALIZER_NONE)) { + if (!$indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE)) { return array(); } @@ -103,7 +108,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface // delete only items from index $indexName = $this->getIndexName(); - $indexContent = $this->getValue($indexName, Redis::SERIALIZER_NONE); + $indexContent = $this->getValue($indexName, self::REDIS_SERIALIZER_NONE); if (!$indexContent) { return false; @@ -137,7 +142,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface return false; } - $profile = $this->getValue($this->getItemName($token), Redis::SERIALIZER_PHP); + $profile = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP); if (false !== $profile) { $profile = $this->createProfileFromData($token, $profile); @@ -162,7 +167,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface 'time' => $profile->getTime(), ); - if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime, Redis::SERIALIZER_PHP)) { + if ($this->setValue($this->getItemName($profile->getToken()), $data, $this->lifetime, self::REDIS_SERIALIZER_PHP)) { // Add to index $indexName = $this->getIndexName(); @@ -203,7 +208,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface $redis = new Redis; $redis->connect($host, $port); - $redis->setOption(Redis::OPT_PREFIX, self::TOKEN_PREFIX); + $redis->setOption(self::REDIS_OPT_PREFIX, self::TOKEN_PREFIX); $this->redis = $redis; } @@ -211,6 +216,16 @@ class RedisProfilerStorage implements ProfilerStorageInterface return $this->redis; } + /** + * Set instance of the Redis + * + * @param Redis $redis + */ + public function setRedis($redis) + { + $this->redis = $redis; + } + private function createProfileFromData($token, $data, $parent = null) { $profile = new Profile($token); @@ -233,7 +248,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface continue; } - if (!$childProfileData = $this->getValue($this->getItemName($token), Redis::SERIALIZER_PHP)) { + if (!$childProfileData = $this->getValue($this->getItemName($token), self::REDIS_SERIALIZER_PHP)) { continue; } @@ -296,10 +311,10 @@ class RedisProfilerStorage implements ProfilerStorageInterface * * @return mixed */ - private function getValue($key, $serializer = Redis::SERIALIZER_NONE) + private function getValue($key, $serializer = self::REDIS_SERIALIZER_NONE) { $redis = $this->getRedis(); - $redis->setOption(Redis::OPT_SERIALIZER, $serializer); + $redis->setOption(self::REDIS_OPT_SERIALIZER, $serializer); return $redis->get($key); } @@ -314,10 +329,10 @@ class RedisProfilerStorage implements ProfilerStorageInterface * * @return Boolean */ - private function setValue($key, $value, $expiration = 0, $serializer = Redis::SERIALIZER_NONE) + private function setValue($key, $value, $expiration = 0, $serializer = self::REDIS_SERIALIZER_NONE) { $redis = $this->getRedis(); - $redis->setOption(Redis::OPT_SERIALIZER, $serializer); + $redis->setOption(self::REDIS_OPT_SERIALIZER, $serializer); return $redis->setex($key, $expiration, $value); } @@ -334,7 +349,7 @@ class RedisProfilerStorage implements ProfilerStorageInterface private function appendValue($key, $value, $expiration = 0) { $redis = $this->getRedis(); - $redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE); + $redis->setOption(self::REDIS_OPT_SERIALIZER, self::REDIS_SERIALIZER_NONE); if ($redis->exists($key)) { $redis->append($key, $value); diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php diff --git a/core/vendor/Symfony/Component/HttpKernel/README.md b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/README.md similarity index 79% rename from core/vendor/Symfony/Component/HttpKernel/README.md rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/README.md index 1460f0e..c44d530 100644 --- a/core/vendor/Symfony/Component/HttpKernel/README.md +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/README.md @@ -21,7 +21,7 @@ framework: It takes a ``Request`` as an input and should return a ``Response`` as an output. Using this interface makes your code compatible with all frameworks -using the Symfony2 components. And this will gives you many cool features for +using the Symfony2 components. And this will give you many cool features for free. Creating a framework based on the Symfony2 components is really easy. Here is @@ -84,18 +84,9 @@ Resources You can run the unit tests with the following command: - phpunit -c src/Symfony/Component/HttpKernel/ + phpunit If you also want to run the unit tests that depend on other Symfony -Components, declare the following environment variables before running -PHPUnit: - - export SYMFONY_EVENT_DISPATCHER=../path/to/EventDispatcher - export SYMFONY_HTTP_FOUNDATION=../path/to/HttpFoundation - export SYMFONY_DEPENDENCY_INJECTION=../path/to/DependencyInjection - export SYMFONY_CONSOLE=../path/to/Console - export SYMFONY_BROWSER_KIT=../path/to/BrowserKit - export SYMFONY_FINDER=../path/to/Finder - export SYMFONY_PROCESS=../path/to/Process - export SYMFONY_ROUTING=../path/to/Routing - export SYMFONY_CONFIG=../path/to/Config +Components, install dev dependencies before running PHPUnit: + + php composer.phar install --dev diff --git a/core/vendor/Symfony/Component/HttpKernel/TerminableInterface.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/TerminableInterface.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/TerminableInterface.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php similarity index 88% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php index 2b8cc79..eaff42a 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php @@ -25,6 +25,10 @@ class BundleTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('The "Console" component is not available'); } + if (!class_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { + $this->markTestSkipped('The "DependencyInjection" component is not available'); + } + if (!class_exists('Symfony\Component\Finder\Finder')) { $this->markTestSkipped('The "Finder" component is not available'); } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheClearer/ChainCacheClearerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerAggregateTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/CacheWarmer/CacheWarmerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/ClientTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/ClientTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/ClientTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/ClientTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/EventDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/EventDataCollectorTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/EventDataCollectorTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/EventDataCollectorTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/ExceptionDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ExceptionDataCollectorTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/ExceptionDataCollectorTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/ExceptionDataCollectorTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/LoggerDataCollectorTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/MemoryDataCollectorTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DataCollector/RequestDataCollectorTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ErrorHandlerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Debug/StopwatchEventTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchEventTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Debug/StopwatchEventTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchEventTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/EsiListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/EsiListenerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/EsiListenerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/EsiListenerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php similarity index 98% rename from core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php index f999a35..e5e6124 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ExceptionListenerTest.php @@ -66,7 +66,7 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase try { $l->onKernelException($event2); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->assertSame('foo', $e->getMessage()); } @@ -88,7 +88,7 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase try { $l->onKernelException($event2); - } catch(\Exception $e) { + } catch (\Exception $e) { $this->assertSame('foo', $e->getMessage()); } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/LocaleListenerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/ResponseListenerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php similarity index 72% rename from core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php index c33b33d..9ac028c 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php @@ -77,4 +77,33 @@ class RouterListenerTest extends \PHPUnit_Framework_TestCase return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); } + + /** + * @expectedException \InvalidArgumentException + */ + public function testInvalidMatcher() + { + new RouterListener(new \stdClass()); + } + + public function testRequestMatcher() + { + $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface'); + $request = Request::create('http://localhost/'); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); + + $context = new RequestContext(); + + $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface'); + $requestMatcher->expects($this->any()) + ->method('getContext') + ->will($this->returnValue($context)); + $requestMatcher->expects($this->once()) + ->method('matchRequest') + ->with($this->isInstanceOf('Symfony\Component\HttpFoundation\Request')) + ->will($this->returnValue(array())); + + $listener = new RouterListener($requestMatcher); + $listener->onKernelRequest($event); + } } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/hide.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/hide.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/hide.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/BaseBundle/Resources/hide.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/Resources/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/bar.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/bar.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/bar.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/bar.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle1Bundle/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle2Bundle/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle2Bundle/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle2Bundle/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Bundle2Bundle/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/hide.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/hide.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/hide.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ChildBundle/Resources/hide.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionAbsentBundle/ExtensionAbsentBundle.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/DependencyInjection/ExtensionLoadedExtension.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php similarity index 100% copy from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php copy to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/Command/FooCommand.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/DependencyInjection/ExtensionPresentExtension.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionPresentBundle/ExtensionPresentBundle.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/FooBarBundle.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/BaseBundle/hide.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/BaseBundle/hide.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/BaseBundle/hide.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/BaseBundle/hide.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/Bundle1Bundle/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/ChildBundle/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/ChildBundle/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/ChildBundle/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/ChildBundle/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/FooBundle/foo.txt b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/FooBundle/foo.txt similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/FooBundle/foo.txt rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/Resources/FooBundle/foo.txt diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php similarity index 90% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php index ddab206..48ff956 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestClient.php @@ -19,7 +19,7 @@ class TestClient extends Client { $script = parent::getScript($request); - $script = preg_replace('/(\->register\(\);)/', "$0\nrequire_once '".__DIR__."/../TestHttpKernel.php';", $script); + $script = preg_replace('/(\->register\(\);)/', "$0\nrequire_once '".__DIR__."/../bootstrap.php';", $script); return $script; } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/EsiTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php similarity index 98% rename from core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index 2ac581d..5060a69 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -169,8 +169,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time = new \DateTime(); - $this->setNextResponse(200, array(), '', function ($request, $response) use ($time) - { + $this->setNextResponse(200, array(), '', function ($request, $response) use ($time) { $response->setStatusCode(200); $response->headers->set('ETag', '12345'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); @@ -197,8 +196,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testValidatesPrivateResponsesCachedOnTheClient() { - $this->setNextResponse(200, array(), '', function ($request, $response) - { + $this->setNextResponse(200, array(), '', function ($request, $response) { $etags = preg_split('/\s*,\s*/', $request->headers->get('IF_NONE_MATCH')); if ($request->cookies->has('authenticated')) { $response->headers->set('Cache-Control', 'private, no-store'); @@ -257,8 +255,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) - { + $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { ++$count; $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); }); @@ -285,8 +282,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) - { + $this->setNextResponse(200, array('Cache-Control' => 'public, max-age=10000'), '', function ($request, $response) use (&$count) { ++$count; $response->setContent(1 == $count ? 'Hello World' : 'Goodbye World'); }); @@ -317,8 +313,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) - { + $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { ++$count; $response->headers->set('Cache-Control', 'public, max-age=10000'); $response->setETag($count); @@ -348,8 +343,7 @@ class HttpCacheTest extends HttpCacheTestCase { $count = 0; - $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) - { + $this->setNextResponse(200, array(), '', function ($request, $response) use (&$count) { ++$count; $response->headers->set('Cache-Control', 'public, max-age=10000'); $response->setETag($count); @@ -658,8 +652,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInformation() { $time = \DateTime::createFromFormat('U', time()); - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) - { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) { $response->headers->set('Cache-Control', 'public'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); if ($time->format(DATE_RFC2822) == $request->headers->get('IF_MODIFIED_SINCE')) { @@ -695,8 +688,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testValidatesCachedResponsesWithETagAndNoFreshnessInformation() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) - { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { $response->headers->set('Cache-Control', 'public'); $response->headers->set('ETag', '"12345"'); if ($response->getETag() == $request->headers->get('IF_NONE_MATCH')) { @@ -733,8 +725,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); $count = 0; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) - { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time, &$count) { $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); $response->headers->set('Cache-Control', 'public'); switch (++$count) { @@ -772,8 +763,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testPassesHeadRequestsThroughDirectlyOnPass() { $that = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) - { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) { $response->setContent(''); $response->setStatusCode(200); $that->assertEquals('HEAD', $request->getMethod()); @@ -787,8 +777,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testUsesCacheToRespondToHeadRequestsWhenFresh() { $that = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) - { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->setContent('Hello World'); $response->setStatusCode(200); @@ -810,8 +799,7 @@ class HttpCacheTest extends HttpCacheTestCase { $time = \DateTime::createFromFormat('U', time()); $that = $this; - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) - { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) { $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('Last-Modified', $time->format(DATE_RFC2822)); }); @@ -828,8 +816,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testInvalidatesCachedResponsesOnPost() { - $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) - { + $this->setNextResponse(200, array(), 'Hello World', function ($request, $response) { if ('GET' == $request->getMethod()) { $response->setStatusCode(200); $response->headers->set('Cache-Control', 'public, max-age=500'); @@ -878,8 +865,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testServesFromCacheWhenHeadersMatch() { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) - { + $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { $response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('X-Response-Count', ++$count); @@ -903,8 +889,7 @@ class HttpCacheTest extends HttpCacheTestCase public function testStoresMultipleResponsesWhenHeadersDiffer() { $count = 0; - $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) - { + $this->setNextResponse(200, array('Cache-Control' => 'max-age=10000'), '', function ($request, $response) use (&$count) { $response->headers->set('Vary', 'Accept User-Agent Foo'); $response->headers->set('Cache-Control', 'public, max-age=10'); $response->headers->set('X-Response-Count', ++$count); diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php similarity index 98% rename from core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index 6bbcdfb..3d78c7c 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php @@ -162,8 +162,7 @@ class HttpCacheTestCase extends \PHPUnit_Framework_TestCase $fp = opendir($directory); while (false !== $file = readdir($fp)) { - if (!in_array($file, array('.', '..'))) - { + if (!in_array($file, array('.', '..'))) { if (is_link($directory.'/'.$file)) { unlink($directory.'/'.$file); } elseif (is_dir($directory.'/'.$file)) { diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/StoreTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/TestHttpKernel.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpCache/TestMultipleHttpKernel.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php similarity index 99% rename from core/vendor/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php index 8a184b4..bdbc4e8 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php @@ -54,8 +54,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase public function testHandleWhenControllerThrowsAnExceptionAndRawIsFalse() { $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) - { + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { $event->setResponse(new Response($event->getException()->getMessage())); }); @@ -67,8 +66,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase public function testHandleWhenAListenerReturnsAResponse() { $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::REQUEST, function ($event) - { + $dispatcher->addListener(KernelEvents::REQUEST, function ($event) { $event->setResponse(new Response('hello')); }); @@ -154,8 +152,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase public function testHandleWhenTheControllerDoesNotReturnAResponseButAViewIsRegistered() { $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::VIEW, function ($event) - { + $dispatcher->addListener(KernelEvents::VIEW, function ($event) { $event->setResponse(new Response($event->getControllerResult())); }); $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { return 'foo'; })); @@ -166,8 +163,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase public function testHandleWithAResponseListener() { $dispatcher = new EventDispatcher(); - $dispatcher->addListener(KernelEvents::RESPONSE, function ($event) - { + $dispatcher->addListener(KernelEvents::RESPONSE, function ($event) { $event->setResponse(new Response('foo')); }); $kernel = new HttpKernel($dispatcher, $this->getResolver()); diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/KernelTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php similarity index 98% rename from core/vendor/Symfony/Component/HttpKernel/Tests/KernelTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php index a26d9d7..8fc46cc 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\Tests; use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Bundle\Bundle; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; @@ -724,7 +723,7 @@ EOF; protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null) { $bundle = $this - ->getMockBuilder('Symfony\Component\HttpKernel\Tests\BundleForTest') + ->getMockBuilder('Symfony\Component\HttpKernel\Bundle\BundleInterface') ->setMethods(array('getPath', 'getParent', 'getName')) ->disableOriginalConstructor() ; @@ -775,8 +774,3 @@ EOF; ; } } - -abstract class BundleForTest implements BundleInterface -{ - // We can not extend Symfony\Component\HttpKernel\Bundle\Bundle as we want to mock getName() which is final -} diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Logger.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Logger.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Logger.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Logger.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php similarity index 47% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php index fb55026..f582dff 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php @@ -12,48 +12,30 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage; +use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcacheMock; -class DummyMemcacheProfilerStorage extends MemcacheProfilerStorage -{ - public function getMemcache() - { - return parent::getMemcache(); - } -} - -/** - * @group memcached - */ class MemcacheProfilerStorageTest extends AbstractProfilerStorageTest { protected static $storage; - public static function tearDownAfterClass() + protected function setUp() { + $memcacheMock = new MemcacheMock(); + $memcacheMock->addServer('127.0.0.1', 11211); + + self::$storage = new MemcacheProfilerStorage('memcache://127.0.0.1:11211', '', '', 86400); + self::$storage->setMemcache($memcacheMock); + if (self::$storage) { self::$storage->purge(); } } - protected function setUp() + protected function tearDown() { - if (!extension_loaded('memcache')) { - $this->markTestSkipped('MemcacheProfilerStorageTest requires that the extension memcache is loaded'); - } - - self::$storage = new DummyMemcacheProfilerStorage('memcache://127.0.0.1:11211', '', '', 86400); - try { - self::$storage->getMemcache(); - $stats = self::$storage->getMemcache()->getExtendedStats(); - if (!isset($stats['127.0.0.1:11211']) || $stats['127.0.0.1:11211'] === false) { - throw new \Exception(); - } - } catch (\Exception $e) { - $this->markTestSkipped('MemcacheProfilerStorageTest requires that there is a Memcache server present on localhost'); - } - if (self::$storage) { self::$storage->purge(); + self::$storage = false; } } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php similarity index 53% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php index 5f2f5c3..565ac35 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php @@ -12,44 +12,30 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage; +use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcachedMock; -class DummyMemcachedProfilerStorage extends MemcachedProfilerStorage -{ - public function getMemcached() - { - return parent::getMemcached(); - } -} - -/** - * @group memcached - */ class MemcachedProfilerStorageTest extends AbstractProfilerStorageTest { protected static $storage; - public static function tearDownAfterClass() + protected function setUp() { + $memcachedMock = new MemcachedMock(); + $memcachedMock->addServer('127.0.0.1', 11211); + + self::$storage = new MemcachedProfilerStorage('memcached://127.0.0.1:11211', '', '', 86400); + self::$storage->setMemcached($memcachedMock); + if (self::$storage) { self::$storage->purge(); } } - protected function setUp() + protected function tearDown() { - if (!extension_loaded('memcached')) { - $this->markTestSkipped('MemcachedProfilerStorageTest requires that the extension memcached is loaded'); - } - - self::$storage = new DummyMemcachedProfilerStorage('memcached://127.0.0.1:11211', '', '', 86400); - try { - self::$storage->getMemcached(); - } catch (\Exception $e) { - $this->markTestSkipped('MemcachedProfilerStorageTest requires that there is a Memcache server present on localhost'); - } - if (self::$storage) { self::$storage->purge(); + self::$storage = false; } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php similarity index 16% rename from core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php index 09c548c..014f549 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/RequestMatcher.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcacheMock.php @@ -9,213 +9,252 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation; +namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock; /** - * RequestMatcher compares a pre-defined set of checks against a Request instance. + * MemcacheMock for simulating Memcache extension in tests. * - * @author Fabien Potencier - * - * @api + * @author Andrej Hudec */ -class RequestMatcher implements RequestMatcherInterface +class MemcacheMock { - /** - * @var string - */ - private $path; - - /** - * @var string - */ - private $host; - - /** - * @var string - */ - private $methods; - - /** - * @var string - */ - private $ip; - - /** - * Attributes. - * - * @var array - */ - private $attributes; + private $connected; + private $storage; - public function __construct($path = null, $host = null, $methods = null, $ip = null, array $attributes = array()) + public function __construct() { - $this->path = $path; - $this->host = $host; - $this->methods = $methods; - $this->ip = $ip; - $this->attributes = $attributes; + $this->connected = false; + $this->storage = array(); } /** - * Adds a check for the URL host name. + * Open memcached server connection + * + * @param string $host + * @param integer $port + * @param integer $timeout * - * @param string $regexp A Regexp + * @return boolean */ - public function matchHost($regexp) + public function connect($host, $port = null, $timeout = null) { - $this->host = $regexp; + if ('127.0.0.1' == $host && 11211 == $port) { + $this->connected = true; + + return true; + } + + return false; } /** - * Adds a check for the URL path info. + * Open memcached server persistent connection * - * @param string $regexp A Regexp + * @param string $host + * @param integer $port + * @param integer $timeout + * + * @return boolean */ - public function matchPath($regexp) + public function pconnect($host, $port = null, $timeout = null) { - $this->path = $regexp; + if ('127.0.0.1' == $host && 11211 == $port) { + $this->connected = true; + + return true; + } + + return false; } /** - * Adds a check for the client IP. + * Add a memcached server to connection pool + * + * @param string $host + * @param integer $port + * @param boolean $persistent + * @param integer $weight + * @param integer $timeout + * @param integer $retry_interval + * @param boolean $status + * @param callable $failure_callback + * @param integer $timeoutms * - * @param string $ip A specific IP address or a range specified using IP/netmask like 192.168.1.0/24 + * @return boolean */ - public function matchIp($ip) + public function addServer($host, $port = 11211, $persistent = null, $weight = null, $timeout = null, $retry_interval = null, $status = null, $failure_callback = null, $timeoutms = null) { - $this->ip = $ip; + if ('127.0.0.1' == $host && 11211 == $port) { + $this->connected = true; + + return true; + } + + return false; } /** - * Adds a check for the HTTP method. + * Add an item to the server only if such key doesn't exist at the server yet. * - * @param string|array $method An HTTP method or an array of HTTP methods + * @param string $key + * @param mixed $var + * @param integer $flag + * @param integer $expire + * + * @return boolean */ - public function matchMethod($method) + public function add($key, $var, $flag = null, $expire = null) { - $this->methods = array_map('strtoupper', is_array($method) ? $method : array($method)); + if (!$this->connected) { + return false; + } + + if (!isset($this->storage[$key])) { + $this->storeData($key, $var); + + return true; + } + + return false; } /** - * Adds a check for request attribute. + * Store data at the server. * - * @param string $key The request attribute name - * @param string $regexp A Regexp + * @param string $key + * @param string $var + * @param integer $flag + * @param integer $expire + * + * @return boolean */ - public function matchAttribute($key, $regexp) + public function set($key, $var, $flag = null, $expire = null) { - $this->attributes[$key] = $regexp; + if (!$this->connected) { + return false; + } + + $this->storeData($key, $var); + + return true; } /** - * {@inheritdoc} + * Replace value of the existing item. + * + * @param string $key + * @param mixed $var + * @param integer $flag + * @param integer $expire * - * @api + * @return boolean */ - public function matches(Request $request) + public function replace($key, $var, $flag = null, $expire = null) { - if (null !== $this->methods && !in_array($request->getMethod(), $this->methods)) { + if (!$this->connected) { return false; } - foreach ($this->attributes as $key => $pattern) { - if (!preg_match('#'.str_replace('#', '\\#', $pattern).'#', $request->attributes->get($key))) { - return false; - } - } - - if (null !== $this->path) { - $path = str_replace('#', '\\#', $this->path); + if (isset($this->storage[$key])) { + $this->storeData($key, $var); - if (!preg_match('#'.$path.'#', rawurldecode($request->getPathInfo()))) { - return false; - } + return true; } - if (null !== $this->host && !preg_match('#'.str_replace('#', '\\#', $this->host).'#', $request->getHost())) { + return false; + } + + /** + * Retrieve item from the server. + * + * @param string|array $key + * @param integer|array $flags + * + * @return mixed + */ + public function get($key, &$flags = null) + { + if (!$this->connected) { return false; } - if (null !== $this->ip && !$this->checkIp($request->getClientIp(), $this->ip)) { - return false; + if (is_array($key)) { + $result = array(); + foreach ($key as $k) { + if (isset($this->storage[$k])) { + $result[] = $this->getData($k); + } + } + + return $result; } - return true; + return $this->getData($key); } /** - * Validates an IP address. + * Delete item from the server * - * @param string $requestIp - * @param string $ip + * @param string $key * - * @return boolean True valid, false if not. + * @return boolean */ - protected function checkIp($requestIp, $ip) + public function delete($key) { - // IPv6 address - if (false !== strpos($requestIp, ':')) { - return $this->checkIp6($requestIp, $ip); - } else { - return $this->checkIp4($requestIp, $ip); + if (!$this->connected) { + return false; + } + + if (isset($this->storage[$key])) { + unset($this->storage[$key]); + + return true; } + + return false; } /** - * Validates an IPv4 address. - * - * @param string $requestIp - * @param string $ip + * Flush all existing items at the server * - * @return boolean True valid, false if not. + * @return boolean */ - protected function checkIp4($requestIp, $ip) + public function flush() { - if (false !== strpos($ip, '/')) { - list($address, $netmask) = explode('/', $ip, 2); - - if ($netmask < 1 || $netmask > 32) { - return false; - } - } else { - $address = $ip; - $netmask = 32; + if (!$this->connected) { + return false; } - return 0 === substr_compare(sprintf('%032b', ip2long($requestIp)), sprintf('%032b', ip2long($address)), 0, $netmask); + $this->storage = array(); + + return true; } /** - * Validates an IPv6 address. - * - * @author David Soria Parra - * @see https://github.com/dsp/v6tools - * - * @param string $requestIp - * @param string $ip + * Close memcached server connection * - * @return boolean True valid, false if not. + * @return boolean */ - protected function checkIp6($requestIp, $ip) + public function close() { - if (!defined('AF_INET6')) { - throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); - } - - list($address, $netmask) = explode('/', $ip, 2); + $this->connected = false; - $bytesAddr = unpack("n*", inet_pton($address)); - $bytesTest = unpack("n*", inet_pton($requestIp)); + return true; + } - for ($i = 1, $ceil = ceil($netmask / 16); $i <= $ceil; $i++) { - $left = $netmask - 16 * ($i-1); - $left = ($left <= 16) ? $left : 16; - $mask = ~(0xffff >> $left) & 0xffff; - if (($bytesAddr[$i] & $mask) != ($bytesTest[$i] & $mask)) { - return false; - } + private function getData($key) + { + if (isset($this->storage[$key])) { + return unserialize($this->storage[$key]); } + return false; + } + + private function storeData($key, $value) + { + $this->storage[$key] = serialize($value); + return true; } } diff --git a/core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php similarity index 16% copy from core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php copy to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php index 0e792d0..2b17d70 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/MemcachedMock.php @@ -9,172 +9,217 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\EventDispatcher; +namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock; /** - * Event encapsulation class. + * MemcachedMock for simulating Memcached extension in tests. * - * Encapsulates events thus decoupling the observer from the subject they encapsulate. - * - * @author Drak + * @author Andrej Hudec */ -class GenericEvent extends Event implements \ArrayAccess +class MemcachedMock { - /** - * Observer pattern subject. - * - * @var mixed usually object or callable - */ - protected $subject; - - /** - * Array of arguments. - * - * @var array - */ - protected $arguments; + private $connected; + private $storage; - /** - * Encapsulate an event with $subject, $args, and $data. - * - * @param mixed $subject The subject of the event, usually an object. - * @param array $arguments Arguments to store in the event. - */ - public function __construct($subject = null, array $arguments = array()) + public function __construct() { - $this->subject = $subject; - $this->arguments = $arguments; + $this->connected = false; + $this->storage = array(); } /** - * Getter for subject property. + * Set a Memcached option + * + * @param integer $option + * @param mixed $value * - * @return mixed $subject The observer subject. + * @return boolean */ - public function getSubject() + public function setOption($option, $value) { - return $this->subject; + return true; } /** - * Get argument by key. - * - * @param string $key Key. + * Add a memcached server to connection pool * - * @throws \InvalidArgumentException If key is not found. + * @param string $host + * @param integer $port + * @param integer $weight * - * @return mixed Contents of array key. + * @return boolean */ - public function getArgument($key) + public function addServer($host, $port = 11211, $weight = 0) { - if ($this->hasArgument($key)) { - return $this->arguments[$key]; + if ('127.0.0.1' == $host && 11211 == $port) { + $this->connected = true; + + return true; } - throw new \InvalidArgumentException(sprintf('%s not found in %s', $key, $this->getName())); + return false; } /** - * Add argument to event. + * Add an item to the server only if such key doesn't exist at the server yet. * - * @param string $key Argument name. - * @param mixed $value Value. + * @param string $key + * @param mixed $value + * @param integer $expiration * - * @return GenericEvent + * @return boolean */ - public function setArgument($key, $value) + public function add($key, $value, $expiration = 0) { - $this->arguments[$key] = $value; + if (!$this->connected) { + return false; + } - return $this; - } + if (!isset($this->storage[$key])) { + $this->storeData($key, $value); - /** - * Getter for all arguments. - * - * @return array - */ - public function getArguments() - { - return $this->arguments; + return true; + } + + return false; } /** - * Set args property. + * Store data at the server. * - * @param array $args Arguments. + * @param string $key + * @param mixed $value + * @param integer $expiration * - * @return GenericEvent + * @return boolean */ - public function setArguments(array $args = array()) + public function set($key, $value, $expiration = null) { - $this->arguments = $args; + if (!$this->connected) { + return false; + } + + $this->storeData($key, $value); - return $this; + return true; } /** - * Has argument. + * Replace value of the existing item. * - * @param string $key Key of arguments array. + * @param string $key + * @param mixed $value + * @param integer $expiration * * @return boolean */ - public function hasArgument($key) + public function replace($key, $value, $expiration = null) { - return array_key_exists($key, $this->arguments); + if (!$this->connected) { + return false; + } + + if (isset($this->storage[$key])) { + $this->storeData($key, $value); + + return true; + } + + return false; } /** - * ArrayAccess for argument getter. + * Retrieve item from the server. * - * @param string $key Array key. + * @param string $key + * @param callable $cache_cb + * @param float $cas_token * - * @throws \InvalidArgumentException If key does not exist in $this->args. - * - * @return mixed + * @return boolean */ - public function offsetGet($key) + public function get($key, $cache_cb = null, &$cas_token = null) { - return $this->getArgument($key); + if (!$this->connected) { + return false; + } + + return $this->getData($key); } /** - * ArrayAccess for argument setter. + * Append data to an existing item * - * @param string $key Array key to set. - * @param mixed $value Value. + * @param string $key + * @param string $value * - * @return void + * @return boolean */ - public function offsetSet($key, $value) + public function append($key, $value) { - $this->setArgument($key, $value); + if (!$this->connected) { + return false; + } + + if (isset($this->storage[$key])) { + $this->storeData($key, $this->getData($key).$value); + + return true; + } + + return false; } /** - * ArrayAccess for unset argument. + * Delete item from the server * - * @param string $key Array key. + * @param string $key * - * @return void + * @return boolean */ - public function offsetUnset($key) + public function delete($key) { - if ($this->hasArgument($key)) { - unset($this->arguments[$key]); + if (!$this->connected) { + return false; + } + + if (isset($this->storage[$key])) { + unset($this->storage[$key]); + + return true; } + + return false; } /** - * ArrayAccess has argument. - * - * @param string $key Array key. + * Flush all existing items at the server * * @return boolean */ - public function offsetExists($key) + public function flush() { - return $this->hasArgument($key); + if (!$this->connected) { + return false; + } + + $this->storage = array(); + + return true; + } + + private function getData($key) + { + if (isset($this->storage[$key])) { + return unserialize($this->storage[$key]); + } + + return false; + } + + private function storeData($key, $value) + { + $this->storage[$key] = serialize($value); + + return true; } } diff --git a/core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php similarity index 16% rename from core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php index 0e792d0..b79e097 100644 --- a/core/vendor/Symfony/Component/EventDispatcher/GenericEvent.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/Mock/RedisMock.php @@ -9,172 +9,233 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\EventDispatcher; +namespace Symfony\Component\HttpKernel\Tests\Profiler\Mock; /** - * Event encapsulation class. + * RedisMock for simulating Redis extension in tests. * - * Encapsulates events thus decoupling the observer from the subject they encapsulate. - * - * @author Drak + * @author Andrej Hudec */ -class GenericEvent extends Event implements \ArrayAccess +class RedisMock { - /** - * Observer pattern subject. - * - * @var mixed usually object or callable - */ - protected $subject; - /** - * Array of arguments. - * - * @var array - */ - protected $arguments; + private $connected; + private $storage; - /** - * Encapsulate an event with $subject, $args, and $data. - * - * @param mixed $subject The subject of the event, usually an object. - * @param array $arguments Arguments to store in the event. - */ - public function __construct($subject = null, array $arguments = array()) + public function __construct() { - $this->subject = $subject; - $this->arguments = $arguments; + $this->connected = false; + $this->storage = array(); } /** - * Getter for subject property. + * Add a memcached server to connection pool * - * @return mixed $subject The observer subject. + * @param string $host + * @param integer $port + * @param float $timeout + * + * @return boolean */ - public function getSubject() + public function connect($host, $port = 6379, $timeout = 0) { - return $this->subject; + if ('127.0.0.1' == $host && 6379 == $port) { + $this->connected = true; + + return true; + } + + return false; } /** - * Get argument by key. + * Set client option. * - * @param string $key Key. + * @param integer $name + * @param integer $value * - * @throws \InvalidArgumentException If key is not found. - * - * @return mixed Contents of array key. + * @return boolean */ - public function getArgument($key) + public function setOption($name, $value) { - if ($this->hasArgument($key)) { - return $this->arguments[$key]; + if (!$this->connected) { + return false; } - throw new \InvalidArgumentException(sprintf('%s not found in %s', $key, $this->getName())); + return true; } /** - * Add argument to event. + * Verify if the specified key exists. * - * @param string $key Argument name. - * @param mixed $value Value. + * @param string $key * - * @return GenericEvent + * @return boolean */ - public function setArgument($key, $value) + public function exists($key) { - $this->arguments[$key] = $value; + if (!$this->connected) { + return false; + } - return $this; + return isset($this->storage[$key]); } /** - * Getter for all arguments. + * Store data at the server with expiration time. * - * @return array + * @param string $key + * @param integer $ttl + * @param mixed $value + * + * @return boolean */ - public function getArguments() + public function setex($key, $ttl, $value) { - return $this->arguments; + if (!$this->connected) { + return false; + } + + $this->storeData($key, $value); + + return true; } /** - * Set args property. + * Sets an expiration time on an item. * - * @param array $args Arguments. + * @param string $key + * @param integer $ttl * - * @return GenericEvent + * @return boolean */ - public function setArguments(array $args = array()) + public function setTimeout($key, $ttl) { - $this->arguments = $args; + if (!$this->connected) { + return false; + } - return $this; + if (isset($this->storage[$key])) { + return true; + } + + return false; } /** - * Has argument. + * Retrieve item from the server. * - * @param string $key Key of arguments array. + * @param string $key * * @return boolean */ - public function hasArgument($key) + public function get($key) { - return array_key_exists($key, $this->arguments); + if (!$this->connected) { + return false; + } + + return $this->getData($key); } /** - * ArrayAccess for argument getter. + * Append data to an existing item * - * @param string $key Array key. + * @param string $key + * @param string $value * - * @throws \InvalidArgumentException If key does not exist in $this->args. - * - * @return mixed + * @return integer Size of the value after the append. */ - public function offsetGet($key) + public function append($key, $value) { - return $this->getArgument($key); + if (!$this->connected) { + return false; + } + + if (isset($this->storage[$key])) { + $this->storeData($key, $this->getData($key).$value); + + return strlen($this->storage[$key]); + } + + return false; } /** - * ArrayAccess for argument setter. + * Remove specified keys. * - * @param string $key Array key to set. - * @param mixed $value Value. + * @param string|array $key * - * @return void + * @return integer */ - public function offsetSet($key, $value) + public function delete($key) { - $this->setArgument($key, $value); + if (!$this->connected) { + return false; + } + + if (is_array($key)) { + $result = 0; + foreach ($key as $k) { + if (isset($this->storage[$k])) { + unset($this->storage[$k]); + ++$result; + } + } + + return $result; + } + + if (isset($this->storage[$key])) { + unset($this->storage[$key]); + + return 1; + } + + return 0; } /** - * ArrayAccess for unset argument. - * - * @param string $key Array key. + * Flush all existing items from all databases at the server. * - * @return void + * @return boolean */ - public function offsetUnset($key) + public function flushAll() { - if ($this->hasArgument($key)) { - unset($this->arguments[$key]); + if (!$this->connected) { + return false; } + + $this->storage = array(); + + return true; } /** - * ArrayAccess has argument. - * - * @param string $key Array key. + * Close Redis server connection * * @return boolean */ - public function offsetExists($key) + public function close() + { + $this->connected = false; + + return true; + } + + private function getData($key) { - return $this->hasArgument($key); + if (isset($this->storage[$key])) { + return unserialize($this->storage[$key]); + } + + return false; + } + + private function storeData($key, $value) + { + $this->storage[$key] = serialize($value); + + return true; } } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php similarity index 96% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php index 310320c..4679a0e 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -75,7 +75,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest if (self::$storage) { self::$storage->purge(); } else { - $this->markTestSkipped('MongoDbProfilerStorageTest requires then mongo PHP extennsion and a MongoDB server on localhost'); + $this->markTestSkipped('MongoDbProfilerStorageTest requires the mongo PHP extension and a MongoDB server on localhost'); } } } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/ProfilerTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php similarity index 56% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php index 88779bc..91354ae 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php @@ -12,14 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage; - -class DummyRedisProfilerStorage extends RedisProfilerStorage -{ - public function getRedis() - { - return parent::getRedis(); - } -} +use Symfony\Component\HttpKernel\Tests\Profiler\Mock\RedisMock; class RedisProfilerStorageTest extends AbstractProfilerStorageTest { @@ -27,19 +20,14 @@ class RedisProfilerStorageTest extends AbstractProfilerStorageTest protected function setUp() { - if (!extension_loaded('redis')) { - $this->markTestSkipped('RedisProfilerStorageTest requires redis extension to be loaded'); - } + $redisMock = new RedisMock(); + $redisMock->connect('127.0.0.1', 6379); - self::$storage = new DummyRedisProfilerStorage('redis://127.0.0.1:6379', '', '', 86400); - try { - self::$storage->getRedis(); + self::$storage = new RedisProfilerStorage('redis://127.0.0.1:6379', '', '', 86400); + self::$storage->setRedis($redisMock); + if (self::$storage) { self::$storage->purge(); - - } catch (\Exception $e) { - self::$storage = false; - $this->markTestSkipped('RedisProfilerStorageTest requires that there is a Redis server present on localhost'); } } @@ -47,7 +35,6 @@ class RedisProfilerStorageTest extends AbstractProfilerStorageTest { if (self::$storage) { self::$storage->purge(); - self::$storage->getRedis()->close(); self::$storage = false; } } diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php similarity index 100% rename from core/vendor/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/TestHttpKernel.php diff --git a/core/vendor/Symfony/Component/Yaml/Tests/bootstrap.php b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/bootstrap.php similarity index 62% copy from core/vendor/Symfony/Component/Yaml/Tests/bootstrap.php copy to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/bootstrap.php index 985f1f2..24b1009 100644 --- a/core/vendor/Symfony/Component/Yaml/Tests/bootstrap.php +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Tests/bootstrap.php @@ -10,9 +10,13 @@ */ spl_autoload_register(function ($class) { - if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Yaml')) { - if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Yaml')).'.php')) { + if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\HttpKernel')) { + if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\HttpKernel')).'.php')) { require_once $file; } } }); + +if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) { + require_once $loader; +} diff --git a/core/vendor/Symfony/Component/HttpKernel/composer.json b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/composer.json similarity index 68% rename from core/vendor/Symfony/Component/HttpKernel/composer.json rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/composer.json index 95fb176..e8c693f 100644 --- a/core/vendor/Symfony/Component/HttpKernel/composer.json +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/composer.json @@ -16,9 +16,19 @@ } ], "require": { - "php": ">=5.3.2", - "symfony/event-dispatcher": "self.version", - "symfony/http-foundation": "self.version" + "php": ">=5.3.3", + "symfony/event-dispatcher": "2.1.*", + "symfony/http-foundation": "2.1.*" + }, + "require-dev": { + "symfony/browser-kit": "2.1.*", + "symfony/class-loader": "2.1.*", + "symfony/config": "2.1.*", + "symfony/console": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/finder": "2.1.*", + "symfony/process": "2.1.*", + "symfony/routing": "2.1.*" }, "suggest": { "symfony/browser-kit": "self.version", diff --git a/core/vendor/Symfony/Component/HttpKernel/phpunit.xml.dist b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/phpunit.xml.dist similarity index 93% rename from core/vendor/Symfony/Component/HttpKernel/phpunit.xml.dist rename to core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/phpunit.xml.dist index 0d881e1..dd824ac 100644 --- a/core/vendor/Symfony/Component/HttpKernel/phpunit.xml.dist +++ b/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/phpunit.xml.dist @@ -21,8 +21,8 @@ ./ - ./Resources ./Tests + ./vendor diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/.gitignore b/core/vendor/symfony/routing/Symfony/Component/Routing/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/core/vendor/Symfony/Component/Routing/Annotation/Route.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Annotation/Route.php similarity index 100% copy from core/vendor/Symfony/Component/Routing/Annotation/Route.php copy to core/vendor/symfony/routing/Symfony/Component/Routing/Annotation/Route.php diff --git a/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md b/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md new file mode 100644 index 0000000..741d18c --- /dev/null +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/CHANGELOG.md @@ -0,0 +1,26 @@ +CHANGELOG +========= + +2.1.0 +----- + + * added RequestMatcherInterface + * added RequestContext::fromRequest() + * the UrlMatcher does not throw a \LogicException anymore when the required + scheme is not the current one + * added TraceableUrlMatcher + * added the possibility to define options, default values and requirements + for placeholders in prefix, including imported routes + * added RouterInterface::getRouteCollection + * [BC BREAK] the UrlMatcher urldecodes the route parameters only once, they + were decoded twice before. Note that the `urldecode()` calls have been + changed for a single `rawurldecode()` in order to support `+` for input + paths. + * added RouteCollection::getRoot method to retrieve the root of a + RouteCollection tree + * [BC BREAK] made RouteCollection::setParent private which could not have + been used anyway without creating inconsistencies + * [BC BREAK] RouteCollection::remove also removes a route from parent + collections (not only from its children) + * added strict_parameters option to disable exceptions (and generate empty + URLs instead) when generating a route with an invalid parameter value diff --git a/core/vendor/Symfony/Component/Routing/CompiledRoute.php b/core/vendor/symfony/routing/Symfony/Component/Routing/CompiledRoute.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/CompiledRoute.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/CompiledRoute.php diff --git a/core/vendor/Symfony/Component/Routing/Exception/ExceptionInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Exception/ExceptionInterface.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Exception/ExceptionInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Exception/ExceptionInterface.php diff --git a/core/vendor/Symfony/Component/Routing/Exception/InvalidParameterException.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Exception/InvalidParameterException.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Exception/InvalidParameterException.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Exception/InvalidParameterException.php diff --git a/core/vendor/Symfony/Component/Routing/Exception/MethodNotAllowedException.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Exception/MethodNotAllowedException.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Exception/MethodNotAllowedException.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Exception/MethodNotAllowedException.php diff --git a/core/vendor/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Exception/MissingMandatoryParametersException.php diff --git a/core/vendor/Symfony/Component/Routing/Exception/ResourceNotFoundException.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Exception/ResourceNotFoundException.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Exception/ResourceNotFoundException.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Exception/ResourceNotFoundException.php diff --git a/core/vendor/Symfony/Component/Routing/Exception/RouteNotFoundException.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Exception/RouteNotFoundException.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Exception/RouteNotFoundException.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Exception/RouteNotFoundException.php diff --git a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php similarity index 95% rename from core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php index 1291bd1..408be9c 100644 --- a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumper.php @@ -32,6 +32,9 @@ abstract class GeneratorDumper implements GeneratorDumperInterface $this->routes = $routes; } + /** + * {@inheritdoc} + */ public function getRoutes() { return $this->routes; diff --git a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php similarity index 72% rename from core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php index 7179af2..0f2f684 100644 --- a/core/vendor/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php @@ -23,16 +23,12 @@ use Symfony\Component\Routing\RouteCollection; interface GeneratorDumperInterface { /** - * Dumps a set of routes to a PHP class. + * Dumps a set of routes to a string representation of executable code + * that can then be used to generate a URL of such a route. * - * Available options: + * @param array $options An array of options * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the generator class + * @return string Executable code */ function dump(array $options = array()); diff --git a/core/vendor/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php similarity index 93% rename from core/vendor/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php index 0edd6e9..fad8cea 100644 --- a/core/vendor/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/Dumper/PhpGeneratorDumper.php @@ -31,7 +31,7 @@ class PhpGeneratorDumper extends GeneratorDumper * * class: The class name * * base_class: The base class name * - * @param array $options An array of options + * @param array $options An array of options * * @return string A PHP class representing the generator class * @@ -49,6 +49,7 @@ class PhpGeneratorDumper extends GeneratorDumper use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Exception\RouteNotFoundException; +use Symfony\Component\HttpKernel\Log\LoggerInterface; /** * {$options['class']} @@ -63,9 +64,10 @@ class {$options['class']} extends {$options['base_class']} /** * Constructor. */ - public function __construct(RequestContext \$context) + public function __construct(RequestContext \$context, LoggerInterface \$logger = null) { \$this->context = \$context; + \$this->logger = \$logger; } {$this->generateGenerateMethod()} diff --git a/core/vendor/Symfony/Component/Routing/Generator/UrlGenerator.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php similarity index 78% rename from core/vendor/Symfony/Component/Routing/Generator/UrlGenerator.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php index f47f3e5..760d729 100644 --- a/core/vendor/Symfony/Component/Routing/Generator/UrlGenerator.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGenerator.php @@ -17,6 +17,7 @@ use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Exception\InvalidParameterException; use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; +use Symfony\Component\HttpKernel\Log\LoggerInterface; /** * UrlGenerator generates a URL based on a set of routes. @@ -28,8 +29,10 @@ use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; class UrlGenerator implements UrlGeneratorInterface { protected $context; + protected $strictParameters = true; + protected $logger; protected $decodedChars = array( - // %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitely allowed it) + // %2F is not valid in a URL, so we don't encode it (which is fine as the requirements explicitly allowed it) '%2F' => '/', ); @@ -40,21 +43,19 @@ class UrlGenerator implements UrlGeneratorInterface * * @param RouteCollection $routes A RouteCollection instance * @param RequestContext $context The context + * @param LoggerInterface $logger A logger instance * * @api */ - public function __construct(RouteCollection $routes, RequestContext $context) + public function __construct(RouteCollection $routes, RequestContext $context, LoggerInterface $logger = null) { $this->routes = $routes; $this->context = $context; + $this->logger = $logger; } /** - * Sets the request context. - * - * @param RequestContext $context The context - * - * @api + * {@inheritdoc} */ public function setContext(RequestContext $context) { @@ -62,9 +63,7 @@ class UrlGenerator implements UrlGeneratorInterface } /** - * Gets the request context. - * - * @return RequestContext The context + * {@inheritdoc} */ public function getContext() { @@ -72,9 +71,27 @@ class UrlGenerator implements UrlGeneratorInterface } /** - * {@inheritDoc} + * Enables or disables the exception on incorrect parameters. * - * @api + * @param Boolean $enabled + */ + public function setStrictParameters($enabled) + { + $this->strictParameters = $enabled; + } + + /** + * Gets the strict check of incorrect parameters. + * + * @return Boolean + */ + public function getStrictParameters() + { + return $this->strictParameters; + } + + /** + * {@inheritDoc} */ public function generate($name, $parameters = array(), $absolute = false) { @@ -113,7 +130,16 @@ class UrlGenerator implements UrlGeneratorInterface if (!$isEmpty = in_array($tparams[$token[3]], array(null, '', false), true)) { // check requirement if ($tparams[$token[3]] && !preg_match('#^'.$token[2].'$#', $tparams[$token[3]])) { - throw new InvalidParameterException(sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given).', $token[3], $name, $token[2], $tparams[$token[3]])); + $message = sprintf('Parameter "%s" for route "%s" must match "%s" ("%s" given).', $token[3], $name, $token[2], $tparams[$token[3]]); + if ($this->strictParameters) { + throw new InvalidParameterException($message); + } + + if ($this->logger) { + $this->logger->err($message); + } + + return null; } } @@ -135,7 +161,7 @@ class UrlGenerator implements UrlGeneratorInterface // add a query string if needed $extra = array_diff_key($originParameters, $variables, $defaults); - if ($extra && $query = http_build_query($extra)) { + if ($extra && $query = http_build_query($extra, '', '&')) { $url .= '?'.$query; } diff --git a/core/vendor/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php diff --git a/core/vendor/Symfony/Component/Routing/LICENSE b/core/vendor/symfony/routing/Symfony/Component/Routing/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/Routing/LICENSE rename to core/vendor/symfony/routing/Symfony/Component/Routing/LICENSE diff --git a/core/vendor/Symfony/Component/Routing/Loader/AnnotationClassLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php similarity index 89% rename from core/vendor/Symfony/Component/Routing/Loader/AnnotationClassLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php index 28fa896..d94f7d2 100644 --- a/core/vendor/Symfony/Component/Routing/Loader/AnnotationClassLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationClassLoader.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Routing\Loader; use Doctrine\Common\Annotations\Reader; -use Symfony\Component\Routing\Annotation\Route as RouteAnnotation; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; @@ -161,12 +160,7 @@ abstract class AnnotationClassLoader implements LoaderInterface } /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise + * {@inheritdoc} */ public function supports($resource, $type = null) { @@ -174,18 +168,14 @@ abstract class AnnotationClassLoader implements LoaderInterface } /** - * Sets the loader resolver. - * - * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance + * {@inheritdoc} */ public function setResolver(LoaderResolverInterface $resolver) { } /** - * Gets the loader resolver. - * - * @return LoaderResolverInterface A LoaderResolverInterface instance + * {@inheritdoc} */ public function getResolver() { @@ -194,14 +184,14 @@ abstract class AnnotationClassLoader implements LoaderInterface /** * Gets the default route name for a class method. * - * @param \ReflectionClass $class + * @param \ReflectionClass $class * @param \ReflectionMethod $method * * @return string */ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method) { - $name = strtolower(str_replace('\\', '_', $class->getName()).'_'.$method->getName()); + $name = strtolower(str_replace('\\', '_', $class->name).'_'.$method->name); if ($this->defaultRouteIndex > 0) { $name .= '_'.$this->defaultRouteIndex; } diff --git a/core/vendor/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php similarity index 89% rename from core/vendor/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php index 0fca304..f549fd0 100644 --- a/core/vendor/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationDirectoryLoader.php @@ -62,12 +62,7 @@ class AnnotationDirectoryLoader extends AnnotationFileLoader } /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise + * {@inheritdoc} */ public function supports($resource, $type = null) { diff --git a/core/vendor/Symfony/Component/Routing/Loader/AnnotationFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php similarity index 93% rename from core/vendor/Symfony/Component/Routing/Loader/AnnotationFileLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php index 49e1cb2..bb965e9 100644 --- a/core/vendor/Symfony/Component/Routing/Loader/AnnotationFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/AnnotationFileLoader.php @@ -68,12 +68,7 @@ class AnnotationFileLoader extends FileLoader } /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise + * {@inheritdoc} */ public function supports($resource, $type = null) { diff --git a/core/vendor/Symfony/Component/Routing/Loader/ClosureLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php similarity index 79% rename from core/vendor/Symfony/Component/Routing/Loader/ClosureLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php index ca49c8f..c5ad1e7 100644 --- a/core/vendor/Symfony/Component/Routing/Loader/ClosureLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/ClosureLoader.php @@ -38,12 +38,7 @@ class ClosureLoader extends Loader } /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise + * {@inheritdoc} * * @api */ diff --git a/core/vendor/Symfony/Component/Routing/Loader/PhpFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php similarity index 84% rename from core/vendor/Symfony/Component/Routing/Loader/PhpFileLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php index ffd31f9..de2104b 100644 --- a/core/vendor/Symfony/Component/Routing/Loader/PhpFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/PhpFileLoader.php @@ -48,12 +48,7 @@ class PhpFileLoader extends FileLoader } /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise + * {@inheritdoc} * * @api */ diff --git a/core/vendor/Symfony/Component/Routing/Loader/XmlFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php similarity index 94% rename from core/vendor/Symfony/Component/Routing/Loader/XmlFileLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php index 8f27b03..f83ce6f 100644 --- a/core/vendor/Symfony/Component/Routing/Loader/XmlFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/XmlFileLoader.php @@ -62,8 +62,8 @@ class XmlFileLoader extends FileLoader * Parses a node from a loaded XML file. * * @param RouteCollection $collection the collection to associate with the node - * @param DOMElement $node the node to parse - * @param string $path the path of the XML file being processed + * @param DOMElement $node the node to parse + * @param string $path the path of the XML file being processed * @param string $file */ protected function parseNode(RouteCollection $collection, \DOMElement $node, $path, $file) @@ -110,12 +110,7 @@ class XmlFileLoader extends FileLoader } /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise + * {@inheritdoc} * * @api */ diff --git a/core/vendor/Symfony/Component/Routing/Loader/YamlFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php similarity index 93% rename from core/vendor/Symfony/Component/Routing/Loader/YamlFileLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php index 1f9d711..d51e339 100644 --- a/core/vendor/Symfony/Component/Routing/Loader/YamlFileLoader.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/YamlFileLoader.php @@ -82,12 +82,7 @@ class YamlFileLoader extends FileLoader } /** - * Returns true if this class supports the given resource. - * - * @param mixed $resource A resource - * @param string $type The resource type - * - * @return Boolean True if this class supports the given resource, false otherwise + * {@inheritdoc} * * @api */ @@ -124,7 +119,7 @@ class YamlFileLoader extends FileLoader /** * Normalize route configuration. * - * @param array $config A resource config + * @param array $config A resource config * * @return array * diff --git a/core/vendor/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd b/core/vendor/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd similarity index 100% rename from core/vendor/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd rename to core/vendor/symfony/routing/Symfony/Component/Routing/Loader/schema/routing/routing-1.0.xsd diff --git a/core/vendor/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php similarity index 99% rename from core/vendor/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php index 7499bdd..6e0561d 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -144,7 +144,7 @@ class ApacheMatcherDumper extends MatcherDumper { $escaped = false; $output = ''; - foreach(str_split($string) as $symbol) { + foreach (str_split($string) as $symbol) { if ($escaped) { $output .= $symbol; $escaped = false; diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php similarity index 89% rename from core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php index 423368b..30778cc 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumper.php @@ -33,9 +33,7 @@ abstract class MatcherDumper implements MatcherDumperInterface } /** - * Gets the routes to dump. - * - * @return RouteCollection A RouteCollection instance + * {@inheritdoc} */ public function getRoutes() { diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php similarity index 67% rename from core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php index 950c396..08d03f5 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php @@ -19,21 +19,17 @@ namespace Symfony\Component\Routing\Matcher\Dumper; interface MatcherDumperInterface { /** - * Dumps a set of routes to a PHP class. + * Dumps a set of routes to a string representation of executable code + * that can then be used to match a request against these routes. * - * Available options: + * @param array $options An array of options * - * * class: The class name - * * base_class: The base class name - * - * @param array $options An array of options - * - * @return string A PHP class representing the matcher class + * @return string Executable code */ function dump(array $options = array()); /** - * Gets the routes to match. + * Gets the routes to dump. * * @return RouteCollection A RouteCollection instance */ diff --git a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php similarity index 99% rename from core/vendor/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php index bc26c0c..a8e0dcb 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php @@ -30,7 +30,7 @@ class PhpMatcherDumper extends MatcherDumper * * class: The class name * * base_class: The base class name * - * @param array $options An array of options + * @param array $options An array of options * * @return string A PHP class representing the matcher class */ @@ -231,6 +231,7 @@ EOF; goto $gotoname; } + EOF; } else { $methods = implode("', '", $methods); @@ -240,6 +241,7 @@ EOF; goto $gotoname; } + EOF; } } @@ -250,6 +252,7 @@ EOF; return \$this->redirect(\$pathinfo.'/', '$name'); } + EOF; } @@ -263,6 +266,7 @@ EOF; return \$this->redirect(\$pathinfo, '$name', '$scheme'); } + EOF; } @@ -271,7 +275,7 @@ EOF; $code .= sprintf(" return array_merge(\$this->mergeDefaults(\$matches, %s), array('_route' => '%s'));\n" , str_replace("\n", '', var_export($compiledRoute->getDefaults(), true)), $name); } elseif (true === $matches) { - $code .= sprintf(" \$matches['_route'] = '%s';\n", $name); + $code .= sprintf(" \$matches['_route'] = '%s';\n\n", $name); $code .= " return \$matches;\n"; } elseif ($compiledRoute->getDefaults()) { $code .= sprintf(" return %s;\n", str_replace("\n", '', var_export(array_merge($compiledRoute->getDefaults(), array('_route' => $name)), true))); diff --git a/core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php similarity index 96% rename from core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php index ee8005d..8826c59 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcher.php @@ -22,9 +22,7 @@ use Symfony\Component\Routing\Route; abstract class RedirectableUrlMatcher extends UrlMatcher implements RedirectableUrlMatcherInterface { /** - * @see UrlMatcher::match() - * - * @api + * {@inheritdoc} */ public function match($pathinfo) { diff --git a/core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php similarity index 77% rename from core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php index 72a2ec4..7225c81 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php @@ -23,9 +23,9 @@ interface RedirectableUrlMatcherInterface /** * Redirects the user to another URL. * - * @param string $path The path info to redirect to. - * @param string $route The route that matched - * @param string $scheme The URL scheme (null to keep the current one) + * @param string $path The path info to redirect to. + * @param string $route The route that matched + * @param string $scheme The URL scheme (null to keep the current one) * * @return array An array of parameters * diff --git a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php similarity index 64% copy from core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php copy to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php index 58c5688..6a5c235 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php @@ -11,6 +11,7 @@ namespace Symfony\Component\Routing\Matcher; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\MethodNotAllowedException; @@ -19,25 +20,21 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException; * UrlMatcherInterface is the interface that all URL matcher classes must implement. * * @author Fabien Potencier - * - * @api */ -interface UrlMatcherInterface extends RequestContextAwareInterface +interface RequestMatcherInterface extends RequestContextAwareInterface { /** - * Tries to match a URL with a set of routes. + * Tries to match a request with a set of routes. * * If the matcher can not find information, it must throw one of the exceptions documented * below. * - * @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded) + * @param Request $request The request to match * * @return array An array of parameters * - * @throws ResourceNotFoundException If the resource could not be found - * @throws MethodNotAllowedException If the resource was found but the request method is not allowed - * - * @api + * @throws ResourceNotFoundException If no matching resource could be found + * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed */ - function match($pathinfo); + function matchRequest(Request $request); } diff --git a/core/vendor/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/TraceableUrlMatcher.php diff --git a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php similarity index 89% rename from core/vendor/Symfony/Component/Routing/Matcher/UrlMatcher.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php index ded89e6..33c7f54 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -50,11 +50,7 @@ class UrlMatcher implements UrlMatcherInterface } /** - * Sets the request context. - * - * @param RequestContext $context The context - * - * @api + * {@inheritdoc} */ public function setContext(RequestContext $context) { @@ -62,9 +58,7 @@ class UrlMatcher implements UrlMatcherInterface } /** - * Gets the request context. - * - * @return RequestContext The context + * {@inheritdoc} */ public function getContext() { @@ -72,16 +66,7 @@ class UrlMatcher implements UrlMatcherInterface } /** - * Tries to match a URL with a set of routes. - * - * @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded) - * - * @return array An array of parameters - * - * @throws ResourceNotFoundException If the resource could not be found - * @throws MethodNotAllowedException If the resource was found but the request method is not allowed - * - * @api + * {@inheritdoc} */ public function match($pathinfo) { @@ -177,8 +162,16 @@ class UrlMatcher implements UrlMatcherInterface $status = $scheme && $scheme !== $this->context->getScheme() ? self::REQUIREMENT_MISMATCH : self::REQUIREMENT_MATCH; return array($status, null); - } + } + /** + * Get merged default parameters. + * + * @param array $params The parameters + * @param array $defaults The defaults + * + * @return array Merged default parameters + */ protected function mergeDefaults($params, $defaults) { $parameters = $defaults; diff --git a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php similarity index 92% rename from core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php index 58c5688..afccf80 100644 --- a/core/vendor/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php @@ -30,7 +30,7 @@ interface UrlMatcherInterface extends RequestContextAwareInterface * If the matcher can not find information, it must throw one of the exceptions documented * below. * - * @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded) + * @param string $pathinfo The path info to be parsed (raw format, i.e. not urldecoded) * * @return array An array of parameters * diff --git a/core/vendor/Symfony/Component/Routing/README.md b/core/vendor/symfony/routing/Symfony/Component/Routing/README.md similarity index 78% rename from core/vendor/Symfony/Component/Routing/README.md rename to core/vendor/symfony/routing/Symfony/Component/Routing/README.md index 63c398c..61504c8 100644 --- a/core/vendor/Symfony/Component/Routing/README.md +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/README.md @@ -29,12 +29,9 @@ Resources You can run the unit tests with the following command: - phpunit -c src/Symfony/Component/Routing/ + phpunit If you also want to run the unit tests that depend on other Symfony -Components, declare the following environment variables before running -PHPUnit: +Components, install dev dependencies before running PHPUnit: - export SYMFONY_CONFIG=../path/to/Config - export SYMFONY_YAML=../path/to/Yaml - export DOCTRINE_COMMON=../path/to/doctrine-common + php composer.phar install --dev diff --git a/core/vendor/Symfony/Component/Routing/RequestContext.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContext.php similarity index 99% rename from core/vendor/Symfony/Component/Routing/RequestContext.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/RequestContext.php index 013d942..7406b20 100644 --- a/core/vendor/Symfony/Component/Routing/RequestContext.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContext.php @@ -250,7 +250,7 @@ class RequestContext /** * Sets a parameter value. * - * @param string $name A parameter name + * @param string $name A parameter name * @param mixed $parameter The parameter value * * @api diff --git a/core/vendor/Symfony/Component/Routing/RequestContextAwareInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/RequestContextAwareInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/RequestContextAwareInterface.php diff --git a/core/vendor/Symfony/Component/Routing/Route.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php similarity index 96% copy from core/vendor/Symfony/Component/Routing/Route.php copy to core/vendor/symfony/routing/Symfony/Component/Routing/Route.php index 05d8a74..f18b0ed 100644 --- a/core/vendor/Symfony/Component/Routing/Route.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Route.php @@ -35,10 +35,10 @@ class Route * * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) * - * @param string $pattern The pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options + * @param string $pattern The pattern to match + * @param array $defaults An array of default parameter values + * @param array $requirements An array of requirements for parameters (regexes) + * @param array $options An array of options * * @api */ @@ -314,7 +314,7 @@ class Route /** * Sets a requirement for the given key. * - * @param string $key The key + * @param string $key The key * @param string $regex The regex * * @return Route The current Route instance diff --git a/core/vendor/Symfony/Component/Routing/RouteCollection.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/RouteCollection.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/RouteCollection.php diff --git a/core/vendor/Symfony/Component/Routing/RouteCompiler.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php similarity index 84% rename from core/vendor/Symfony/Component/Routing/RouteCompiler.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php index dc5e5e6..b93d36b 100644 --- a/core/vendor/Symfony/Component/Routing/RouteCompiler.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompiler.php @@ -21,11 +21,9 @@ class RouteCompiler implements RouteCompilerInterface const REGEX_DELIMITER = '#'; /** - * Compiles the current route instance. + * {@inheritDoc} * - * @param Route $route A Route instance - * - * @return CompiledRoute A CompiledRoute instance + * @throws \LogicException If a variable is referenced more than once */ public function compile(Route $route) { @@ -34,22 +32,26 @@ class RouteCompiler implements RouteCompilerInterface $tokens = array(); $variables = array(); $pos = 0; - preg_match_all('#.\{([\w\d_]+)\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); + preg_match_all('#.\{(\w+)\}#', $pattern, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER); foreach ($matches as $match) { if ($text = substr($pattern, $pos, $match[0][1] - $pos)) { $tokens[] = array('text', $text); } - $seps = array($pattern[$pos]); + $pos = $match[0][1] + strlen($match[0][0]); $var = $match[1][0]; if ($req = $route->getRequirement($var)) { $regexp = $req; } else { + // Use the character preceding the variable as a separator + $separators = array($match[0][0][0]); + if ($pos !== $len) { - $seps[] = $pattern[$pos]; + // Use the character following the variable as the separator when available + $separators[] = $pattern[$pos]; } - $regexp = sprintf('[^%s]+?', preg_quote(implode('', array_unique($seps)), self::REGEX_DELIMITER)); + $regexp = sprintf('[^%s]+', preg_quote(implode('', array_unique($separators)), self::REGEX_DELIMITER)); } $tokens[] = array('variable', $match[0][0][0], $regexp, $var); @@ -103,12 +105,12 @@ class RouteCompiler implements RouteCompilerInterface private function computeRegexp(array $tokens, $index, $firstOptional) { $token = $tokens[$index]; - if('text' === $token[0]) { + if ('text' === $token[0]) { // Text tokens return preg_quote($token[1], self::REGEX_DELIMITER); } else { // Variable tokens - if (0 === $index && 0 === $firstOptional && 1 == count($tokens)) { + if (0 === $index && 0 === $firstOptional) { // When the only token is an optional variable token, the separator is required return sprintf('%s(?<%s>%s)?', preg_quote($token[1], self::REGEX_DELIMITER), $token[3], $token[2]); } else { @@ -121,7 +123,7 @@ class RouteCompiler implements RouteCompilerInterface $nbTokens = count($tokens); if ($nbTokens - 1 == $index) { // Close the optional subpatterns - $regexp .= str_repeat(")?", $nbTokens - $firstOptional); + $regexp .= str_repeat(")?", $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0)); } } diff --git a/core/vendor/Symfony/Component/Routing/RouteCompilerInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php similarity index 100% copy from core/vendor/Symfony/Component/Routing/RouteCompilerInterface.php copy to core/vendor/symfony/routing/Symfony/Component/Routing/RouteCompilerInterface.php diff --git a/core/vendor/Symfony/Component/Routing/Router.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Router.php similarity index 81% rename from core/vendor/Symfony/Component/Routing/Router.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Router.php index 3497029..2e0333e 100644 --- a/core/vendor/Symfony/Component/Routing/Router.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Router.php @@ -13,6 +13,7 @@ namespace Symfony\Component\Routing; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\Config\ConfigCache; +use Symfony\Component\HttpKernel\Log\LoggerInterface; /** * The Router class is an example of the integration of all pieces of the @@ -24,12 +25,12 @@ class Router implements RouterInterface { protected $matcher; protected $generator; - protected $defaults; protected $context; protected $loader; protected $collection; protected $resource; protected $options; + protected $logger; /** * Constructor. @@ -38,14 +39,14 @@ class Router implements RouterInterface * @param mixed $resource The main resource to load * @param array $options An array of options * @param RequestContext $context The context - * @param array $defaults The default values + * @param LoggerInterface $logger A logger instance */ - public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, array $defaults = array()) + public function __construct(LoaderInterface $loader, $resource, array $options = array(), RequestContext $context = null, LoggerInterface $logger = null) { $this->loader = $loader; $this->resource = $resource; + $this->logger = $logger; $this->context = null === $context ? new RequestContext() : $context; - $this->defaults = $defaults; $this->setOptions($options); } @@ -76,6 +77,7 @@ class Router implements RouterInterface 'matcher_dumper_class' => 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper', 'matcher_cache_class' => 'ProjectUrlMatcher', 'resource_type' => null, + 'strict_parameters' => true, ); // check option names and live merge, if errors are encountered Exception will be thrown @@ -131,9 +133,7 @@ class Router implements RouterInterface } /** - * Gets the RouteCollection instance associated with this Router. - * - * @return RouteCollection A RouteCollection instance + * {@inheritdoc} */ public function getRouteCollection() { @@ -145,9 +145,7 @@ class Router implements RouterInterface } /** - * Sets the request context. - * - * @param RequestContext $context The context + * {@inheritdoc} */ public function setContext(RequestContext $context) { @@ -158,9 +156,7 @@ class Router implements RouterInterface } /** - * Gets the request context. - * - * @return RequestContext The context + * {@inheritdoc} */ public function getContext() { @@ -195,7 +191,7 @@ class Router implements RouterInterface } if (null === $this->options['cache_dir'] || null === $this->options['matcher_cache_class']) { - return $this->matcher = new $this->options['matcher_class']($this->getRouteCollection(), $this->context, $this->defaults); + return $this->matcher = new $this->options['matcher_class']($this->getRouteCollection(), $this->context); } $class = $this->options['matcher_cache_class']; @@ -213,7 +209,7 @@ class Router implements RouterInterface require_once $cache; - return $this->matcher = new $class($this->context, $this->defaults); + return $this->matcher = new $class($this->context); } /** @@ -228,24 +224,30 @@ class Router implements RouterInterface } if (null === $this->options['cache_dir'] || null === $this->options['generator_cache_class']) { - return $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->defaults); - } - - $class = $this->options['generator_cache_class']; - $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']); - if (!$cache->isFresh($class)) { - $dumper = new $this->options['generator_dumper_class']($this->getRouteCollection()); + $this->generator = new $this->options['generator_class']($this->getRouteCollection(), $this->context, $this->logger); + } else { + $class = $this->options['generator_cache_class']; + $cache = new ConfigCache($this->options['cache_dir'].'/'.$class.'.php', $this->options['debug']); + if (!$cache->isFresh($class)) { + $dumper = new $this->options['generator_dumper_class']($this->getRouteCollection()); + + $options = array( + 'class' => $class, + 'base_class' => $this->options['generator_base_class'], + ); + + $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); + } - $options = array( - 'class' => $class, - 'base_class' => $this->options['generator_base_class'], - ); + require_once $cache; - $cache->write($dumper->dump($options), $this->getRouteCollection()->getResources()); + $this->generator = new $class($this->context, $this->logger); } - require_once $cache; + if (false === $this->options['strict_parameters']) { + $this->generator->setStrictParameters(false); + } - return $this->generator = new $class($this->context, $this->defaults); + return $this->generator; } } diff --git a/core/vendor/Symfony/Component/Routing/RouterInterface.php b/core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/RouterInterface.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/RouterInterface.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php similarity index 100% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Annotation/RouteTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/CompiledRouteTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/CompiledRouteTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/CompiledRouteTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/CompiledRouteTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/AbstractClass.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooClass.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooClass.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooClass.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/AnnotatedClasses/FooClass.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/CustomXmlFileLoader.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/RedirectableUrlMatcher.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/annotated.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/annotated.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/annotated.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/annotated.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache similarity index 79% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache index a937998..25f6060 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache @@ -7,17 +7,17 @@ RewriteCond %{REQUEST_URI} ^/foo/(baz|symfony)$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_def:test] # bar -RewriteCond %{REQUEST_URI} ^/bar/([^/]+?)$ +RewriteCond %{REQUEST_URI} ^/bar/([^/]+)$ RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [NC] RewriteRule .* - [S=1,E=_ROUTING__allow_GET:1,E=_ROUTING__allow_HEAD:1] -RewriteCond %{REQUEST_URI} ^/bar/([^/]+?)$ +RewriteCond %{REQUEST_URI} ^/bar/([^/]+)$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:bar,E=_ROUTING_foo:%1] # baragain -RewriteCond %{REQUEST_URI} ^/baragain/([^/]+?)$ +RewriteCond %{REQUEST_URI} ^/baragain/([^/]+)$ RewriteCond %{REQUEST_METHOD} !^(GET|POST|HEAD)$ [NC] RewriteRule .* - [S=1,E=_ROUTING__allow_GET:1,E=_ROUTING__allow_POST:1,E=_ROUTING__allow_HEAD:1] -RewriteCond %{REQUEST_URI} ^/baragain/([^/]+?)$ +RewriteCond %{REQUEST_URI} ^/baragain/([^/]+)$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baragain,E=_ROUTING_foo:%1] # baz @@ -35,25 +35,25 @@ RewriteCond %{REQUEST_URI} ^/test/baz3/$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz3] # baz4 -RewriteCond %{REQUEST_URI} ^/test/([^/]+?)$ +RewriteCond %{REQUEST_URI} ^/test/([^/]+)$ RewriteRule .* $0/ [QSA,L,R=301] -RewriteCond %{REQUEST_URI} ^/test/([^/]+?)/$ +RewriteCond %{REQUEST_URI} ^/test/([^/]+)/$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz4,E=_ROUTING_foo:%1] # baz5 -RewriteCond %{REQUEST_URI} ^/test/([^/]+?)/$ +RewriteCond %{REQUEST_URI} ^/test/([^/]+)/$ RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [NC] RewriteRule .* - [S=2,E=_ROUTING__allow_GET:1,E=_ROUTING__allow_HEAD:1] -RewriteCond %{REQUEST_URI} ^/test/([^/]+?)$ +RewriteCond %{REQUEST_URI} ^/test/([^/]+)$ RewriteRule .* $0/ [QSA,L,R=301] -RewriteCond %{REQUEST_URI} ^/test/([^/]+?)/$ +RewriteCond %{REQUEST_URI} ^/test/([^/]+)/$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz5,E=_ROUTING_foo:%1] # baz5unsafe -RewriteCond %{REQUEST_URI} ^/testunsafe/([^/]+?)/$ +RewriteCond %{REQUEST_URI} ^/testunsafe/([^/]+)/$ RewriteCond %{REQUEST_METHOD} !^(POST)$ [NC] RewriteRule .* - [S=1,E=_ROUTING__allow_POST:1] -RewriteCond %{REQUEST_URI} ^/testunsafe/([^/]+?)/$ +RewriteCond %{REQUEST_URI} ^/testunsafe/([^/]+)/$ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz5unsafe,E=_ROUTING_foo:%1] # baz6 diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php similarity index 85% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php index 2c764d0..53e86fa 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.php @@ -31,23 +31,27 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher } // bar - if (0 === strpos($pathinfo, '/bar') && preg_match('#^/bar/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/bar') && preg_match('#^/bar/(?[^/]+)$#s', $pathinfo, $matches)) { if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) { $allow = array_merge($allow, array('GET', 'HEAD')); goto not_bar; } + $matches['_route'] = 'bar'; + return $matches; } not_bar: // barhead - if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?[^/]+)$#s', $pathinfo, $matches)) { if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) { $allow = array_merge($allow, array('GET', 'HEAD')); goto not_barhead; } + $matches['_route'] = 'barhead'; + return $matches; } not_barhead: @@ -68,29 +72,34 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher } // baz4 - if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+?)/$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+)/$#s', $pathinfo, $matches)) { $matches['_route'] = 'baz4'; + return $matches; } // baz5 - if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+?)/$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+)/$#s', $pathinfo, $matches)) { if ($this->context->getMethod() != 'POST') { $allow[] = 'POST'; goto not_baz5; } + $matches['_route'] = 'baz5'; + return $matches; } not_baz5: // baz.baz6 - if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+?)/$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+)/$#s', $pathinfo, $matches)) { if ($this->context->getMethod() != 'PUT') { $allow[] = 'PUT'; goto not_bazbaz6; } + $matches['_route'] = 'baz.baz6'; + return $matches; } not_bazbaz6: @@ -103,6 +112,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // quoter if (preg_match('#^/(?[\']+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'quoter'; + return $matches; } @@ -114,14 +124,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if (0 === strpos($pathinfo, '/a')) { if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo1'; + return $matches; } // bar1 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar1'; + return $matches; } @@ -130,19 +142,22 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher // overriden if (preg_match('#^/a/(?.*)$#s', $pathinfo, $matches)) { $matches['_route'] = 'overriden'; + return $matches; } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo2'; + return $matches; } // bar2 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar2'; + return $matches; } @@ -152,7 +167,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if (0 === strpos($pathinfo, '/multi')) { // helloWorld - if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?[^/]+?))?$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?[^/]+))?$#s', $pathinfo, $matches)) { return array_merge($this->mergeDefaults($matches, array ( 'who' => 'World!',)), array('_route' => 'helloWorld')); } @@ -169,14 +184,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher } // foo3 - if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/(?<_locale>[^/]+)/b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo3'; + return $matches; } // bar3 - if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/(?<_locale>[^/]+)/b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar3'; + return $matches; } @@ -186,8 +203,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher } // foo4 - if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo4'; + return $matches; } @@ -199,14 +217,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher if (0 === strpos($pathinfo, '/a/b')) { // b - if (preg_match('#^/a/b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'b'; + return $matches; } // c - if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'c'; + return $matches; } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.apache b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.apache similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.apache rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.apache diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php similarity index 87% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php index 4b9af5c..a3c105c 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher2.php @@ -31,23 +31,27 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec } // bar - if (0 === strpos($pathinfo, '/bar') && preg_match('#^/bar/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/bar') && preg_match('#^/bar/(?[^/]+)$#s', $pathinfo, $matches)) { if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) { $allow = array_merge($allow, array('GET', 'HEAD')); goto not_bar; } + $matches['_route'] = 'bar'; + return $matches; } not_bar: // barhead - if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/barhead') && preg_match('#^/barhead/(?[^/]+)$#s', $pathinfo, $matches)) { if (!in_array($this->context->getMethod(), array('GET', 'HEAD'))) { $allow = array_merge($allow, array('GET', 'HEAD')); goto not_barhead; } + $matches['_route'] = 'barhead'; + return $matches; } not_barhead: @@ -67,36 +71,43 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (substr($pathinfo, -1) !== '/') { return $this->redirect($pathinfo.'/', 'baz3'); } + return array('_route' => 'baz3'); } // baz4 - if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+?)/?$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+)/?$#s', $pathinfo, $matches)) { if (substr($pathinfo, -1) !== '/') { return $this->redirect($pathinfo.'/', 'baz4'); } + $matches['_route'] = 'baz4'; + return $matches; } // baz5 - if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+?)/$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+)/$#s', $pathinfo, $matches)) { if ($this->context->getMethod() != 'POST') { $allow[] = 'POST'; goto not_baz5; } + $matches['_route'] = 'baz5'; + return $matches; } not_baz5: // baz.baz6 - if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+?)/$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/test') && preg_match('#^/test/(?[^/]+)/$#s', $pathinfo, $matches)) { if ($this->context->getMethod() != 'PUT') { $allow[] = 'PUT'; goto not_bazbaz6; } + $matches['_route'] = 'baz.baz6'; + return $matches; } not_bazbaz6: @@ -109,6 +120,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // quoter if (preg_match('#^/(?[\']+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'quoter'; + return $matches; } @@ -120,14 +132,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/a')) { if (0 === strpos($pathinfo, '/a/b\'b')) { // foo1 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo1'; + return $matches; } // bar1 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar1'; + return $matches; } @@ -136,19 +150,22 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec // overriden if (preg_match('#^/a/(?.*)$#s', $pathinfo, $matches)) { $matches['_route'] = 'overriden'; + return $matches; } if (0 === strpos($pathinfo, '/a/b\'b')) { // foo2 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo2'; + return $matches; } // bar2 - if (preg_match('#^/a/b\'b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b\'b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar2'; + return $matches; } @@ -158,7 +175,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/multi')) { // helloWorld - if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?[^/]+?))?$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/multi/hello') && preg_match('#^/multi/hello(?:/(?[^/]+))?$#s', $pathinfo, $matches)) { return array_merge($this->mergeDefaults($matches, array ( 'who' => 'World!',)), array('_route' => 'helloWorld')); } @@ -172,20 +189,23 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (substr($pathinfo, -1) !== '/') { return $this->redirect($pathinfo.'/', 'hey'); } + return array('_route' => 'hey'); } } // foo3 - if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/(?<_locale>[^/]+)/b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo3'; + return $matches; } // bar3 - if (preg_match('#^/(?<_locale>[^/]+?)/b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/(?<_locale>[^/]+)/b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'bar3'; + return $matches; } @@ -195,8 +215,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec } // foo4 - if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/aba') && preg_match('#^/aba/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'foo4'; + return $matches; } @@ -208,14 +229,16 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if (0 === strpos($pathinfo, '/a/b')) { // b - if (preg_match('#^/a/b/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/a/b/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'b'; + return $matches; } // c - if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (0 === strpos($pathinfo, '/a/b/c') && preg_match('#^/a/b/c/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'c'; + return $matches; } @@ -228,6 +251,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ($this->context->getScheme() !== 'https') { return $this->redirect($pathinfo, 'secure', 'https'); } + return array('_route' => 'secure'); } @@ -236,6 +260,7 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Tests\Fixtures\Redirec if ($this->context->getScheme() !== 'http') { return $this->redirect($pathinfo, 'nonsecure', 'http'); } + return array('_route' => 'nonsecure'); } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php similarity index 92% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php index 3373931..13ffeb9 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher3.php @@ -32,8 +32,9 @@ class ProjectUrlMatcher extends Symfony\Component\Routing\Matcher\UrlMatcher } // dynamic - if (preg_match('#^/rootprefix/(?[^/]+?)$#s', $pathinfo, $matches)) { + if (preg_match('#^/rootprefix/(?[^/]+)$#s', $pathinfo, $matches)) { $matches['_route'] = 'dynamic'; + return $matches; } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/empty.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/empty.yml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/empty.yml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/empty.yml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/foo.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/foo.xml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/foo.xml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/foo.xml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/foo1.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/foo1.xml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/foo1.xml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/foo1.xml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/incomplete.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/incomplete.yml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/incomplete.yml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/incomplete.yml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalid.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalid.xml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalid.xml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalid.xml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalid.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalid.yml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalid.yml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalid.yml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalidkeys.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalidkeys.yml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalidkeys.yml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalidkeys.yml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalidnode.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalidnode.xml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalidnode.xml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalidnode.xml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalidroute.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalidroute.xml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/nonvalidroute.xml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/nonvalidroute.xml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/validpattern.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/validpattern.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.xml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/validresource.xml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validresource.xml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/validresource.xml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validresource.xml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Fixtures/validresource.yml b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validresource.yml similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Fixtures/validresource.yml rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Fixtures/validresource.yml diff --git a/core/vendor/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php similarity index 97% rename from core/vendor/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php index 7a3dabe..6a86736 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Generator\Dumper\PhpGeneratorDumper; +namespace Symfony\Component\Routing\Tests\Generator\Dumper; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Route; @@ -38,7 +38,7 @@ class PhpGeneratorDumperTest extends \PHPUnit_Framework_TestCase parent::setUp(); $this->routeCollection = new RouteCollection(); - $this->generatorDumper = new PhpGeneratorDumper($this->routeCollection, new RequestContext()); + $this->generatorDumper = new PhpGeneratorDumper($this->routeCollection); $this->testTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.php'; @unlink($this->testTmpFilepath); } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php similarity index 87% rename from core/vendor/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php index e4834e5..b9a116f 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php @@ -165,6 +165,29 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $this->getGenerator($routes)->generate('test', array('foo' => 'bar'), true); } + public function testGenerateForRouteWithInvalidOptionalParameterNonStrict() + { + $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); + $generator = $this->getGenerator($routes); + $generator->setStrictParameters(false); + $this->assertNull($generator->generate('test', array('foo' => 'bar'), true)); + } + + public function testGenerateForRouteWithInvalidOptionalParameterNonStrictWithLogger() + { + if (!class_exists('Symfony\Component\HttpKernel\Log\LoggerInterface')) { + $this->markTestSkipped('The "HttpKernel" component is not available'); + } + + $routes = $this->getRoutes('test', new Route('/testing/{foo}', array('foo' => '1'), array('foo' => 'd+'))); + $logger = $this->getMock('Symfony\Component\HttpKernel\Log\LoggerInterface'); + $logger->expects($this->once()) + ->method('err'); + $generator = $this->getGenerator($routes, array(), $logger); + $generator->setStrictParameters(false); + $this->assertNull($generator->generate('test', array('foo' => 'bar'), true)); + } + /** * @expectedException Symfony\Component\Routing\Exception\InvalidParameterException */ @@ -206,14 +229,14 @@ class UrlGeneratorTest extends \PHPUnit_Framework_TestCase $this->assertEquals('/app.php/foo', $this->getGenerator($routes)->generate('test', array('default' => 'foo'))); } - protected function getGenerator(RouteCollection $routes, array $parameters = array()) + protected function getGenerator(RouteCollection $routes, array $parameters = array(), $logger = null) { $context = new RequestContext('/app.php'); foreach ($parameters as $key => $value) { $method = 'set'.$key; $context->$method($value); } - $generator = new UrlGenerator($routes, $context); + $generator = new UrlGenerator($routes, $context, $logger); return $generator; } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationClassLoaderTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationDirectoryLoaderTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/AnnotationFileLoaderTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php similarity index 96% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php index 6c34fe4..d9e3ff5 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/ClosureLoaderTest.php @@ -48,8 +48,7 @@ class ClosureLoaderTest extends \PHPUnit_Framework_TestCase $loader = new ClosureLoader(); $route = new Route('/'); - $routes = $loader->load(function () use ($route) - { + $routes = $loader->load(function () use ($route) { $routes = new RouteCollection(); $routes->add('foo', $route); diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/XmlFileLoaderTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Loader/YamlFileLoaderTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php similarity index 95% rename from core/vendor/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php index 9cae8b8..e68b618 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php @@ -22,8 +22,8 @@ class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase */ public function testMatch($name, $pathinfo, $server, $expect) { - $collection = new RouteCollection; - $context = new RequestContext; + $collection = new RouteCollection(); + $context = new RequestContext(); $matcher = new ApacheUrlMatcher($collection, $context); $_SERVER = $server; diff --git a/core/vendor/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php similarity index 97% rename from core/vendor/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 0aea039..3677c7e 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -29,7 +29,7 @@ class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase array(), array('_scheme' => 'https') )); - $dumper = new PhpMatcherDumper($collection, new RequestContext()); + $dumper = new PhpMatcherDumper($collection); $dumper->dump(); } @@ -40,7 +40,7 @@ class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase { $basePath = __DIR__.'/../../Fixtures/dumper/'; - $dumper = new PhpMatcherDumper($collection, new RequestContext()); + $dumper = new PhpMatcherDumper($collection); $this->assertStringEqualsFile($basePath.$fixture, $dumper->dump($options), '->dump() correctly dumps routes as optimized PHP code.'); } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/RedirectableUrlMatcherTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Matcher/TraceableUrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/TraceableUrlMatcherTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/Matcher/TraceableUrlMatcherTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/TraceableUrlMatcherTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php similarity index 89% rename from core/vendor/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php index e38c75a..77d1f20 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/Matcher/UrlMatcherTest.php @@ -74,7 +74,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase // test the patterns are matched and parameters are returned $collection = new RouteCollection(); $collection->add('foo', new Route('/foo/{bar}')); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); try { $matcher->match('/no-match'); $this->fail(); @@ -84,40 +84,48 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase // test that defaults are merged $collection = new RouteCollection(); $collection->add('foo', new Route('/foo/{bar}', array('def' => 'test'))); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_route' => 'foo', 'bar' => 'baz', 'def' => 'test'), $matcher->match('/foo/baz')); // test that route "method" is ignored if no method is given in the context $collection = new RouteCollection(); $collection->add('foo', new Route('/foo', array(), array('_method' => 'GET|head'))); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertInternalType('array', $matcher->match('/foo')); // route does not match with POST method context - $matcher = new UrlMatcher($collection, new RequestContext('', 'post'), array()); + $matcher = new UrlMatcher($collection, new RequestContext('', 'post')); try { $matcher->match('/foo'); $this->fail(); } catch (MethodNotAllowedException $e) {} // route does match with GET or HEAD method context - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertInternalType('array', $matcher->match('/foo')); - $matcher = new UrlMatcher($collection, new RequestContext('', 'head'), array()); + $matcher = new UrlMatcher($collection, new RequestContext('', 'head')); $this->assertInternalType('array', $matcher->match('/foo')); // route with an optional variable as the first segment $collection = new RouteCollection(); $collection->add('bar', new Route('/{bar}/foo', array('bar' => 'bar'), array('bar' => 'foo|bar'))); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/bar/foo')); $this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo/foo')); $collection = new RouteCollection(); $collection->add('bar', new Route('/{bar}', array('bar' => 'bar'), array('bar' => 'foo|bar'))); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_route' => 'bar', 'bar' => 'foo'), $matcher->match('/foo')); $this->assertEquals(array('_route' => 'bar', 'bar' => 'bar'), $matcher->match('/')); + + // route with only optional variables + $collection = new RouteCollection(); + $collection->add('bar', new Route('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar'), array())); + $matcher = new UrlMatcher($collection, new RequestContext()); + $this->assertEquals(array('_route' => 'bar', 'foo' => 'foo', 'bar' => 'bar'), $matcher->match('/')); + $this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'bar'), $matcher->match('/a')); + $this->assertEquals(array('_route' => 'bar', 'foo' => 'a', 'bar' => 'b'), $matcher->match('/a/b')); } public function testMatchWithPrefixes() @@ -131,7 +139,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $collection = new RouteCollection(); $collection->addCollection($collection2, '/a'); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_route' => 'foo', 'foo' => 'foo'), $matcher->match('/a/b/foo')); } @@ -146,7 +154,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $collection = new RouteCollection(); $collection->addCollection($collection2, '/{_locale}'); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_locale' => 'fr', '_route' => 'foo', 'foo' => 'foo'), $matcher->match('/fr/b/foo')); } @@ -156,7 +164,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $chars = '!"$%éà &\'()*+,./:;<=>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\[]^_`abcdefghijklmnopqrstuvwxyz{|}~-'; $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '['.preg_quote($chars).']+'))); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.rawurlencode($chars).'/bar')); $this->assertEquals(array('_route' => 'foo', 'foo' => $chars), $matcher->match('/'.strtr($chars, array('%' => '%25')).'/bar')); } @@ -166,7 +174,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $collection = new RouteCollection(); $collection->add('foo', new Route('/{foo}/bar', array(), array('foo' => '.+'))); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_route' => 'foo', 'foo' => "\n"), $matcher->match('/'.urlencode("\n").'/bar'), 'linefeed character is matched'); } @@ -180,7 +188,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $collection->addCollection($collection1); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); $this->assertEquals(array('_route' => 'foo'), $matcher->match('/foo1')); $this->setExpectedException('Symfony\Component\Routing\Exception\ResourceNotFoundException'); @@ -198,7 +206,7 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase $collection = new RouteCollection(); $collection->add('foo', new Route('/{bar}')); - $matcher = new UrlMatcher($collection, new RequestContext(), array()); + $matcher = new UrlMatcher($collection, new RequestContext()); try { $matcher->match('/'); $this->fail(); @@ -206,6 +214,15 @@ class UrlMatcherTest extends \PHPUnit_Framework_TestCase } } + public function testMatchingIsEager() + { + $coll = new RouteCollection(); + $coll->add('test', new Route('/{foo}-{bar}-', array(), array('foo' => '.+', 'bar' => '.+'))); + + $matcher = new UrlMatcher($coll, new RequestContext()); + $this->assertEquals(array('foo' => 'text1-text2-text3', 'bar' => 'text4', '_route' => 'test'), $matcher->match('/text1-text2-text3-text4-')); + } + /** * @expectedException Symfony\Component\Routing\Exception\ResourceNotFoundException */ diff --git a/core/vendor/Symfony/Component/Routing/Tests/RouteCollectionTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/RouteCollectionTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCollectionTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/RouteCompilerTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php similarity index 59% rename from core/vendor/Symfony/Component/Routing/Tests/RouteCompilerTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php index 7245e79..5288ca6 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/RouteCompilerTest.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteCompilerTest.php @@ -43,51 +43,51 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase array( 'Route with a variable', array('/foo/{bar}'), - '/foo', '#^/foo/(?[^/]+?)$#s', array('bar'), array( - array('variable', '/', '[^/]+?', 'bar'), + '/foo', '#^/foo/(?[^/]+)$#s', array('bar'), array( + array('variable', '/', '[^/]+', 'bar'), array('text', '/foo'), )), array( 'Route with a variable that has a default value', array('/foo/{bar}', array('bar' => 'bar')), - '/foo', '#^/foo(?:/(?[^/]+?))?$#s', array('bar'), array( - array('variable', '/', '[^/]+?', 'bar'), + '/foo', '#^/foo(?:/(?[^/]+))?$#s', array('bar'), array( + array('variable', '/', '[^/]+', 'bar'), array('text', '/foo'), )), array( 'Route with several variables', array('/foo/{bar}/{foobar}'), - '/foo', '#^/foo/(?[^/]+?)/(?[^/]+?)$#s', array('bar', 'foobar'), array( - array('variable', '/', '[^/]+?', 'foobar'), - array('variable', '/', '[^/]+?', 'bar'), + '/foo', '#^/foo/(?[^/]+)/(?[^/]+)$#s', array('bar', 'foobar'), array( + array('variable', '/', '[^/]+', 'foobar'), + array('variable', '/', '[^/]+', 'bar'), array('text', '/foo'), )), array( 'Route with several variables that have default values', array('/foo/{bar}/{foobar}', array('bar' => 'bar', 'foobar' => '')), - '/foo', '#^/foo(?:/(?[^/]+?)(?:/(?[^/]+?))?)?$#s', array('bar', 'foobar'), array( - array('variable', '/', '[^/]+?', 'foobar'), - array('variable', '/', '[^/]+?', 'bar'), + '/foo', '#^/foo(?:/(?[^/]+)(?:/(?[^/]+))?)?$#s', array('bar', 'foobar'), array( + array('variable', '/', '[^/]+', 'foobar'), + array('variable', '/', '[^/]+', 'bar'), array('text', '/foo'), )), array( 'Route with several variables but some of them have no default values', array('/foo/{bar}/{foobar}', array('bar' => 'bar')), - '/foo', '#^/foo/(?[^/]+?)/(?[^/]+?)$#s', array('bar', 'foobar'), array( - array('variable', '/', '[^/]+?', 'foobar'), - array('variable', '/', '[^/]+?', 'bar'), + '/foo', '#^/foo/(?[^/]+)/(?[^/]+)$#s', array('bar', 'foobar'), array( + array('variable', '/', '[^/]+', 'foobar'), + array('variable', '/', '[^/]+', 'bar'), array('text', '/foo'), )), array( 'Route with an optional variable as the first segment', array('/{bar}', array('bar' => 'bar')), - '', '#^/(?[^/]+?)?$#s', array('bar'), array( - array('variable', '/', '[^/]+?', 'bar'), + '', '#^/(?[^/]+)?$#s', array('bar'), array( + array('variable', '/', '[^/]+', 'bar'), )), array( @@ -96,6 +96,31 @@ class RouteCompilerTest extends \PHPUnit_Framework_TestCase '', '#^/(?(foo|bar))?$#s', array('bar'), array( array('variable', '/', '(foo|bar)', 'bar'), )), + + array( + 'Route with only optional variables', + array('/{foo}/{bar}', array('foo' => 'foo', 'bar' => 'bar')), + '', '#^/(?[^/]+)?(?:/(?[^/]+))?$#s', array('foo', 'bar'), array( + array('variable', '/', '[^/]+', 'bar'), + array('variable', '/', '[^/]+', 'foo'), + )), + + array( + 'Route with a variable in last position', + array('/foo-{bar}'), + '/foo', '#^/foo\-(?[^\-]+)$#s', array('bar'), array( + array('variable', '-', '[^\-]+', 'bar'), + array('text', '/foo'), + )), + + array( + 'Route with a format', + array('/foo/{bar}.{_format}'), + '/foo', '#^/foo/(?[^/\.]+)\.(?<_format>[^\.]+)$#s', array('bar', '_format'), array( + array('variable', '.', '[^\.]+', '_format'), + array('variable', '/', '[^/\.]+', 'bar'), + array('text', '/foo'), + )), ); } diff --git a/core/vendor/Symfony/Component/Routing/Tests/RouteTest.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php similarity index 100% rename from core/vendor/Symfony/Component/Routing/Tests/RouteTest.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php diff --git a/core/vendor/Symfony/Component/Routing/Tests/bootstrap.php b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/bootstrap.php similarity index 43% rename from core/vendor/Symfony/Component/Routing/Tests/bootstrap.php rename to core/vendor/symfony/routing/Symfony/Component/Routing/Tests/bootstrap.php index 8565b33..23303c0 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/bootstrap.php +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/bootstrap.php @@ -10,26 +10,13 @@ */ spl_autoload_register(function ($class) { - foreach (array( - 'SYMFONY_CONFIG' => 'Config', - 'SYMFONY_YAML' => 'Yaml', - ) as $env => $name) { - if (isset($_SERVER[$env]) && 0 === strpos(ltrim($class, '/'), 'Symfony\Component\\'.$name)) { - if (file_exists($file = $_SERVER[$env].'/'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\\'.$name)).'.php')) { - require_once $file; - } - } - } - - if (isset($_SERVER['DOCTRINE_COMMON']) && 0 === strpos(ltrim($class, '/'), 'Doctrine\Common')) { - if (file_exists($file = $_SERVER['DOCTRINE_COMMON'].'/lib/'.str_replace('\\', '/', $class).'.php')) { - require_once $file; - } - } - if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Routing')) { if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Routing')).'.php')) { require_once $file; } } }); + +if (file_exists($loader = __DIR__.'/../vendor/autoload.php')) { + require_once $loader; +} diff --git a/core/vendor/Symfony/Component/Routing/composer.json b/core/vendor/symfony/routing/Symfony/Component/Routing/composer.json similarity index 71% rename from core/vendor/Symfony/Component/Routing/composer.json rename to core/vendor/symfony/routing/Symfony/Component/Routing/composer.json index fb0af2d..44869a3 100644 --- a/core/vendor/Symfony/Component/Routing/composer.json +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/composer.json @@ -16,11 +16,18 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/config": "2.1.*", + "symfony/yaml": "2.1.*", + "symfony/http-kernel": "2.1.*", + "doctrine/common": ">=2.2,<2.4-dev" }, "suggest": { "symfony/config": "self.version", - "symfony/yaml": "self.version" + "symfony/yaml": "self.version", + "doctrine/common": ">=2.2,<2.4-dev" }, "autoload": { "psr-0": { "Symfony\\Component\\Routing": "" } diff --git a/core/vendor/Symfony/Component/Routing/phpunit.xml.dist b/core/vendor/symfony/routing/Symfony/Component/Routing/phpunit.xml.dist similarity index 93% rename from core/vendor/Symfony/Component/Routing/phpunit.xml.dist rename to core/vendor/symfony/routing/Symfony/Component/Routing/phpunit.xml.dist index f6d9ede..6d25ebf 100644 --- a/core/vendor/Symfony/Component/Routing/phpunit.xml.dist +++ b/core/vendor/symfony/routing/Symfony/Component/Routing/phpunit.xml.dist @@ -21,7 +21,7 @@ ./ - ./Resources + ./vendor ./Tests diff --git a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md b/core/vendor/symfony/yaml/Symfony/Component/Yaml/CHANGELOG.md similarity index 100% copy from core/vendor/Symfony/Component/Yaml/CHANGELOG.md copy to core/vendor/symfony/yaml/Symfony/Component/Yaml/CHANGELOG.md diff --git a/core/vendor/Symfony/Component/Yaml/Dumper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php similarity index 87% rename from core/vendor/Symfony/Component/Yaml/Dumper.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php index 97ec9d2..2338916 100644 --- a/core/vendor/Symfony/Component/Yaml/Dumper.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Dumper.php @@ -21,9 +21,9 @@ class Dumper /** * Dumps a PHP value to YAML. * - * @param mixed $input The PHP value - * @param integer $inline The level where you switch to inline YAML - * @param integer $indent The level of indentation (used internally) + * @param mixed $input The PHP value + * @param integer $inline The level where you switch to inline YAML + * @param integer $indent The level of indentation (used internally) * * @return string The YAML representation of the PHP value */ diff --git a/core/vendor/Symfony/Component/Yaml/Escaper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Escaper.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Escaper.php diff --git a/core/vendor/Symfony/Component/Yaml/Exception/DumpException.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/DumpException.php similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Exception/DumpException.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/DumpException.php diff --git a/core/vendor/Symfony/Component/Yaml/Exception/ExceptionInterface.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ExceptionInterface.php similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Exception/ExceptionInterface.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ExceptionInterface.php diff --git a/core/vendor/Symfony/Component/Yaml/Exception/ParseException.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ParseException.php similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Exception/ParseException.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Exception/ParseException.php diff --git a/core/vendor/Symfony/Component/Yaml/Inline.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php similarity index 92% rename from core/vendor/Symfony/Component/Yaml/Inline.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php index 5933ac7..8bcfcda 100644 --- a/core/vendor/Symfony/Component/Yaml/Inline.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Inline.php @@ -50,7 +50,13 @@ class Inline $result = self::parseMapping($value); break; default: - $result = self::parseScalar($value); + $i = 0; + $result = self::parseScalar($value, null, array('"', "'"), $i); + + // some comment can end the scalar + if (preg_replace('/\s+#.*$/A', '', substr($value, $i))) { + throw new ParseException(sprintf('Unexpected characters near "%s".', substr($value, $i))); + } } if (isset($mbEncoding)) { @@ -146,9 +152,9 @@ class Inline /** * Parses a scalar to a YAML string. * - * @param scalar $scalar - * @param string $delimiters - * @param array $stringDelimiters + * @param scalar $scalar + * @param string $delimiters + * @param array $stringDelimiters * @param integer &$i * @param Boolean $evaluate * @@ -161,6 +167,13 @@ class Inline if (in_array($scalar[$i], $stringDelimiters)) { // quoted scalar $output = self::parseQuotedScalar($scalar, $i); + + if (null !== $delimiters) { + $tmp = ltrim(substr($scalar, $i), ' '); + if (!in_array($tmp[0], $delimiters)) { + throw new ParseException(sprintf('Unexpected characters (%s).', substr($scalar, $i))); + } + } } else { // "normal" string if (!$delimiters) { @@ -187,7 +200,7 @@ class Inline /** * Parses a quoted scalar to YAML. * - * @param string $scalar + * @param string $scalar * @param integer &$i * * @return string A YAML string @@ -196,6 +209,11 @@ class Inline */ static private function parseQuotedScalar($scalar, &$i) { + // Only check the current item we're dealing with (for sequences) + $subject = substr($scalar, $i); + $items = preg_split('/[\'"]\s*(?:[,:]|[}\]]\s*,)/', $subject); + $subject = substr($subject, 0, strlen($items[0]) + 1); + if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) { throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i))); } @@ -217,7 +235,7 @@ class Inline /** * Parses a sequence to a YAML string. * - * @param string $sequence + * @param string $sequence * @param integer &$i * * @return string A YAML string @@ -273,7 +291,7 @@ class Inline /** * Parses a mapping to a YAML string. * - * @param string $mapping + * @param string $mapping * @param integer &$i * * @return string A YAML string diff --git a/core/vendor/Symfony/Component/Yaml/LICENSE b/core/vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE similarity index 100% rename from core/vendor/Symfony/Component/Yaml/LICENSE rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/LICENSE diff --git a/core/vendor/Symfony/Component/Yaml/Parser.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php similarity index 89% rename from core/vendor/Symfony/Component/Yaml/Parser.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php index 0743069..76d1926 100644 --- a/core/vendor/Symfony/Component/Yaml/Parser.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Parser.php @@ -38,7 +38,7 @@ class Parser /** * Parses a YAML string to a PHP value. * - * @param string $value A YAML string + * @param string $value A YAML string * * @return mixed A PHP value * @@ -159,7 +159,7 @@ class Parser // hash } elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) { // if next line is less indented or equal, then it means that the current value is null - if ($this->isNextLineIndented()) { + if ($this->isNextLineIndented() && !$this->isNextLineUnIndentedCollection()) { $data[$key] = null; } else { $c = $this->getRealCurrentLineNb() + 1; @@ -275,7 +275,9 @@ class Parser if (null === $indentation) { $newIndent = $this->getCurrentLineIndentation(); - if (!$this->isCurrentLineEmpty() && 0 == $newIndent) { + $unindentedEmbedBlock = $this->isStringUnIndentedCollectionItem($this->currentLine); + + if (!$this->isCurrentLineEmpty() && 0 === $newIndent && !$unindentedEmbedBlock) { throw new ParseException('Indentation problem.', $this->getRealCurrentLineNb() + 1, $this->currentLine); } } else { @@ -284,7 +286,15 @@ class Parser $data = array(substr($this->currentLine, $newIndent)); + $isItUnindentedCollection = $this->isStringUnIndentedCollectionItem($this->currentLine); + while ($this->moveToNextLine()) { + + if ($isItUnindentedCollection && !$this->isStringUnIndentedCollectionItem($this->currentLine)) { + $this->moveToPreviousLine(); + break; + } + if ($this->isCurrentLineEmpty()) { if ($this->isCurrentLineBlank()) { $data[] = substr($this->currentLine, $newIndent); @@ -339,7 +349,7 @@ class Parser /** * Parses a YAML value. * - * @param string $value A YAML value + * @param string $value A YAML value * * @return mixed A PHP value * @@ -380,9 +390,9 @@ class Parser /** * Parses a folded scalar. * - * @param string $separator The separator that was used to begin this folded scalar (| or >) - * @param string $indicator The indicator that was used to begin this folded scalar (+ or -) - * @param integer $indentation The indentation that was used to begin this folded scalar + * @param string $separator The separator that was used to begin this folded scalar (| or >) + * @param string $indicator The indicator that was used to begin this folded scalar (+ or -) + * @param integer $indentation The indentation that was used to begin this folded scalar * * @return string The text value */ @@ -515,7 +525,7 @@ class Parser /** * Cleanups a YAML string to be parsed. * - * @param string $value The input YAML string + * @param string $value The input YAML string * * @return string A cleaned up YAML string */ @@ -553,4 +563,47 @@ class Parser return $value; } + + /** + * Returns true if the next line starts unindented collection + * + * @return Boolean Returns true if the next line starts unindented collection, false otherwise + */ + private function isNextLineUnIndentedCollection() + { + $currentIndentation = $this->getCurrentLineIndentation(); + $notEOF = $this->moveToNextLine(); + + while ($notEOF && $this->isCurrentLineEmpty()) { + $notEOF = $this->moveToNextLine(); + } + + if (false === $notEOF) { + return false; + } + + $ret = false; + if ( + $this->getCurrentLineIndentation() == $currentIndentation + && + $this->isStringUnIndentedCollectionItem($this->currentLine) + ) { + $ret = true; + } + + $this->moveToPreviousLine(); + + return $ret; + } + + /** + * Returns true if the string is unindented collection item + * + * @return Boolean Returns true if the string is unindented collection item, false otherwise + */ + private function isStringUnIndentedCollectionItem($string) + { + return (0 === strpos($this->currentLine, '- ')); + } + } diff --git a/core/vendor/Symfony/Component/Yaml/README.md b/core/vendor/symfony/yaml/Symfony/Component/Yaml/README.md similarity index 100% copy from core/vendor/Symfony/Component/Yaml/README.md copy to core/vendor/symfony/yaml/Symfony/Component/Yaml/README.md diff --git a/core/vendor/Symfony/Component/Yaml/Tests/DumperTest.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/DumperTest.php similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/DumperTest.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/DumperTest.php diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsAnchorAlias.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsAnchorAlias.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsAnchorAlias.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsAnchorAlias.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsBasicTests.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsBlockMapping.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsBlockMapping.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsBlockMapping.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsBlockMapping.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsDocumentSeparator.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsDocumentSeparator.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsDocumentSeparator.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsDocumentSeparator.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsErrorTests.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsFlowCollections.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsFlowCollections.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsFlowCollections.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsFlowCollections.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsFoldedScalars.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsFoldedScalars.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsFoldedScalars.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsFoldedScalars.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsNullsAndEmpties.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsNullsAndEmpties.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsNullsAndEmpties.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsNullsAndEmpties.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsSpecificationExamples.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsTypeTransfers.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsTypeTransfers.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/YtsTypeTransfers.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/YtsTypeTransfers.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/escapedCharacters.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/escapedCharacters.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/escapedCharacters.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/escapedCharacters.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/index.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/index.yml similarity index 92% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/index.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/index.yml index a1d7f39..3216a89 100644 --- a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/index.yml +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/index.yml @@ -15,3 +15,4 @@ - YtsNullsAndEmpties - YtsSpecificationExamples - YtsTypeTransfers +- unindentedCollections diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml similarity index 100% copy from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml copy to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfCompact.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfCompact.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfCompact.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfCompact.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfMergeKey.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfObjects.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfObjects.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfObjects.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfObjects.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfQuotes.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfQuotes.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfQuotes.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfQuotes.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/sfTests.yml diff --git a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml similarity index 11% rename from core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml index 34225e1..fd8ad7e 100644 --- a/core/vendor/Symfony/Component/Yaml/Tests/Fixtures/sfComments.yml +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/Fixtures/unindentedCollections.yml @@ -1,51 +1,62 @@ --- %YAML:1.0 -test: Comments at the end of a line +test: Unindented collection brief: > - Comments at the end of a line + Unindented collection yaml: | - ex1: "foo # bar" - ex2: "foo # bar" # comment - ex3: 'foo # bar' # comment - ex4: foo # comment + collection: + - item1 + - item2 + - item3 php: | - array('ex1' => 'foo # bar', 'ex2' => 'foo # bar', 'ex3' => 'foo # bar', 'ex4' => 'foo') + array('collection' => array('item1', 'item2', 'item3')) --- -test: Comments in the middle +test: Nested unindented collection (two levels) brief: > - Comments in the middle + Nested unindented collection yaml: | - foo: - # some comment - # some comment - bar: foo - # some comment - # some comment + collection: + key: + - a + - b + - c php: | - array('foo' => array('bar' => 'foo')) + array('collection' => array('key' => array('a', 'b', 'c'))) --- -test: Comments on a hash line +test: Nested unindented collection (three levels) brief: > - Comments on a hash line + Nested unindented collection yaml: | - foo: # a comment - foo: bar # a comment + collection: + key: + subkey: + - one + - two + - three php: | - array('foo' => array('foo' => 'bar')) + array('collection' => array('key' => array('subkey' => array('one', 'two', 'three')))) --- -test: 'Value starting with a #' +test: Key/value after unindented collection (1) brief: > - 'Value starting with a #' + Key/value after unindented collection (1) yaml: | - foo: '#bar' + collection: + key: + - a + - b + - c + foo: bar php: | - array('foo' => '#bar') + array('collection' => array('key' => array('a', 'b', 'c')), 'foo' => 'bar') --- -test: Document starting with a comment and a separator +test: Key/value after unindented collection (at the same level) brief: > - Commenting before document start is allowed + Key/value after unindented collection yaml: | - # document comment - --- - foo: bar # a comment + collection: + key: + - a + - b + - c + foo: bar php: | - array('foo' => 'bar') + array('collection' => array('key' => array('a', 'b', 'c'), 'foo' => 'bar')) diff --git a/core/vendor/Symfony/Component/Yaml/Tests/InlineTest.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php similarity index 82% rename from core/vendor/Symfony/Component/Yaml/Tests/InlineTest.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php index f22b9fa..2684fa5 100644 --- a/core/vendor/Symfony/Component/Yaml/Tests/InlineTest.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/InlineTest.php @@ -65,6 +65,41 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->assertSame($value, Inline::parse(Inline::dump($value))); } + /** + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + */ + public function testParseScalarWithIncorrectlyQuotedStringShouldThrowException() + { + $value = "'don't do somthin' like that'"; + Inline::parse($value); + } + + /** + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + */ + public function testParseScalarWithIncorrectlyDoubleQuotedStringShouldThrowException() + { + $value = '"don"t do somthin" like that"'; + Inline::parse($value); + } + + /** + * @expectedException \Symfony\Component\Yaml\Exception\ParseException + */ + public function testParseInvalidMappingKeyShouldThrowException() + { + $value = '{ "foo " bar": "bar" }'; + Inline::parse($value); + } + + public function testParseScalarWithCorrectlyQuotedStringShouldReturnString() + { + $value = "'don''t do somthin'' like that'"; + $expect = "don't do somthin' like that"; + + $this->assertSame($expect, Inline::parseScalar($value)); + } + protected function getTestsForParse() { return array( @@ -87,6 +122,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase "'foo#bar'" => 'foo#bar', "'foo # bar'" => 'foo # bar', "'#cfcfcf'" => '#cfcfcf', + '::form_base.html.twig' => '::form_base.html.twig', '2007-10-30' => mktime(0, 0, 0, 10, 30, 2007), '2007-10-30T02:59:43Z' => gmmktime(2, 59, 43, 10, 30, 2007), @@ -124,6 +160,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase '[foo, {bar: foo, foo: [foo, {bar: foo}]}, [foo, {bar: foo}]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))), '[foo, bar: { foo: bar }]' => array('foo', '1' => array('bar' => array('foo' => 'bar'))), + '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%',), true, '@service_container',), ); } @@ -167,6 +204,8 @@ class InlineTest extends \PHPUnit_Framework_TestCase '[foo, { bar: foo }]' => array('foo', array('bar' => 'foo')), '[foo, { bar: foo, foo: [foo, { bar: foo }] }, [foo, { bar: foo }]]' => array('foo', array('bar' => 'foo', 'foo' => array('foo', array('bar' => 'foo'))), array('foo', array('bar' => 'foo'))), + + '[foo, \'@foo.baz\', { \'%foo%\': \'foo is %foo%\', bar: \'%foo%\' }, true, \'@service_container\']' => array('foo', '@foo.baz', array('%foo%' => 'foo is %foo%', 'bar' => '%foo%',), true, '@service_container',), ); } } diff --git a/core/vendor/Symfony/Component/Yaml/Tests/ParserTest.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php similarity index 93% copy from core/vendor/Symfony/Component/Yaml/Tests/ParserTest.php copy to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php index 98689ae..6b4e2d4 100644 --- a/core/vendor/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/ParserTest.php @@ -140,6 +140,26 @@ EOF } } } + + /** + * + * @expectedException Symfony\Component\Yaml\Exception\ParseException + * + */ + public function testUnindentedCollectionException() + { + $yaml = <<parser->parse($yaml); + } + } class B diff --git a/core/vendor/Symfony/Component/Yaml/Tests/bootstrap.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/bootstrap.php similarity index 100% rename from core/vendor/Symfony/Component/Yaml/Tests/bootstrap.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Tests/bootstrap.php diff --git a/core/vendor/Symfony/Component/Yaml/Unescaper.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php similarity index 97% rename from core/vendor/Symfony/Component/Yaml/Unescaper.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php index 807a35e..0061dfd 100644 --- a/core/vendor/Symfony/Component/Yaml/Unescaper.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Unescaper.php @@ -134,10 +134,10 @@ class Unescaper */ private function convertEncoding($value, $to, $from) { - if (function_exists('iconv')) { - return iconv($from, $to, $value); - } elseif (function_exists('mb_convert_encoding')) { + if (function_exists('mb_convert_encoding')) { return mb_convert_encoding($value, $to, $from); + } elseif (function_exists('iconv')) { + return iconv($from, $to, $value); } throw new \RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).'); diff --git a/core/vendor/Symfony/Component/Yaml/Yaml.php b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php similarity index 98% rename from core/vendor/Symfony/Component/Yaml/Yaml.php rename to core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php index cd30b0f..29e9413 100644 --- a/core/vendor/Symfony/Component/Yaml/Yaml.php +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php @@ -95,7 +95,7 @@ class Yaml * The dump method, when supplied with an array, will do its best * to convert the array into friendly YAML. * - * @param array $array PHP array + * @param array $array PHP array * @param integer $inline The level where you switch to inline YAML * * @return string A YAML string representing the original PHP array diff --git a/core/vendor/Symfony/Component/Yaml/composer.json b/core/vendor/symfony/yaml/Symfony/Component/Yaml/composer.json similarity index 96% copy from core/vendor/Symfony/Component/Yaml/composer.json copy to core/vendor/symfony/yaml/Symfony/Component/Yaml/composer.json index dc87721..c2894da 100644 --- a/core/vendor/Symfony/Component/Yaml/composer.json +++ b/core/vendor/symfony/yaml/Symfony/Component/Yaml/composer.json @@ -16,7 +16,7 @@ } ], "require": { - "php": ">=5.3.2" + "php": ">=5.3.3" }, "autoload": { "psr-0": { "Symfony\\Component\\Yaml": "" } diff --git a/core/vendor/Symfony/Component/Yaml/phpunit.xml.dist b/core/vendor/symfony/yaml/Symfony/Component/Yaml/phpunit.xml.dist similarity index 100% copy from core/vendor/Symfony/Component/Yaml/phpunit.xml.dist copy to core/vendor/symfony/yaml/Symfony/Component/Yaml/phpunit.xml.dist diff --git a/core/vendor/Twig/Node/Expression/Binary/BitwiseOr.php b/core/vendor/twig/twig/.travis.yml similarity index 15% copy from core/vendor/Twig/Node/Expression/Binary/BitwiseOr.php copy to core/vendor/twig/twig/.travis.yml index 058a20b..e6d3b61 100644 --- a/core/vendor/Twig/Node/Expression/Binary/BitwiseOr.php +++ b/core/vendor/twig/twig/.travis.yml @@ -1,18 +1,14 @@ -raw('|'); - } -} +php: + - 5.2 + - 5.3 + - 5.4 + +env: + - TWIG_EXT=no + - TWIG_EXT=yes + +before_script: + - if [ "$TWIG_EXT" == "yes" ]; then sh -c "cd ext/twig && phpize && ./configure --enable-twig && make && sudo make install"; fi + - if [ "$TWIG_EXT" == "yes" ]; then echo "extension=twig.so" >> `php --ini | grep "Loaded Configuration" | sed -e "s|.*:\s*||"`; fi diff --git a/core/vendor/Twig/AUTHORS b/core/vendor/twig/twig/AUTHORS similarity index 100% rename from core/vendor/Twig/AUTHORS rename to core/vendor/twig/twig/AUTHORS diff --git a/core/vendor/twig/twig/CHANGELOG b/core/vendor/twig/twig/CHANGELOG new file mode 100644 index 0000000..862454d --- /dev/null +++ b/core/vendor/twig/twig/CHANGELOG @@ -0,0 +1,524 @@ +* 1.8.4 (2012-XX-XX) + + * n/a + +* 1.8.3 (2012-06-17) + + * fixed paths in the filesystem loader when passing a path that ends with a slash or a backslash + * fixed escaping when a project defines a function named html or js + * fixed chmod mode to apply the umask correctly + +* 1.8.2 (2012-05-30) + + * added the abs filter + * fixed a regression when using a number in template attributes + * fixed compiler when mbstring.func_overload is set to 2 + * fixed DateTimeZone support in date filter + +* 1.8.1 (2012-05-17) + + * fixed a regression when dealing with SimpleXMLElement instances in templates + * fixed "is_safe" value for the "dump" function when "html_errors" is not defined in php.ini + * switched to use mbstring whenever possible instead of iconv (you might need to update your encoding as mbstring and iconv encoding names sometimes differ) + +* 1.8.0 (2012-05-08) + + * enforced interface when adding tests, filters, functions, and node visitors from extensions + * fixed a side-effect of the date filter where the timezone might be changed + * simplified usage of the autoescape tag; the only (optional) argument is now the escaping strategy or false (with a BC layer) + * added a way to dynamically change the auto-escaping strategy according to the template "filename" + * changed the autoescape option to also accept a supported escaping strategy (for BC, true is equivalent to html) + * added an embed tag + +* 1.7.0 (2012-04-24) + + * fixed a PHP warning when using CIFS + * fixed template line number in some exceptions + * added an iterable test + * added an error when defining two blocks with the same name in a template + * added the preserves_safety option for filters + * fixed a PHP notice when trying to access a key on a non-object/array variable + * enhanced error reporting when the template file is an instance of SplFileInfo + * added Twig_Environment::mergeGlobals() + * added compilation checks to avoid misuses of the sandbox tag + * fixed filesystem loader freshness logic for high traffic websites + * fixed random function when charset is null + +* 1.6.5 (2012-04-11) + + * fixed a regression when a template only extends another one without defining any blocks + +* 1.6.4 (2012-04-02) + + * fixed PHP notice in Twig_Error::guessTemplateLine() introduced in 1.6.3 + * fixed performance when compiling large files + * optimized parent template creation when the template does not use dynamic inheritance + +* 1.6.3 (2012-03-22) + + * fixed usage of Z_ADDREF_P for PHP 5.2 in the C extension + * fixed compilation of numeric values used in templates when using a locale where the decimal separator is not a dot + * made the strategy used to guess the real template file name and line number in exception messages much faster and more accurate + +* 1.6.2 (2012-03-18) + + * fixed sandbox mode when used with inheritance + * added preserveKeys support for the slice filter + * fixed the date filter when a DateTime instance is passed with a specific timezone + * added a trim filter + +* 1.6.1 (2012-02-29) + + * fixed Twig C extension + * removed the creation of Twig_Markup instances when not needed + * added a way to set the default global timezone for dates + * fixed the slice filter on strings when the length is not specified + * fixed the creation of the cache directory in case of a race condition + +* 1.6.0 (2012-02-04) + + * fixed raw blocks when used with the whitespace trim option + * made a speed optimization to macro calls when imported via the "from" tag + * fixed globals, parsers, visitors, filters, tests, and functions management in Twig_Environment when a new one or new extension is added + * fixed the attribute function when passing arguments + * added slice notation support for the [] operator (syntactic sugar for the slice operator) + * added a slice filter + * added string support for the reverse filter + * fixed the empty test and the length filter for Twig_Markup instances + * added a date function to ease date comparison + * fixed unary operators precedence + * added recursive parsing support in the parser + * added string and integer handling for the random function + +* 1.5.1 (2012-01-05) + + * fixed a regression when parsing strings + +* 1.5.0 (2012-01-04) + + * added Traversable objects support for the join filter + +* 1.5.0-RC2 (2011-12-30) + + * added a way to set the default global date interval format + * fixed the date filter for DateInterval instances (setTimezone() does not exist for them) + * refactored Twig_Template::display() to ease its extension + * added a number_format filter + +* 1.5.0-RC1 (2011-12-26) + + * removed the need to quote hash keys + * allowed hash keys to be any expression + * added a do tag + * added a flush tag + * added support for dynamically named filters and functions + * added a dump function to help debugging templates + * added a nl2br filter + * added a random function + * added a way to change the default format for the date filter + * fixed the lexer when an operator ending with a letter ends a line + * added string interpolation support + * enhanced exceptions for unknown filters, functions, tests, and tags + +* 1.4.0 (2011-12-07) + + * fixed lexer when using big numbers (> PHP_INT_MAX) + * added missing preserveKeys argument to the reverse filter + * fixed macros containing filter tag calls + +* 1.4.0-RC2 (2011-11-27) + + * removed usage of Reflection in Twig_Template::getAttribute() + * added a C extension that can optionally replace Twig_Template::getAttribute() + * added negative timestamp support to the date filter + +* 1.4.0-RC1 (2011-11-20) + + * optimized variable access when using PHP 5.4 + * changed the precedence of the .. operator to be more consistent with languages that implements such a feature like Ruby + * added an Exception to Twig_Loader_Array::isFresh() method when the template does not exist to be consistent with other loaders + * added Twig_Function_Node to allow more complex functions to have their own Node class + * added Twig_Filter_Node to allow more complex filters to have their own Node class + * added Twig_Test_Node to allow more complex tests to have their own Node class + * added a better error message when a template is empty but contain a BOM + * fixed "in" operator for empty strings + * fixed the "defined" test and the "default" filter (now works with more than one call (foo.bar.foo) and for both values of the strict_variables option) + * changed the way extensions are loaded (addFilter/addFunction/addGlobal/addTest/addNodeVisitor/addTokenParser/addExtension can now be called in any order) + * added Twig_Environment::display() + * made the escape filter smarter when the encoding is not supported by PHP + * added a convert_encoding filter + * moved all node manipulations outside the compile() Node method + * made several speed optimizations + +* 1.3.0 (2011-10-08) + +no changes + +* 1.3.0-RC1 (2011-10-04) + + * added an optimization for the parent() function + * added cache reloading when auto_reload is true and an extension has been modified + * added the possibility to force the escaping of a string already marked as safe (instance of Twig_Markup) + * allowed empty templates to be used as traits + * added traits support for the "parent" function + +* 1.2.0 (2011-09-13) + +no changes + +* 1.2.0-RC1 (2011-09-10) + + * enhanced the exception when a tag remains unclosed + * added support for empty Countable objects for the "empty" test + * fixed algorithm that determines if a template using inheritance is valid (no output between block definitions) + * added better support for encoding problems when escaping a string (available as of PHP 5.4) + * added a way to ignore a missing template when using the "include" tag ({% include "foo" ignore missing %}) + * added support for an array of templates to the "include" and "extends" tags ({% include ['foo', 'bar'] %}) + * added support for bitwise operators in expressions + * added the "attribute" function to allow getting dynamic attributes on variables + * added Twig_Loader_Chain + * added Twig_Loader_Array::setTemplate() + * added an optimization for the set tag when used to capture a large chunk of static text + * changed name regex to match PHP one "[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*" (works for blocks, tags, functions, filters, and macros) + * removed the possibility to use the "extends" tag from a block + * added "if" modifier support to "for" loops + +* 1.1.2 (2011-07-30) + + * fixed json_encode filter on PHP 5.2 + * fixed regression introduced in 1.1.1 ({{ block(foo|lower) }}) + * fixed inheritance when using conditional parents + * fixed compilation of templates when the body of a child template is not empty + * fixed output when a macro throws an exception + * fixed a parsing problem when a large chunk of text is enclosed in a comment tag + * added PHPDoc for all Token parsers and Core extension functions + +* 1.1.1 (2011-07-17) + + * added a performance optimization in the Optimizer (also helps to lower the number of nested level calls) + * made some performance improvement for some edge cases + +* 1.1.0 (2011-06-28) + + * fixed json_encode filter + +* 1.1.0-RC3 (2011-06-24) + + * fixed method case-sensitivity when using the sandbox mode + * added timezone support for the date filter + * fixed possible security problems with NUL bytes + +* 1.1.0-RC2 (2011-06-16) + + * added an exception when the template passed to "use" is not a string + * made 'a.b is defined' not throw an exception if a is not defined (in strict mode) + * added {% line \d+ %} directive + +* 1.1.0-RC1 (2011-05-28) + +Flush your cache after upgrading. + + * fixed date filter when using a timestamp + * fixed the defined test for some cases + * fixed a parsing problem when a large chunk of text is enclosed in a raw tag + * added support for horizontal reuse of template blocks (see docs for more information) + * added whitespace control modifier to all tags (see docs for more information) + * added null as an alias for none (the null test is also an alias for the none test now) + * made TRUE, FALSE, NONE equivalent to their lowercase counterparts + * wrapped all compilation and runtime exceptions with Twig_Error_Runtime and added logic to guess the template name and line + * moved display() method to Twig_Template (generated templates should now use doDisplay() instead) + +* 1.0.0 (2011-03-27) + + * fixed output when using mbstring + * fixed duplicate call of methods when using the sandbox + * made the charset configurable for the escape filter + +* 1.0.0-RC2 (2011-02-21) + + * changed the way {% set %} works when capturing (the content is now marked as safe) + * added support for macro name in the endmacro tag + * make Twig_Error compatible with PHP 5.3.0 > + * fixed an infinite loop on some Windows configurations + * fixed the "length" filter for numbers + * fixed Template::getAttribute() as properties in PHP are case sensitive + * removed coupling between Twig_Node and Twig_Template + * fixed the ternary operator precedence rule + +* 1.0.0-RC1 (2011-01-09) + +Backward incompatibilities: + + * the "items" filter, which has been deprecated for quite a long time now, has been removed + * the "range" filter has been converted to a function: 0|range(10) -> range(0, 10) + * the "constant" filter has been converted to a function: {{ some_date|date('DATE_W3C'|constant) }} -> {{ some_date|date(constant('DATE_W3C')) }} + * the "cycle" filter has been converted to a function: {{ ['odd', 'even']|cycle(i) }} -> {{ cycle(['odd', 'even'], i) }} + * the "for" tag does not support "joined by" anymore + * the "autoescape" first argument is now "true"/"false" (instead of "on"/"off") + * the "parent" tag has been replaced by a "parent" function ({{ parent() }} instead of {% parent %}) + * the "display" tag has been replaced by a "block" function ({{ block('title') }} instead of {% display title %}) + * removed the grammar and simple token parser (moved to the Twig Extensions repository) + +Changes: + + * added "needs_context" option for filters and functions (the context is then passed as a first argument) + * added global variables support + * made macros return their value instead of echoing directly (fixes calling a macro in sandbox mode) + * added the "from" tag to import macros as functions + * added support for functions (a function is just syntactic sugar for a getAttribute() call) + * made macros callable when sandbox mode is enabled + * added an exception when a macro uses a reserved name + * the "default" filter now uses the "empty" test instead of just checking for null + * added the "empty" test + +* 0.9.10 (2010-12-16) + +Backward incompatibilities: + + * The Escaper extension is enabled by default, which means that all displayed + variables are now automatically escaped. You can revert to the previous + behavior by removing the extension via $env->removeExtension('escaper') + or just set the 'autoescape' option to 'false'. + * removed the "without loop" attribute for the "for" tag (not needed anymore + as the Optimizer take care of that for most cases) + * arrays and hashes have now a different syntax + * arrays keep the same syntax with square brackets: [1, 2] + * hashes now use curly braces (["a": "b"] should now be written as {"a": "b"}) + * support for "arrays with keys" and "hashes without keys" is not supported anymore ([1, "foo": "bar"] or {"foo": "bar", 1}) + * the i18n extension is now part of the Twig Extensions repository + +Changes: + + * added the merge filter + * removed 'is_escaper' option for filters (a left over from the previous version) -- you must use 'is_safe' now instead + * fixed usage of operators as method names (like is, in, and not) + * changed the order of execution for node visitors + * fixed default() filter behavior when used with strict_variables set to on + * fixed filesystem loader compatibility with PHAR files + * enhanced error messages when an unexpected token is parsed in an expression + * fixed filename not being added to syntax error messages + * added the autoescape option to enable/disable autoescaping + * removed the newline after a comment (mimicks PHP behavior) + * added a syntax error exception when parent block is used on a template that does not extend another one + * made the Escaper extension enabled by default + * fixed sandbox extension when used with auto output escaping + * fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved) + * added an Optimizer extension (enabled by default; optimizes "for" loops and "raw" filters) + * added priority to node visitors + +* 0.9.9 (2010-11-28) + +Backward incompatibilities: + * the self special variable has been renamed to _self + * the odd and even filters are now tests: + {{ foo|odd }} must now be written {{ foo is odd }} + * the "safe" filter has been renamed to "raw" + * in Node classes, + sub-nodes are now accessed via getNode() (instead of property access) + attributes via getAttribute() (instead of array access) + * the urlencode filter had been renamed to url_encode + * the include tag now merges the passed variables with the current context by default + (the old behavior is still possible by adding the "only" keyword) + * moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime) + * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead) + * the "in" filter has been removed ({{ a|in(b) }} should now be written {{ a in b }}) + +Changes: + * added file and line to Twig_Error_Runtime exceptions thrown from Twig_Template + * changed trans tag to accept any variable for the plural count + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements) + * added the ** (power) operator + * changed the algorithm used for parsing expressions + * added the spaceless tag + * removed trim_blocks option + * added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar()) + * changed all exceptions to extend Twig_Error + * fixed unary expressions ({{ not(1 or 0) }}) + * fixed child templates (with an extend tag) that uses one or more imports + * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }}) + * escaping has been rewritten + * the implementation of template inheritance has been rewritten + (blocks can now be called individually and still work with inheritance) + * fixed error handling for if tag when a syntax error occurs within a subparse process + * added a way to implement custom logic for resolving token parsers given a tag name + * fixed js escaper to be stricter (now uses a whilelist-based js escaper) + * added the following filers: "constant", "trans", "replace", "json_encode" + * added a "constant" test + * fixed objects with __toString() not being autoescaped + * fixed subscript expressions when calling __call() (methods now keep the case) + * added "test" feature (accessible via the "is" operator) + * removed the debug tag (should be done in an extension) + * fixed trans tag when no vars are used in plural form + * fixed race condition when writing template cache + * added the special _charset variable to reference the current charset + * added the special _context variable to reference the current context + * renamed self to _self (to avoid conflict) + * fixed Twig_Template::getAttribute() for protected properties + +* 0.9.8 (2010-06-28) + +Backward incompatibilities: + * the trans tag plural count is now attached to the plural tag: + old: `{% trans count %}...{% plural %}...{% endtrans %}` + new: `{% trans %}...{% plural count %}...{% endtrans %}` + + * added a way to translate strings coming from a variable ({% trans var %}) + * fixed trans tag when used with the Escaper extension + * fixed default cache umask + * removed Twig_Template instances from the debug tag output + * fixed objects with __isset() defined + * fixed set tag when used with a capture + * fixed type hinting for Twig_Environment::addFilter() method + +* 0.9.7 (2010-06-12) + +Backward incompatibilities: + * changed 'as' to '=' for the set tag ({% set title as "Title" %} must now be {% set title = "Title" %}) + * removed the sandboxed attribute of the include tag (use the new sandbox tag instead) + * refactored the Node system (if you have custom nodes, you will have to update them to use the new API) + + * added self as a special variable that refers to the current template (useful for importing macros from the current template) + * added Twig_Template instance support to the include tag + * added support for dynamic and conditional inheritance ({% extends some_var %} and {% extends standalone ? "minimum" : "base" %}) + * added a grammar sub-framework to ease the creation of custom tags + * fixed the for tag for large arrays (some loop variables are now only available for arrays and objects that implement the Countable interface) + * removed the Twig_Resource::resolveMissingFilter() method + * fixed the filter tag which did not apply filtering to included files + * added a bunch of unit tests + * added a bunch of phpdoc + * added a sandbox tag in the sandbox extension + * changed the date filter to support any date format supported by DateTime + * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default) + * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor + * changed the cache option to only accepts an explicit path to a cache directory or false + * added a way to add token parsers, filters, and visitors without creating an extension + * added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface + * changed the generated code to match the new coding standards + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }}) + * added an exception when a child template has a non-empty body (as it is always ignored when rendering) + +* 0.9.6 (2010-05-12) + + * fixed variables defined outside a loop and for which the value changes in a for loop + * fixed the test suite for PHP 5.2 and older versions of PHPUnit + * added support for __call() in expression resolution + * fixed node visiting for macros (macros are now visited by visitors as any other node) + * fixed nested block definitions with a parent call (rarely useful but nonetheless supported now) + * added the cycle filter + * fixed the Lexer when mbstring.func_overload is used with an mbstring.internal_encoding different from ASCII + * added a long-syntax for the set tag ({% set foo %}...{% endset %}) + * unit tests are now powered by PHPUnit + * added support for gettext via the `i18n` extension + * fixed twig_capitalize_string_filter() and fixed twig_length_filter() when used with UTF-8 values + * added a more useful exception if an if tag is not closed properly + * added support for escaping strategy in the autoescape tag + * fixed lexer when a template has a big chunk of text between/in a block + +* 0.9.5 (2010-01-20) + +As for any new release, don't forget to remove all cached templates after +upgrading. + +If you have defined custom filters, you MUST upgrade them for this release. To +upgrade, replace "array" with "new Twig_Filter_Function", and replace the +environment constant by the "needs_environment" option: + + // before + 'even' => array('twig_is_even_filter', false), + 'escape' => array('twig_escape_filter', true), + + // after + 'even' => new Twig_Filter_Function('twig_is_even_filter'), + 'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true)), + +If you have created NodeTransformer classes, you will need to upgrade them to +the new interface (please note that the interface is not yet considered +stable). + + * fixed list nodes that did not extend the Twig_NodeListInterface + * added the "without loop" option to the for tag (it disables the generation of the loop variable) + * refactored node transformers to node visitors + * fixed automatic-escaping for blocks + * added a way to specify variables to pass to an included template + * changed the automatic-escaping rules to be more sensible and more configurable in custom filters (the documentation lists all the rules) + * improved the filter system to allow object methods to be used as filters + * changed the Array and String loaders to actually make use of the cache mechanism + * included the default filter function definitions in the extension class files directly (Core, Escaper) + * added the // operator (like the floor() PHP function) + * added the .. operator (as a syntactic sugar for the range filter when the step is 1) + * added the in operator (as a syntactic sugar for the in filter) + * added the following filters in the Core extension: in, range + * added support for arrays (same behavior as in PHP, a mix between lists and dictionaries, arrays and hashes) + * enhanced some error messages to provide better feedback in case of parsing errors + +* 0.9.4 (2009-12-02) + +If you have custom loaders, you MUST upgrade them for this release: The +Twig_Loader base class has been removed, and the Twig_LoaderInterface has also +been changed (see the source code for more information or the documentation). + + * added support for DateTime instances for the date filter + * fixed loop.last when the array only has one item + * made it possible to insert newlines in tag and variable blocks + * fixed a bug when a literal '\n' were present in a template text + * fixed bug when the filename of a template contains */ + * refactored loaders + +* 0.9.3 (2009-11-11) + +This release is NOT backward compatible with the previous releases. + + The loaders do not take the cache and autoReload arguments anymore. Instead, + the Twig_Environment class has two new options: cache and auto_reload. + Upgrading your code means changing this kind of code: + + $loader = new Twig_Loader_Filesystem('/path/to/templates', '/path/to/compilation_cache', true); + $twig = new Twig_Environment($loader); + + to something like this: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + 'auto_reload' => true, + )); + + * deprecated the "items" filter as it is not needed anymore + * made cache and auto_reload options of Twig_Environment instead of arguments of Twig_Loader + * optimized template loading speed + * removed output when an error occurs in a template and render() is used + * made major speed improvements for loops (up to 300% on even the smallest loops) + * added properties as part of the sandbox mode + * added public properties support (obj.item can now be the item property on the obj object) + * extended set tag to support expression as value ({% set foo as 'foo' ~ 'bar' %} ) + * fixed bug when \ was used in HTML + +* 0.9.2 (2009-10-29) + + * made some speed optimizations + * changed the cache extension to .php + * added a js escaping strategy + * added support for short block tag + * changed the filter tag to allow chained filters + * made lexer more flexible as you can now change the default delimiters + * added set tag + * changed default directory permission when cache dir does not exist (more secure) + * added macro support + * changed filters first optional argument to be a Twig_Environment instance instead of a Twig_Template instance + * made Twig_Autoloader::autoload() a static method + * avoid writing template file if an error occurs + * added $ escaping when outputting raw strings + * enhanced some error messages to ease debugging + * fixed empty cache files when the template contains an error + +* 0.9.1 (2009-10-14) + + * fixed a bug in PHP 5.2.6 + * fixed numbers with one than one decimal + * added support for method calls with arguments ({{ foo.bar('a', 43) }}) + * made small speed optimizations + * made minor tweaks to allow better extensibility and flexibility + +* 0.9.0 (2009-10-12) + + * Initial release diff --git a/core/vendor/Twig/LICENSE b/core/vendor/twig/twig/LICENSE similarity index 100% copy from core/vendor/Twig/LICENSE copy to core/vendor/twig/twig/LICENSE diff --git a/core/vendor/twig/twig/README.markdown b/core/vendor/twig/twig/README.markdown new file mode 100644 index 0000000..88d6fab --- /dev/null +++ b/core/vendor/twig/twig/README.markdown @@ -0,0 +1,17 @@ +Twig, the flexible, fast, and secure template language for PHP +============================================================== + +[![Build Status](https://secure.travis-ci.org/fabpot/Twig.png?branch=master)](http://travis-ci.org/fabpot/Twig) + +Twig is a template language for PHP, released under the new BSD license (code +and documentation). + +Twig uses a syntax similar to the Django and Jinja template languages which +inspired the Twig runtime environment. + +More Information +---------------- + +Read the [documentation][1] for more information. + +[1]: http://twig.sensiolabs.org/documentation diff --git a/core/vendor/twig/twig/bin/create_pear_package.php b/core/vendor/twig/twig/bin/create_pear_package.php new file mode 100644 index 0000000..4899927 --- /dev/null +++ b/core/vendor/twig/twig/bin/create_pear_package.php @@ -0,0 +1,42 @@ + date('Y-m-d'), + 'time' => date('H:m:00'), + 'version' => $argv[1], + 'api_version' => $argv[1], + 'stability' => $argv[2], + 'api_stability' => $argv[2], +); + +$context['files'] = ''; +$path = realpath(dirname(__FILE__).'/../lib/Twig'); +foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::LEAVES_ONLY) as $file) +{ + if (preg_match('/\.php$/', $file)) + { + $name = str_replace($path.'/', '', $file); + $context['files'] .= ' '."\n"; + } +} + +$template = file_get_contents(dirname(__FILE__).'/../package.xml.tpl'); +$content = preg_replace_callback('/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/', 'replace_parameters', $template); +file_put_contents(dirname(__FILE__).'/../package.xml', $content); + +function replace_parameters($matches) +{ + global $context; + + return isset($context[$matches[1]]) ? $context[$matches[1]] : null; +} diff --git a/core/vendor/Symfony/Component/Yaml/composer.json b/core/vendor/twig/twig/composer.json similarity index 39% rename from core/vendor/Symfony/Component/Yaml/composer.json rename to core/vendor/twig/twig/composer.json index dc87721..9ca80fc 100644 --- a/core/vendor/Symfony/Component/Yaml/composer.json +++ b/core/vendor/twig/twig/composer.json @@ -1,30 +1,31 @@ { - "name": "symfony/yaml", + "name": "twig/twig", "type": "library", - "description": "Symfony Yaml Component", - "keywords": [], - "homepage": "http://symfony.com", - "license": "MIT", + "description": "Twig, the flexible, fast, and secure template language for PHP", + "keywords": ["templating"], + "homepage": "http://twig.sensiolabs.org", + "license": "BSD-3", "authors": [ { "name": "Fabien Potencier", "email": "fabien@symfony.com" }, { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com" } ], "require": { - "php": ">=5.3.2" + "php": ">=5.2.4" }, "autoload": { - "psr-0": { "Symfony\\Component\\Yaml": "" } + "psr-0" : { + "Twig_" : "lib/" + } }, - "target-dir": "Symfony/Component/Yaml", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "1.8-dev" } } } diff --git a/core/vendor/twig/twig/doc/advanced.rst b/core/vendor/twig/twig/doc/advanced.rst new file mode 100644 index 0000000..0b33bea --- /dev/null +++ b/core/vendor/twig/twig/doc/advanced.rst @@ -0,0 +1,833 @@ +Extending Twig +============== + +Twig can be extended in many ways; you can add extra tags, filters, tests, +operators, global variables, and functions. You can even extend the parser +itself with node visitors. + +.. note:: + + The first section of this chapter describes how to extend Twig easily. If + you want to reuse your changes in different projects or if you want to + share them with others, you should then create an extension as described + in the following section. + +.. caution:: + + When extending Twig by calling methods on the Twig environment instance, + Twig won't be able to recompile your templates when the PHP code is + updated. To see your changes in real-time, either disable template caching + or package your code into an extension (see the next section of this + chapter). + +Before extending Twig, you must understand the differences between all the +different possible extension points and when to use them. + +First, remember that Twig has two main language constructs: + +* ``{{ }}``: used to print the result of an expression evaluation; + +* ``{% %}``: used to execute statements. + +To understand why Twig exposes so many extension points, let's see how to +implement a *Lorem ipsum* generator (it needs to know the number of words to +generate). + +You can use a ``lipsum`` *tag*: + +.. code-block:: jinja + + {% lipsum 40 %} + +That works, but using a tag for ``lipsum`` is not a good idea for at least +three main reasons: + +* ``lipsum`` is not a language construct; +* The tag outputs something; +* The tag is not flexible as you cannot use it in an expression: + + .. code-block:: jinja + + {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} + +In fact, you rarely need to create tags; and that's good news because tags are +the most complex extension point of Twig. + +Now, let's use a ``lipsum`` *filter*: + +.. code-block:: jinja + + {{ 40|lipsum }} + +Again, it works, but it looks weird. A filter transforms the passed value to +something else but here we use the value to indicate the number of words to +generate. + +Next, let's use a ``lipsum`` *function*: + +.. code-block:: jinja + + {{ lipsum(40) }} + +Here we go. For this specific example, the creation of a function is the +extension point to use. And you can use it anywhere an expression is accepted: + +.. code-block:: jinja + + {{ 'some text' ~ ipsum(40) ~ 'some more text' }} + + {% set ipsum = ipsum(40) %} + +Last but not the least, you can also use a *global* object with a method able +to generate lorem ipsum text: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +As a rule of thumb, use functions for frequently used features and global +objects for everything else. + +Keep in mind the following when you want to extend Twig: + +========== ========================== ========== ========================= +What? Implementation difficulty? How often? When? +========== ========================== ========== ========================= +*macro* trivial frequent Content generation +*global* trivial frequent Helper object +*function* trivial frequent Content generation +*filter* trivial frequent Value transformation +*tag* complex rare DSL language construct +*test* trivial rare Boolean decision +*operator* trivial rare Values transformation +========== ========================== ========== ========================= + +Globals +------- + +A global variable is like any other template variable, except that it's +available in all templates and macros:: + + $twig = new Twig_Environment($loader); + $twig->addGlobal('text', new Text()); + +You can then use the ``text`` variable anywhere in a template: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +Filters +------- + +A filter is a regular PHP function or an object method that takes the left +side of the filter (before the pipe ``|``) as first argument and the extra +arguments passed to the filter (within parentheses ``()``) as extra arguments. + +Defining a filter is as easy as associating the filter name with a PHP +callable. For instance, let's say you have the following code in a template: + +.. code-block:: jinja + + {{ 'TWIG'|lower }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``lower`` filter. The ``lower`` filter is a built-in Twig +filter, and it is simply mapped to the PHP ``strtolower()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +As you can see, the ``'TWIG'`` string is passed as a first argument to the PHP +function. + +A filter can also take extra arguments like in the following example: + +.. code-block:: jinja + + {{ now|date('d/m/Y') }} + +In this case, the extra arguments are passed to the function after the main +argument, and the compiled code is equivalent to: + +.. code-block:: html+php + + + +Let's see how to create a new filter. + +In this section, we will create a ``rot13`` filter, which should return the +`rot13`_ transformation of a string. Here is an example of its usage and the +expected output: + +.. code-block:: jinja + + {{ "Twig"|rot13 }} + + {# should displays Gjvt #} + +Adding a filter is as simple as calling the ``addFilter()`` method on the +``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addFilter('rot13', new Twig_Filter_Function('str_rot13')); + +The second argument of ``addFilter()`` is an instance of ``Twig_Filter``. +Here, we use ``Twig_Filter_Function`` as the filter is a PHP function. The +first argument passed to the ``Twig_Filter_Function`` constructor is the name +of the PHP function to call, here ``str_rot13``, a native PHP function. + +Let's say I now want to be able to add a prefix before the converted string: + +.. code-block:: jinja + + {{ "Twig"|rot13('prefix_') }} + + {# should displays prefix_Gjvt #} + +As the PHP ``str_rot13()`` function does not support this requirement, let's +create a new PHP function:: + + function project_compute_rot13($string, $prefix = '') + { + return $prefix.str_rot13($string); + } + +As you can see, the ``prefix`` argument of the filter is passed as an extra +argument to the ``project_compute_rot13()`` function. + +Adding this filter is as easy as before:: + + $twig->addFilter('rot13', new Twig_Filter_Function('project_compute_rot13')); + +For better encapsulation, a filter can also be defined as a static method of a +class. The ``Twig_Filter_Function`` class can also be used to register such +static methods as filters:: + + $twig->addFilter('rot13', new Twig_Filter_Function('SomeClass::rot13Filter')); + +.. tip:: + + In an extension, you can also define a filter as a static method of the + extension class. + +Environment aware Filters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Twig_Filter`` classes take options as their last argument. For instance, +if you want access to the current environment instance in your filter, set the +``needs_environment`` option to ``true``:: + + $filter = new Twig_Filter_Function('str_rot13', array('needs_environment' => true)); + +Twig will then pass the current environment as the first argument to the +filter call:: + + function twig_compute_rot13(Twig_Environment $env, $string) + { + // get the current charset for instance + $charset = $env->getCharset(); + + return str_rot13($string); + } + +Automatic Escaping +~~~~~~~~~~~~~~~~~~ + +If automatic escaping is enabled, the output of the filter may be escaped +before printing. If your filter acts as an escaper (or explicitly outputs html +or javascript code), you will want the raw output to be printed. In such a +case, set the ``is_safe`` option:: + + $filter = new Twig_Filter_Function('nl2br', array('is_safe' => array('html'))); + +Some filters may have to work on already escaped or safe values. In such a +case, set the ``pre_escape`` option:: + + $filter = new Twig_Filter_Function('somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); + +Dynamic Filters +~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic filters support was added in Twig 1.5. + +A filter name containing the special ``*`` character is a dynamic filter as +the ``*`` can be any string:: + + $twig->addFilter('*_path', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following filters will be matched by the above defined dynamic filter: + +* ``product_path`` +* ``category_path`` + +A dynamic filter can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The filter will receive all dynamic part values before the normal filters +arguments. For instance, a call to ``'foo'|a_path_b()`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Functions +--------- + +A function is a regular PHP function or an object method that can be called from +templates. + +.. code-block:: jinja + + {{ constant("DATE_W3C") }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``constant`` function. The ``constant`` function is a built-in Twig +function, and it is simply mapped to the PHP ``constant()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +Adding a function is similar to adding a filter. This can be done by calling the +``addFunction()`` method on the ``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addFunction('functionName', new Twig_Function_Function('someFunction')); + +You can also expose extension methods as functions in your templates:: + + // $this is an object that implements Twig_ExtensionInterface. + $twig = new Twig_Environment($loader); + $twig->addFunction('otherFunction', new Twig_Function_Method($this, 'someMethod')); + +Functions also support ``needs_environment`` and ``is_safe`` parameters. + +Dynamic Functions +~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic functions support was added in Twig 1.5. + +A function name containing the special ``*`` character is a dynamic function +as the ``*`` can be any string:: + + $twig->addFunction('*_path', new Twig_Function_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following functions will be matched by the above defined dynamic function: + +* ``product_path`` +* ``category_path`` + +A dynamic function can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The function will receive all dynamic part values before the normal functions +arguments. For instance, a call to ``a_path_b('foo')`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Tags +---- + +One of the most exciting feature of a template engine like Twig is the +possibility to define new language constructs. This is also the most complex +feature as you need to understand how Twig's internals work. + +Let's create a simple ``set`` tag that allows the definition of simple +variables from within a template. The tag can be used like follows: + +.. code-block:: jinja + + {% set name = "value" %} + + {{ name }} + + {# should output value #} + +.. note:: + + The ``set`` tag is part of the Core extension and as such is always + available. The built-in version is slightly more powerful and supports + multiple assignments by default (cf. the template designers chapter for + more information). + +Three steps are needed to define a new tag: + +* Defining a Token Parser class (responsible for parsing the template code); + +* Defining a Node class (responsible for converting the parsed code to PHP); + +* Registering the tag. + +Registering a new tag +~~~~~~~~~~~~~~~~~~~~~ + +Adding a tag is as simple as calling the ``addTokenParser`` method on the +``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addTokenParser(new Project_Set_TokenParser()); + +Defining a Token Parser +~~~~~~~~~~~~~~~~~~~~~~~ + +Now, let's see the actual code of this class:: + + class Project_Set_TokenParser extends Twig_TokenParser + { + public function parse(Twig_Token $token) + { + $lineno = $token->getLine(); + $name = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); + $this->parser->getStream()->expect(Twig_Token::OPERATOR_TYPE, '='); + $value = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Project_Set_Node($name, $value, $lineno, $this->getTag()); + } + + public function getTag() + { + return 'set'; + } + } + +The ``getTag()`` method must return the tag we want to parse, here ``set``. + +The ``parse()`` method is invoked whenever the parser encounters a ``set`` +tag. It should return a ``Twig_Node`` instance that represents the node (the +``Project_Set_Node`` calls creating is explained in the next section). + +The parsing process is simplified thanks to a bunch of methods you can call +from the token stream (``$this->parser->getStream()``): + +* ``getCurrent()``: Gets the current token in the stream. + +* ``next()``: Moves to the next token in the stream, *but returns the old one*. + +* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether + the current token is of a particular type or value (or both). The value may be an + array of several possible values. + +* ``expect($type[, $value[, $message]])``: If the current token isn't of the given + type/value a syntax error is thrown. Otherwise, if the type and value are correct, + the token is returned and the stream moves to the next token. + +* ``look()``: Looks a the next token without consuming it. + +Parsing expressions is done by calling the ``parseExpression()`` like we did for +the ``set`` tag. + +.. tip:: + + Reading the existing ``TokenParser`` classes is the best way to learn all + the nitty-gritty details of the parsing process. + +Defining a Node +~~~~~~~~~~~~~~~ + +The ``Project_Set_Node`` class itself is rather simple:: + + class Project_Set_Node extends Twig_Node + { + public function __construct($name, Twig_Node_Expression $value, $lineno, $tag = null) + { + parent::__construct(array('value' => $value), array('name' => $name), $lineno, $tag); + } + + public function compile(Twig_Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('$context[\''.$this->getAttribute('name').'\'] = ') + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + } + +The compiler implements a fluid interface and provides methods that helps the +developer generate beautiful and readable PHP code: + +* ``subcompile()``: Compiles a node. + +* ``raw()``: Writes the given string as is. + +* ``write()``: Writes the given string by adding indentation at the beginning + of each line. + +* ``string()``: Writes a quoted string. + +* ``repr()``: Writes a PHP representation of a given value (see + ``Twig_Node_For`` for a usage example). + +* ``addDebugInfo()``: Adds the line of the original template file related to + the current node as a comment. + +* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a + usage example). + +* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a + usage example). + +.. _creating_extensions: + +Creating an Extension +--------------------- + +The main motivation for writing an extension is to move often used code into a +reusable class like adding support for internationalization. An extension can +define tags, filters, tests, operators, global variables, functions, and node +visitors. + +Creating an extension also makes for a better separation of code that is +executed at compilation time and code needed at runtime. As such, it makes +your code faster. + +Most of the time, it is useful to create a single extension for your project, +to host all the specific tags and filters you want to add to Twig. + +.. tip:: + + When packaging your code into an extension, Twig is smart enough to + recompile your templates whenever you make a change to it (when the + ``auto_reload`` is enabled). + +.. note:: + + Before writing your own extensions, have a look at the Twig official + extension repository: http://github.com/fabpot/Twig-extensions. + +An extension is a class that implements the following interface:: + + interface Twig_ExtensionInterface + { + /** + * Initializes the runtime environment. + * + * This is where you can load some file that contains filter functions for instance. + * + * @param Twig_Environment $environment The current Twig_Environment instance + */ + function initRuntime(Twig_Environment $environment); + + /** + * Returns the token parser instances to add to the existing list. + * + * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances + */ + function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return array An array of Twig_NodeVisitorInterface instances + */ + function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return array An array of filters + */ + function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return array An array of tests + */ + function getTests(); + + /** + * Returns a list of functions to add to the existing list. + * + * @return array An array of functions + */ + function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array An array of operators + */ + function getOperators(); + + /** + * Returns a list of global variables to add to the existing list. + * + * @return array An array of global variables + */ + function getGlobals(); + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + function getName(); + } + +To keep your extension class clean and lean, it can inherit from the built-in +``Twig_Extension`` class instead of implementing the whole interface. That +way, you just need to implement the ``getName()`` method as the +``Twig_Extension`` provides empty implementations for all other methods. + +The ``getName()`` method must return a unique identifier for your extension. + +Now, with this information in mind, let's create the most basic extension +possible:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getName() + { + return 'project'; + } + } + +.. note:: + + Of course, this extension does nothing for now. We will customize it in + the next sections. + +Twig does not care where you save your extension on the filesystem, as all +extensions must be registered explicitly to be available in your templates. + +You can register an extension by using the ``addExtension()`` method on your +main ``Environment`` object:: + + $twig = new Twig_Environment($loader); + $twig->addExtension(new Project_Twig_Extension()); + +Of course, you need to first load the extension file by either using +``require_once()`` or by using an autoloader (see `spl_autoload_register()`_). + +.. tip:: + + The bundled extensions are great examples of how extensions work. + +Globals +~~~~~~~ + +Global variables can be registered in an extension via the ``getGlobals()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getGlobals() + { + return array( + 'text' => new Text(), + ); + } + + // ... + } + +Functions +~~~~~~~~~ + +Functions can be registered in an extension via the ``getFunctions()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFunctions() + { + return array( + 'lipsum' => new Twig_Function_Function('generate_lipsum'), + ); + } + + // ... + } + +Filters +~~~~~~~ + +To add a filter to an extension, you need to override the ``getFilters()`` +method. This method must return an array of filters to add to the Twig +environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFilters() + { + return array( + 'rot13' => new Twig_Filter_Function('str_rot13'), + ); + } + + // ... + } + +As you can see in the above code, the ``getFilters()`` method returns an array +where keys are the name of the filters (``rot13``) and the values the +definition of the filter (``new Twig_Filter_Function('str_rot13')``). + +As seen in the previous chapter, you can also define filters as static methods +on the extension class:: + +$twig->addFilter('rot13', new Twig_Filter_Function('Project_Twig_Extension::rot13Filter')); + +You can also use ``Twig_Filter_Method`` instead of ``Twig_Filter_Function`` +when defining a filter to use a method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFilters() + { + return array( + 'rot13' => new Twig_Filter_Method($this, 'rot13Filter'), + ); + } + + public function rot13Filter($string) + { + return str_rot13($string); + } + + // ... + } + +The first argument of the ``Twig_Filter_Method`` constructor is always +``$this``, the current extension object. The second one is the name of the +method to call. + +Using methods for filters is a great way to package your filter without +polluting the global namespace. This also gives the developer more flexibility +at the cost of a small overhead. + +Overriding default Filters +.......................... + +If some default core filters do not suit your needs, you can easily override +them by creating your own core extension. Of course, you don't need to copy +and paste the whole core extension code of Twig. Instead, you can just extends +it and override the filter(s) you want by overriding the ``getFilters()`` +method:: + + class MyCoreExtension extends Twig_Extension_Core + { + public function getFilters() + { + return array_merge(parent::getFilters(), array( + 'date' => new Twig_Filter_Method($this, 'dateFilter'), + // ... + )); + } + + public function dateFilter($timestamp, $format = 'F j, Y H:i') + { + return '...'.twig_date_format_filter($timestamp, $format); + } + + // ... + } + +Here, we override the ``date`` filter with a custom one. Using this new core +extension is as simple as registering the ``MyCoreExtension`` extension by +calling the ``addExtension()`` method on the environment instance:: + + $twig = new Twig_Environment($loader); + $twig->addExtension(new MyCoreExtension()); + +But I can already hear some people wondering how it can work as the Core +extension is loaded by default. That's true, but the trick is that both +extensions share the same unique identifier (``core`` - defined in the +``getName()`` method). By registering an extension with the same name as an +existing one, you have actually overridden the default one, even if it is +already registered:: + + $twig->addExtension(new Twig_Extension_Core()); + $twig->addExtension(new MyCoreExtension()); + +Tags +~~~~ + +Adding a tag in an extension can be done by overriding the +``getTokenParsers()`` method. This method must return an array of tags to add +to the Twig environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTokenParsers() + { + return array(new Project_Set_TokenParser()); + } + + // ... + } + +In the above code, we have added a single new tag, defined by the +``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is +responsible for parsing the tag and compiling it to PHP. + +Operators +~~~~~~~~~ + +The ``getOperators()`` methods allows to add new operators. Here is how to add +``!``, ``||``, and ``&&`` operators:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getOperators() + { + return array( + array( + '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + ), + array( + '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + ), + ); + } + + // ... + } + +Tests +~~~~~ + +The ``getTests()`` methods allows to add new test functions:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTests() + { + return array( + 'even' => new Twig_Test_Function('twig_test_even'), + ); + } + + // ... + } + +.. _`spl_autoload_register()`: http://www.php.net/spl_autoload_register +.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php diff --git a/core/vendor/twig/twig/doc/api.rst b/core/vendor/twig/twig/doc/api.rst new file mode 100644 index 0000000..a462066 --- /dev/null +++ b/core/vendor/twig/twig/doc/api.rst @@ -0,0 +1,487 @@ +Twig for Developers +=================== + +This chapter describes the API to Twig and not the template language. It will +be most useful as reference to those implementing the template interface to +the application and not those who are creating Twig templates. + +Basics +------ + +Twig uses a central object called the **environment** (of class +``Twig_Environment``). Instances of this class are used to store the +configuration and extensions, and are used to load templates from the file +system or other locations. + +Most applications will create one ``Twig_Environment`` object on application +initialization and use that to load templates. In some cases it's however +useful to have multiple environments side by side, if different configurations +are in use. + +The simplest way to configure Twig to load templates for your application +looks roughly like this:: + + require_once '/path/to/lib/Twig/Autoloader.php'; + Twig_Autoloader::register(); + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + )); + +This will create a template environment with the default settings and a loader +that looks up the templates in the ``/path/to/templates/`` folder. Different +loaders are available and you can also write your own if you want to load +templates from a database or other resources. + +.. note:: + + Notice that the second argument of the environment is an array of options. + The ``cache`` option is a compilation cache directory, where Twig caches + the compiled templates to avoid the parsing phase for sub-sequent + requests. It is very different from the cache you might want to add for + the evaluated templates. For such a need, you can use any available PHP + cache library. + +To load a template from this environment you just have to call the +``loadTemplate()`` method which then returns a ``Twig_Template`` instance:: + + $template = $twig->loadTemplate('index.html'); + +To render the template with some variables, call the ``render()`` method:: + + echo $template->render(array('the' => 'variables', 'go' => 'here')); + +.. note:: + + The ``display()`` method is a shortcut to output the template directly. + +You can also load and render the template in one fell swoop:: + + echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here')); + +.. _environment_options: + +Environment Options +------------------- + +When creating a new ``Twig_Environment`` instance, you can pass an array of +options as the constructor second argument:: + + $twig = new Twig_Environment($loader, array('debug' => true)); + +The following options are available: + +* ``debug``: When set to ``true``, the generated templates have a + ``__toString()`` method that you can use to display the generated nodes + (default to ``false``). + +* ``charset``: The charset used by the templates (default to ``utf-8``). + +* ``base_template_class``: The base template class to use for generated + templates (default to ``Twig_Template``). + +* ``cache``: An absolute path where to store the compiled templates, or + ``false`` to disable caching (which is the default). + +* ``auto_reload``: When developing with Twig, it's useful to recompile the + template whenever the source code changes. If you don't provide a value for + the ``auto_reload`` option, it will be determined automatically based on the + ``debug`` value. + +* ``strict_variables``: If set to ``false``, Twig will silently ignore invalid + variables (variables and or attributes/methods that do not exist) and + replace them with a ``null`` value. When set to ``true``, Twig throws an + exception instead (default to ``false``). + +* ``autoescape``: If set to ``true``, auto-escaping will be enabled by default + for all templates (default to ``true``). As of Twig 1.8, you can set the + escaping strategy to use (``html``, ``js``, ``false`` to disable, or a PHP + callback that takes the template "filename" and must return the escaping + strategy to use -- the callback cannot be a function name to avoid collision + with built-in escaping strategies). + +* ``optimizations``: A flag that indicates which optimizations to apply + (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to + disable). + +Loaders +------- + +Loaders are responsible for loading templates from a resource such as the file +system. + +Compilation Cache +~~~~~~~~~~~~~~~~~ + +All template loaders can cache the compiled templates on the filesystem for +future reuse. It speeds up Twig a lot as templates are only compiled once; and +the performance boost is even larger if you use a PHP accelerator such as APC. +See the ``cache`` and ``auto_reload`` options of ``Twig_Environment`` above +for more information. + +Built-in Loaders +~~~~~~~~~~~~~~~~ + +Here is a list of the built-in loaders Twig provides: + +* ``Twig_Loader_Filesystem``: Loads templates from the file system. This + loader can find templates in folders on the file system and is the preferred + way to load them:: + + $loader = new Twig_Loader_Filesystem($templateDir); + + It can also look for templates in an array of directories:: + + $loader = new Twig_Loader_Filesystem(array($templateDir1, $templateDir2)); + + With such a configuration, Twig will first look for templates in + ``$templateDir1`` and if they do not exist, it will fallback to look for + them in the ``$templateDir2``. + +* ``Twig_Loader_String``: Loads templates from a string. It's a dummy loader + as you pass it the source code directly:: + + $loader = new Twig_Loader_String(); + +* ``Twig_Loader_Array``: Loads a template from a PHP array. It's passed an + array of strings bound to template names. This loader is useful for unit + testing:: + + $loader = new Twig_Loader_Array($templates); + +.. tip:: + + When using the ``Array`` or ``String`` loaders with a cache mechanism, you + should know that a new cache key is generated each time a template content + "changes" (the cache key being the source code of the template). If you + don't want to see your cache grows out of control, you need to take care + of clearing the old cache file by yourself. + +Create your own Loader +~~~~~~~~~~~~~~~~~~~~~~ + +All loaders implement the ``Twig_LoaderInterface``:: + + interface Twig_LoaderInterface + { + /** + * Gets the source code of a template, given its name. + * + * @param string $name string The name of the template to load + * + * @return string The template source code + */ + function getSource($name); + + /** + * Gets the cache key to use for the cache for a given template name. + * + * @param string $name string The name of the template to load + * + * @return string The cache key + */ + function getCacheKey($name); + + /** + * Returns true if the template is still fresh. + * + * @param string $name The template name + * @param timestamp $time The last modification time of the cached template + */ + function isFresh($name, $time); + } + +As an example, here is how the built-in ``Twig_Loader_String`` reads:: + + class Twig_Loader_String implements Twig_LoaderInterface + { + public function getSource($name) + { + return $name; + } + + public function getCacheKey($name) + { + return $name; + } + + public function isFresh($name, $time) + { + return false; + } + } + +The ``isFresh()`` method must return ``true`` if the current cached template +is still fresh, given the last modification time, or ``false`` otherwise. + +Using Extensions +---------------- + +Twig extensions are packages that add new features to Twig. Using an +extension is as simple as using the ``addExtension()`` method:: + + $twig->addExtension(new Twig_Extension_Sandbox()); + +Twig comes bundled with the following extensions: + +* *Twig_Extension_Core*: Defines all the core features of Twig. + +* *Twig_Extension_Escaper*: Adds automatic output-escaping and the possibility + to escape/unescape blocks of code. + +* *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig + environment, making it safe to evaluated untrusted code. + +* *Twig_Extension_Optimizer*: Optimizers the node tree before compilation. + +The core, escaper, and optimizer extensions do not need to be added to the +Twig environment, as they are registered by default. You can disable an +already registered extension:: + + $twig->removeExtension('escaper'); + +Built-in Extensions +------------------- + +This section describes the features added by the built-in extensions. + +.. tip:: + + Read the chapter about extending Twig to learn how to create your own + extensions. + +Core Extension +~~~~~~~~~~~~~~ + +The ``core`` extension defines all the core features of Twig: + +* Tags: + + * ``for`` + * ``if`` + * ``extends`` + * ``include`` + * ``block`` + * ``filter`` + * ``macro`` + * ``import`` + * ``from`` + * ``set`` + * ``spaceless`` + +* Filters: + + * ``date`` + * ``format`` + * ``replace`` + * ``url_encode`` + * ``json_encode`` + * ``title`` + * ``capitalize`` + * ``upper`` + * ``lower`` + * ``striptags`` + * ``join`` + * ``reverse`` + * ``length`` + * ``sort`` + * ``merge`` + * ``default`` + * ``keys`` + * ``escape`` + * ``e`` + +* Functions: + + * ``range`` + * ``constant`` + * ``cycle`` + * ``parent`` + * ``block`` + +* Tests: + + * ``even`` + * ``odd`` + * ``defined`` + * ``sameas`` + * ``null`` + * ``divisibleby`` + * ``constant`` + * ``empty`` + +Escaper Extension +~~~~~~~~~~~~~~~~~ + +The ``escaper`` extension adds automatic output escaping to Twig. It defines a +tag, ``autoescape``, and a filter, ``raw``. + +When creating the escaper extension, you can switch on or off the global +output escaping strategy:: + + $escaper = new Twig_Extension_Escaper(true); + $twig->addExtension($escaper); + +If set to ``true``, all variables in templates are escaped (using the ``html`` +escaping strategy), except those using the ``raw`` filter: + +.. code-block:: jinja + + {{ article.to_html|raw }} + +You can also change the escaping mode locally by using the ``autoescape`` tag +(see the :doc:`autoescape` doc for the syntax used before +Twig 1.8): + +.. code-block:: jinja + + {% autoescape 'html' %} + {{ var }} + {{ var|raw }} {# var won't be escaped #} + {{ var|escape }} {# var won't be double-escaped #} + {% endautoescape %} + +.. warning:: + + The ``autoescape`` tag has no effect on included files. + +The escaping rules are implemented as follows: + +* Literals (integers, booleans, arrays, ...) used in the template directly as + variables or filter arguments are never automatically escaped: + + .. code-block:: jinja + + {{ "Twig
" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ text }} {# will be escaped #} + +* Expressions which the result is always a literal or a variable marked safe + are never automatically escaped: + + .. code-block:: jinja + + {{ foo ? "Twig
" : "
Twig" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text : "
Twig" }} {# will be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text|raw : "
Twig" }} {# won't be escaped #} + + {% set text = "Twig
" %} + {{ foo ? text|escape : "
Twig" }} {# the result of the expression won't be escaped #} + +* Escaping is applied before printing, after any other filter is applied: + + .. code-block:: jinja + + {{ var|upper }} {# is equivalent to {{ var|upper|escape }} #} + +* The `raw` filter should only be used at the end of the filter chain: + + .. code-block:: jinja + + {{ var|raw|upper }} {# will be escaped #} + + {{ var|upper|raw }} {# won't be escaped #} + +* Automatic escaping is not applied if the last filter in the chain is marked + safe for the current context (e.g. ``html`` or ``js``). ``escaper`` and + ``escaper('html')`` are marked safe for html, ``escaper('js')`` is marked + safe for javascript, ``raw`` is marked safe for everything. + + .. code-block:: jinja + + {% autoescape true js %} + {{ var|escape('html') }} {# will be escaped for html and javascript #} + {{ var }} {# will be escaped for javascript #} + {{ var|escape('js') }} {# won't be double-escaped #} + {% endautoescape %} + +.. note:: + + Note that autoescaping has some limitations as escaping is applied on + expressions after evaluation. For instance, when working with + concatenation, ``{{ foo|raw ~ bar }}`` won't give the expected result as + escaping is applied on the result of the concatenation, not on the + individual variables (so, the ``raw`` filter won't have any effect here). + +Sandbox Extension +~~~~~~~~~~~~~~~~~ + +The ``sandbox`` extension can be used to evaluate untrusted code. Access to +unsafe attributes and methods is prohibited. The sandbox security is managed +by a policy instance. By default, Twig comes with one policy class: +``Twig_Sandbox_SecurityPolicy``. This class allows you to white-list some +tags, filters, properties, and methods:: + + $tags = array('if'); + $filters = array('upper'); + $methods = array( + 'Article' => array('getTitle', 'getBody'), + ); + $properties = array( + 'Article' => array('title', 'body'), + ); + $functions = array('range'); + $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); + +With the previous configuration, the security policy will only allow usage of +the ``if`` tag, and the ``upper`` filter. Moreover, the templates will only be +able to call the ``getTitle()`` and ``getBody()`` methods on ``Article`` +objects, and the ``title`` and ``body`` public properties. Everything else +won't be allowed and will generate a ``Twig_Sandbox_SecurityError`` exception. + +The policy object is the first argument of the sandbox constructor:: + + $sandbox = new Twig_Extension_Sandbox($policy); + $twig->addExtension($sandbox); + +By default, the sandbox mode is disabled and should be enabled when including +untrusted template code by using the ``sandbox`` tag: + +.. code-block:: jinja + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +You can sandbox all templates by passing ``true`` as the second argument of +the extension constructor:: + + $sandbox = new Twig_Extension_Sandbox($policy, true); + +Optimizer Extension +~~~~~~~~~~~~~~~~~~~ + +The ``optimizer`` extension optimizes the node tree before compilation:: + + $twig->addExtension(new Twig_Extension_Optimizer()); + +By default, all optimizations are turned on. You can select the ones you want +to enable by passing them to the constructor:: + + $optimizer = new Twig_Extension_Optimizer(Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR); + + $twig->addExtension($optimizer); + +Exceptions +---------- + +Twig can throw exceptions: + +* ``Twig_Error``: The base exception for all errors. + +* ``Twig_Error_Syntax``: Thrown to tell the user that there is a problem with + the template syntax. + +* ``Twig_Error_Runtime``: Thrown when an error occurs at runtime (when a filter + does not exist for instance). + +* ``Twig_Error_Loader``: Thrown when an error occurs during template loading. + +* ``Twig_Sandbox_SecurityError``: Thrown when an unallowed tag, filter, or + method is called in a sandboxed template. diff --git a/core/vendor/twig/twig/doc/coding_standards.rst b/core/vendor/twig/twig/doc/coding_standards.rst new file mode 100644 index 0000000..e0aab35 --- /dev/null +++ b/core/vendor/twig/twig/doc/coding_standards.rst @@ -0,0 +1,101 @@ +Coding Standards +================ + +When writing Twig templates, we recommend you to follow these official coding +standards: + +* Put one (and only one) space after the start of a delimiter (``{{``, ``{%``, + and ``{#``) and before the end of a delimiter (``}}``, ``%}``, and ``#}``): + + .. code-block:: jinja + + {{ foo }} + {# comment #} + {% if foo %}{% endif %} + + When using the whitespace control character, do not put any spaces between + it and the delimiter: + + .. code-block:: jinja + + {{- foo -}} + {#- comment -#} + {%- if foo -%}{%- endif -%} + +* Put one (and only one) space before and after the following operators: + comparison operators (``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``), math + operators (``+``, ``-``, ``/``, ``*``, ``%``, ``//``, ``**``), logic + operators (``not``, ``and``, ``or``), ``~``, ``is``, ``in``, and the ternary + operator (``?:``): + + .. code-block:: jinja + + {{ 1 + 2 }} + {{ foo ~ bar }} + {{ true ? true : false }} + +* Put one (and only one) space after the ``:`` sign in hashes and ``,`` in + arrays and hashes: + + .. code-block:: jinja + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Do not put any spaces after an opening parenthesis and before a closing + parenthesis in expressions: + + .. code-block:: jinja + + {{ 1 + (2 * 3) }} + +* Do not put any spaces before and after string delimiters: + + .. code-block:: jinja + + {{ 'foo' }} + {{ "foo" }} + +* Do not put any spaces before and after the following operators: ``|``, + ``.``, ``..``, ``[]``: + + .. code-block:: jinja + + {{ foo|upper|lower }} + {{ user.name }} + {{ user[name] }} + {% for i in 1..12 %}{% endfor %} + +* Do not put any spaces before and after the parenthesis used for filter and + function calls: + + .. code-block:: jinja + + {{ foo|default('foo') }} + {{ range(1..10) }} + +* Do not put any spaces before and after the opening and the closing of arrays + and hashes: + + .. code-block:: jinja + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Use lower cased and underscored variable names: + + .. code-block:: jinja + + {% set foo = 'foo' %} + {% set foo_bar = 'foo' %} + +* Indent your code inside tags (use the same indentation as the one used for + the main language of the file): + + .. code-block:: jinja + + {% block foo %} + {% if true %} + true + {% endif %} + {% endblock %} diff --git a/core/modules/path/path.js b/core/vendor/twig/twig/doc/filters/abs.rst similarity index 5% copy from core/modules/path/path.js copy to core/vendor/twig/twig/doc/filters/abs.rst index 41b6e8f..3a82f62 100644 --- a/core/modules/path/path.js +++ b/core/vendor/twig/twig/doc/filters/abs.rst @@ -1,21 +1,18 @@ -/** - * @file - * Attaches behaviors for the Path module. - */ -(function ($) { +``abs`` +======= -"use strict"; +The ``abs`` filter returns the absolute value. -Drupal.behaviors.pathFieldsetSummaries = { - attach: function (context) { - $(context).find('fieldset.path-form').drupalSetSummary(function (context) { - var path = $('.form-item-path-alias input').val(); +.. code-block:: jinja - return path ? - Drupal.t('Alias: @alias', { '@alias': path }) : - Drupal.t('No alias'); - }); - } -}; + {# number = -5 #} + + {{ number|abs }} + + {# outputs 5 #} -})(jQuery); +.. note:: + + Internally, Twig uses the PHP `abs`_ function. + +.. _`abs`: http://php.net/abs diff --git a/core/vendor/Symfony/Component/Yaml/README.md b/core/vendor/twig/twig/doc/filters/capitalize.rst similarity index 6% copy from core/vendor/Symfony/Component/Yaml/README.md copy to core/vendor/twig/twig/doc/filters/capitalize.rst index 3441316..10546a1 100644 --- a/core/vendor/Symfony/Component/Yaml/README.md +++ b/core/vendor/twig/twig/doc/filters/capitalize.rst @@ -1,17 +1,11 @@ -Yaml Component +``capitalize`` ============== -YAML implements most of the YAML 1.2 specification. +The ``capitalize`` filter capitalizes a value. The first character will be +uppercase, all others lowercase: - use Symfony\Component\Yaml\Yaml; +.. code-block:: jinja - $array = Yaml::parse($file); + {{ 'my first car'|capitalize }} - print Yaml::dump($array); - -Resources ---------- - -You can run the unit tests with the following command: - - phpunit + {# outputs 'My first car' #} diff --git a/core/vendor/twig/twig/doc/filters/convert_encoding.rst b/core/vendor/twig/twig/doc/filters/convert_encoding.rst new file mode 100644 index 0000000..2febab2 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/convert_encoding.rst @@ -0,0 +1,22 @@ +``convert_encoding`` +==================== + +.. versionadded:: 1.4 + The ``convert_encoding`` filter was added in Twig 1.4. + +The ``convert_encoding`` filter converts a string from one encoding to +another. The first argument is the expected output charset and the second one +is the input charset: + +.. code-block:: jinja + + {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} + +.. note:: + + This filter relies on the `iconv`_ or `mbstring`_ extension, so one of + them must be installed. In case both are installed, `mbstring`_ is used by + default (Twig before 1.8.1 uses `iconv`_ by default). + +.. _`iconv`: http://php.net/iconv +.. _`mbstring`: http://php.net/mbstring diff --git a/core/vendor/twig/twig/doc/filters/date.rst b/core/vendor/twig/twig/doc/filters/date.rst new file mode 100644 index 0000000..9833f03 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/date.rst @@ -0,0 +1,65 @@ +``date`` +======== + +.. versionadded:: 1.1 + The timezone support has been added in Twig 1.1. + +.. versionadded:: 1.5 + The default date format support has been added in Twig 1.5. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +The ``date`` filter formats a date to a given format: + +.. code-block:: jinja + + {{ post.published_at|date("m/d/Y") }} + +The ``date`` filter accepts strings (it must be in a format supported by the +`date`_ function), `DateTime`_ instances, or `DateInterval`_ instances. For +instance, to display the current date, filter the word "now": + +.. code-block:: jinja + + {{ "now"|date("m/d/Y") }} + +To escape words and characters in the date format use ``\\`` in front of each character: + +.. code-block:: jinja + + {{ post.published_at|date("F jS \\a\\t g:ia") }} + +You can also specify a timezone: + +.. code-block:: jinja + + {{ post.published_at|date("m/d/Y", "Europe/Paris") }} + +If no format is provided, Twig will use the default one: ``F j, Y H:i``. This +default can be easily changed by calling the ``setDateFormat()`` method on the +``core`` extension instance. The first argument is the default format for +dates and the second one is the default format for date intervals: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setDateFormat('d/m/Y', '%d days'); + +The default timezone can also be set globally by calling ``setTimezone()``: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +.. _`date`: http://www.php.net/date +.. _`DateTime`: http://www.php.net/DateTime +.. _`DateInterval`: http://www.php.net/DateInterval + +If the value passed to the ``date`` filter is null, it will return the current date by default. +If an empty string is desired instead of the current date, use a ternary operator: + +.. code-block:: jinja + + {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }} diff --git a/core/vendor/twig/twig/doc/filters/default.rst b/core/vendor/twig/twig/doc/filters/default.rst new file mode 100644 index 0000000..4055ead --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/default.rst @@ -0,0 +1,28 @@ +``default`` +=========== + +The ``default`` filter returns the passed default value if the value is +undefined or empty, otherwise the value of the variable: + +.. code-block:: jinja + + {{ var|default('var is not defined') }} + + {{ var.foo|default('foo item on var is not defined') }} + + {{ var['foo']|default('foo item on var is not defined') }} + + {{ ''|default('passed var is empty') }} + +When using the ``default`` filter on an expression that uses variables in some +method calls, be sure to use the ``default`` filter whenever a variable can be +undefined: + +.. code-block:: jinja + + {{ var.method(foo|default('foo'))|default('foo') }} + +.. note:: + + Read the documentation for the :doc:`defined<../tests/defined>` and + :doc:`empty<../tests/empty>` tests to learn more about their semantics. diff --git a/core/vendor/twig/twig/doc/filters/escape.rst b/core/vendor/twig/twig/doc/filters/escape.rst new file mode 100644 index 0000000..5142977 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/escape.rst @@ -0,0 +1,39 @@ +``escape`` +========== + +The ``escape`` filter converts the characters ``&``, ``<``, ``>``, ``'``, and +``"`` in strings to HTML-safe sequences. Use this if you need to display text +that might contain such characters in HTML: + +.. code-block:: jinja + + {{ user.username|escape }} + +For convenience, the ``e`` filter is defined as an alias: + +.. code-block:: jinja + + {{ user.username|e }} + +The ``escape`` filter can also be used in other contexts than HTML thanks to +an optional argument which defines the escaping strategy to use: + +.. code-block:: jinja + + {{ user.username|e }} + {# is equivalent to #} + {{ user.username|e('html') }} + +And here is how to escape variables included in JavaScript code: + +.. code-block:: jinja + + {{ user.username|escape('js') }} + {{ user.username|e('js') }} + +.. note:: + + Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function + for the HTML escaping strategy. + +.. _`htmlspecialchars`: http://php.net/htmlspecialchars diff --git a/core/modules/field/modules/text/text.info b/core/vendor/twig/twig/doc/filters/format.rst similarity index 12% copy from core/modules/field/modules/text/text.info copy to core/vendor/twig/twig/doc/filters/format.rst index 3ba8357..fd5b18d 100644 --- a/core/modules/field/modules/text/text.info +++ b/core/vendor/twig/twig/doc/filters/format.rst @@ -1,7 +1,16 @@ -name = Text -description = Defines simple text field types. -package = Core -version = VERSION -core = 8.x -dependencies[] = field -required = TRUE +``format`` +========== + +The ``format`` filter formats a given string by replacing the placeholders +(placeholders follows the `printf`_ notation): + +.. code-block:: jinja + + {{ "I like %s and %s."|format(foo, "bar") }} + + {# returns I like foo and bar + if the foo parameter equals to the foo string. #} + +.. _`printf`: http://www.php.net/printf + +.. seealso:: :doc:`replace` diff --git a/core/vendor/twig/twig/doc/filters/index.rst b/core/vendor/twig/twig/doc/filters/index.rst new file mode 100644 index 0000000..bd8f495 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/index.rst @@ -0,0 +1,30 @@ +Filters +======= + +.. toctree:: + :maxdepth: 1 + + date + format + replace + number_format + url_encode + json_encode + convert_encoding + title + capitalize + nl2br + upper + lower + striptags + join + reverse + length + sort + default + keys + escape + raw + merge + slice + trim diff --git a/core/vendor/twig/twig/doc/filters/join.rst b/core/vendor/twig/twig/doc/filters/join.rst new file mode 100644 index 0000000..eec2045 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/join.rst @@ -0,0 +1,18 @@ +``join`` +======== + +The ``join`` filter returns a string which is the concatenation of the items +of a sequence: + +.. code-block:: jinja + + {{ [1, 2, 3]|join }} + {# returns 123 #} + +The separator between elements is an empty string per default, but you can +define it with the optional first parameter: + +.. code-block:: jinja + + {{ [1, 2, 3]|join('|') }} + {# returns 1|2|3 #} diff --git a/core/vendor/twig/twig/doc/filters/json_encode.rst b/core/vendor/twig/twig/doc/filters/json_encode.rst new file mode 100644 index 0000000..c7d19b3 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/json_encode.rst @@ -0,0 +1,14 @@ +``json_encode`` +=============== + +The ``json_encode`` filter returns the JSON representation of a string: + +.. code-block:: jinja + + {{ data|json_encode() }} + +.. note:: + + Internally, Twig uses the PHP `json_encode`_ function. + +.. _`json_encode`: http://php.net/json_encode diff --git a/core/vendor/twig/twig/doc/filters/keys.rst b/core/vendor/twig/twig/doc/filters/keys.rst new file mode 100644 index 0000000..e4f090c --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/keys.rst @@ -0,0 +1,11 @@ +``keys`` +======== + +The ``keys`` filter returns the keys of an array. It is useful when you want to +iterate over the keys of an array: + +.. code-block:: jinja + + {% for key in array|keys %} + ... + {% endfor %} diff --git a/core/vendor/twig/twig/doc/filters/length.rst b/core/vendor/twig/twig/doc/filters/length.rst new file mode 100644 index 0000000..f79b9bd --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/length.rst @@ -0,0 +1,12 @@ +``length`` +========== + +The ``length`` filters returns the number of items of a sequence or mapping, or +the length of a string: + +.. code-block:: jinja + + {% if users|length > 10 %} + ... + {% endif %} + diff --git a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md b/core/vendor/twig/twig/doc/filters/lower.rst similarity index 6% copy from core/vendor/Symfony/Component/Yaml/CHANGELOG.md copy to core/vendor/twig/twig/doc/filters/lower.rst index 096cf65..ef9faa9 100644 --- a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md +++ b/core/vendor/twig/twig/doc/filters/lower.rst @@ -1,8 +1,10 @@ -CHANGELOG +``lower`` ========= -2.1.0 ------ +The ``lower`` filter converts a value to lowercase: - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) +.. code-block:: jinja + + {{ 'WELCOME'|lower }} + + {# outputs 'welcome' #} diff --git a/core/vendor/twig/twig/doc/filters/merge.rst b/core/vendor/twig/twig/doc/filters/merge.rst new file mode 100644 index 0000000..4348e7a --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/merge.rst @@ -0,0 +1,41 @@ +``merge`` +========= + +The ``merge`` filter merges an array with the another array: + +.. code-block:: jinja + + {% set values = [1, 2] %} + + {% set values = values|merge(['apple', 'orange']) %} + + {# values now contains [1, 2, 'apple', 'orange'] #} + +New values are added at the end of the existing ones. + +The ``merge`` filter also works on hashes: + +.. code-block:: jinja + + {% set items = { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'unknown' } %} + + {% set items = items|merge({ 'peugeot': 'car', 'renault': 'car' }) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'renault': 'car' } #} + +For hashes, the merging process occurs on the keys: if the key does not +already exist, it is added but if the key already exists, its value is +overridden. + +.. tip:: + + If you want to ensure that some values are defined in an array (by given + default values), reverse the two elements in the call: + + .. code-block:: jinja + + {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + + {% set items = { 'apple': 'unknown' }|merge(items) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit' } #} diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php b/core/vendor/twig/twig/doc/filters/nl2br.rst similarity index 5% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php rename to core/vendor/twig/twig/doc/filters/nl2br.rst index 0b0bbd0..694c672 100644 --- a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/Namespaced/Baz.php +++ b/core/vendor/twig/twig/doc/filters/nl2br.rst @@ -1,17 +1,22 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Namespaced; - -class Baz -{ - public static $loaded = true; -} +``nl2br`` +========= + +.. versionadded:: 1.5 + The nl2br filter was added in Twig 1.5. + +The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: + +.. code-block:: jinja + + {{ "I like Twig.\nYou will like it too."|nl2br }} + {# outputs + + I like Twig.
+ You will like it too. + + #} + +.. note:: + + The ``nl2br`` filter pre-escapes the input before applying the + transformation. diff --git a/core/vendor/twig/twig/doc/filters/number_format.rst b/core/vendor/twig/twig/doc/filters/number_format.rst new file mode 100644 index 0000000..ccc8f2f --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/number_format.rst @@ -0,0 +1,38 @@ +``number_format`` +================= + +.. versionadded:: 1.5 + The number_format filter was added in Twig 1.5 + +The ``number_format`` filter formats numbers. It is a wrapper around PHP's +`number_format`_ function: + +.. code-block:: jinja + + {{ 200.35|number_format }} + +You can control the number of decimal places, decimal point, and thousands +separator using the additional arguments: + +.. code-block:: jinja + + {{ 9800.333|number_format(2, ',', '.') }} + +If no formatting options are provided then Twig will use the default formatting +options of: + +- 0 decimal places. +- ``.`` as the decimal point. +- ``,`` as the thousands separator. + +These defaults can be easily changed through the core extension: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setNumberFormat(3, ',', '.'); + +The defaults set for ``number_format`` can be over-ridden upon each call using the +additional parameters. + +.. _`number_format`: http://php.net/number_format diff --git a/core/vendor/twig/twig/doc/filters/raw.rst b/core/vendor/twig/twig/doc/filters/raw.rst new file mode 100644 index 0000000..434dd24 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/raw.rst @@ -0,0 +1,12 @@ +``raw`` +======= + +The ``raw`` filter marks the value as being "safe", which means that in an +environment with automatic escaping enabled this variable will not be escaped +if ``raw`` is the last filter applied to it: + +.. code-block:: jinja + + {% autoescape true %} + {{ var|raw }} {# var won't be escaped #} + {% endautoescape %} diff --git a/core/vendor/twig/twig/doc/filters/replace.rst b/core/vendor/twig/twig/doc/filters/replace.rst new file mode 100644 index 0000000..cc603fa --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/replace.rst @@ -0,0 +1,14 @@ +``replace`` +=========== + +The ``replace`` filter formats a given string by replacing the placeholders +(placeholders are free-form): + +.. code-block:: jinja + + {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} + + {# returns I like foo and bar + if the foo parameter equals to the foo string. #} + +.. seealso:: :doc:`format` diff --git a/core/vendor/twig/twig/doc/filters/reverse.rst b/core/vendor/twig/twig/doc/filters/reverse.rst new file mode 100644 index 0000000..54fafb4 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/reverse.rst @@ -0,0 +1,23 @@ +``reverse`` +=========== + +.. versionadded:: 1.6 + Support for strings has been added in Twig 1.6. + +The ``reverse`` filter reverses a sequence, a mapping, or a string: + +.. code-block:: jinja + + {% for use in users|reverse %} + ... + {% endfor %} + + {{ '1234'|reverse }} + + {# outputs 4321 #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: http://php.net/Traversable diff --git a/core/vendor/twig/twig/doc/filters/slice.rst b/core/vendor/twig/twig/doc/filters/slice.rst new file mode 100644 index 0000000..80a4293 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/slice.rst @@ -0,0 +1,57 @@ +``slice`` +=========== + +.. versionadded:: 1.6 + The slice filter was added in Twig 1.6. + +The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4]|slice(1, 2) %} + {# will iterate over 2 and 3 #} + {% endfor %} + + {{ '1234'|slice(1, 2) }} + + {# outputs 23 #} + +You can use any valid expression for both the start and the length: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4]|slice(start, length) %} + {# ... #} + {% endfor %} + +As syntactic sugar, you can also use the ``[]`` notation: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4][start:length] %} + {# ... #} + {% endfor %} + + {{ '1234'[1:2] }} + +The ``slice`` filter works as the `array_slice`_ PHP function for arrays and +`substr`_ for strings. + +If the start is non-negative, the sequence will start at that start in the +variable. If start is negative, the sequence will start that far from the end +of the variable. + +If length is given and is positive, then the sequence will have up to that +many elements in it. If the variable is shorter than the length, then only the +available variable elements will be present. If length is given and is +negative then the sequence will stop that many elements from the end of the +variable. If it is omitted, then the sequence will have everything from offset +up until the end of the variable. + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: http://php.net/manual/en/class.traversable.php +.. _`array_slice`: http://php.net/array_slice +.. _`substr`: http://php.net/substr diff --git a/core/vendor/twig/twig/doc/filters/sort.rst b/core/vendor/twig/twig/doc/filters/sort.rst new file mode 100644 index 0000000..0e330d2 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/sort.rst @@ -0,0 +1,17 @@ +``sort`` +======== + +The ``sort`` filter sorts an array: + +.. code-block:: jinja + + {% for use in users|sort %} + ... + {% endfor %} + +.. note:: + + Internally, Twig uses the PHP `asort`_ function to maintain index + association. + +.. _`asort`: http://php.net/asort diff --git a/core/vendor/twig/twig/doc/filters/striptags.rst b/core/vendor/twig/twig/doc/filters/striptags.rst new file mode 100644 index 0000000..5ccca45 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/striptags.rst @@ -0,0 +1,15 @@ +``striptags`` +============= + +The ``striptags`` filter strips SGML/XML tags and replace adjacent whitespace +by one space: + +.. code-block:: jinja + + {% some_html|striptags %} + +.. note:: + + Internally, Twig uses the PHP `strip_tags`_ function. + +.. _`strip_tags`: http://php.net/strip_tags diff --git a/core/vendor/twig/twig/doc/filters/title.rst b/core/vendor/twig/twig/doc/filters/title.rst new file mode 100644 index 0000000..c5a318e --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/title.rst @@ -0,0 +1,11 @@ +``title`` +========= + +The ``title`` filter returns a titlecased version of the value. Words will +start with uppercase letters, all remaining characters are lowercase: + +.. code-block:: jinja + + {{ 'my first car'|title }} + + {# outputs 'My First Car' #} diff --git a/core/vendor/twig/twig/doc/filters/trim.rst b/core/vendor/twig/twig/doc/filters/trim.rst new file mode 100644 index 0000000..f1215f6 --- /dev/null +++ b/core/vendor/twig/twig/doc/filters/trim.rst @@ -0,0 +1,24 @@ +``trim`` +======== + +.. versionadded:: 1.6.2 + The trim filter was added in Twig 1.6.2. + +The ``trim`` filter strips whitespace (or other characters) from the beginning +and end of a string: + +.. code-block:: jinja + + {{ ' I like Twig. '|trim }} + + {# outputs 'I like Twig.' #} + + {{ ' I like Twig.'|trim('.') }} + + {# outputs ' I like Twig' #} + +.. note:: + + Internally, Twig uses the PHP `trim`_ function. + +.. _`trim`: http://php.net/trim diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Delete.php b/core/vendor/twig/twig/doc/filters/upper.rst similarity index 14% copy from core/lib/Drupal/Core/Database/Driver/pgsql/Delete.php copy to core/vendor/twig/twig/doc/filters/upper.rst index e9914ca..561cebe 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Delete.php +++ b/core/vendor/twig/twig/doc/filters/upper.rst @@ -1,12 +1,10 @@ - - */ -class Twig_Markup implements Countable -{ - protected $content; - protected $charset; +``attribute`` can be used to access a "dynamic" attribute of a variable: - public function __construct($content, $charset) - { - $this->content = (string) $content; - $this->charset = $charset; - } +.. code-block:: jinja - public function __toString() - { - return $this->content; - } + {{ attribute(object, method) }} + {{ attribute(object, method, arguments) }} + {{ attribute(array, item) }} - public function count() - { - return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); - } -} +.. note:: + + The resolution algorithm is the same as the one used for the ``.`` + notation, except that the item can be any valid expression. diff --git a/core/vendor/twig/twig/doc/functions/block.rst b/core/vendor/twig/twig/doc/functions/block.rst new file mode 100644 index 0000000..fd571ef --- /dev/null +++ b/core/vendor/twig/twig/doc/functions/block.rst @@ -0,0 +1,15 @@ +``block`` +========= + +When a template uses inheritance and if you want to print a block multiple +times, use the ``block`` function: + +.. code-block:: jinja + + {% block title %}{% endblock %} + +

{{ block('title') }}

+ + {% block body %}{% endblock %} + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/HookInitTest.php b/core/vendor/twig/twig/doc/functions/constant.rst similarity index 5% copy from core/modules/system/lib/Drupal/system/Tests/Theme/HookInitTest.php copy to core/vendor/twig/twig/doc/functions/constant.rst index 2bba519..5b247b3 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/HookInitTest.php +++ b/core/vendor/twig/twig/doc/functions/constant.rst @@ -1,39 +1,9 @@ - 'Theme initialization in hook_init()', - 'description' => 'Tests that the theme system can be correctly initialized in hook_init().', - 'group' => 'Theme', - ); - } - - function setUp() { - parent::setUp('theme_test'); - } - - /** - * Test that the theme system can generate output when called by hook_init(). - */ - function testThemeInitializationHookInit() { - $this->drupalGet('theme-test/hook-init'); - // Verify that themed output generated in hook_init() appears. - $this->assertRaw('Themed output generated in hook_init()'); - // Verify that the default theme's CSS still appears when the theme system - // is initialized in hook_init(). - $this->assertRaw('stark/css/layout.css'); - } -} + {{ some_date|date(constant('DATE_W3C')) }} + {{ constant('Namespace\\Classname::CONSTANT_NAME') }} diff --git a/core/modules/language/tests/language_test.info b/core/vendor/twig/twig/doc/functions/cycle.rst similarity index 10% copy from core/modules/language/tests/language_test.info copy to core/vendor/twig/twig/doc/functions/cycle.rst index 6a9a7aa..fe11d68 100644 --- a/core/modules/language/tests/language_test.info +++ b/core/vendor/twig/twig/doc/functions/cycle.rst @@ -1,6 +1,20 @@ -name = "Language test" -description = "Support module for the language layer tests." -core = 8.x -package = Testing -version = VERSION -hidden = TRUE +``cycle`` +========= + +The ``cycle`` function cycles on an array of values: + +.. code-block:: jinja + + {% for i in 0..10 %} + {{ cycle(['odd', 'even'], i) }} + {% endfor %} + +The array can contain any number of values: + +.. code-block:: jinja + + {% set fruits = ['apple', 'orange', 'citrus'] %} + + {% for i in 0..10 %} + {{ cycle(fruits, i) }} + {% endfor %} diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php b/core/vendor/twig/twig/doc/functions/date.rst similarity index 5% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php rename to core/vendor/twig/twig/doc/functions/date.rst index 81ff7aa..c1a011c 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/ProjectExtension.php +++ b/core/vendor/twig/twig/doc/functions/date.rst @@ -1,41 +1,46 @@ -setDefinition('project.service.bar', new Definition('FooClass')); - $configuration->setParameter('project.parameter.bar', isset($config['foo']) ? $config['foo'] : 'foobar'); - - $configuration->setDefinition('project.service.foo', new Definition('FooClass')); - $configuration->setParameter('project.parameter.foo', isset($config['foo']) ? $config['foo'] : 'foobar'); - - return $configuration; - } - - public function getXsdValidationBasePath() - { - return false; - } - - public function getNamespace() - { - return 'http://www.example.com/schema/project'; - } - - public function getAlias() - { - return 'project'; - } - - public function getConfiguration(array $config, ContainerBuilder $container) - { - return null; - } -} +``date`` +======== + +.. versionadded:: 1.6 + The date function has been added in Twig 1.6. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +Converts an argument to a date to allow date comparison: + +.. code-block:: jinja + + {% if date(user.created_at) < date('+2days') %} + {# do something #} + {% endif %} + +The argument must be in a format supported by the `date`_ function. + +You can pass a timezone as the second argument: + +.. code-block:: jinja + + {% if date(user.created_at) < date('+2days', 'Europe/Paris') %} + {# do something #} + {% endif %} + +If no argument is passed, the function returns the current date: + +.. code-block:: jinja + + {% if date(user.created_at) < date() %} + {# always! #} + {% endif %} + +.. note:: + + You can set the default timezone globally by calling ``setTimezone()`` on + the ``core`` extension instance: + + .. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +.. _`date`: http://www.php.net/date diff --git a/core/vendor/twig/twig/doc/functions/dump.rst b/core/vendor/twig/twig/doc/functions/dump.rst new file mode 100644 index 0000000..8ff0c05 --- /dev/null +++ b/core/vendor/twig/twig/doc/functions/dump.rst @@ -0,0 +1,64 @@ +``dump`` +======== + +.. versionadded:: 1.5 + The dump function was added in Twig 1.5. + +The ``dump`` function dumps information about a template variable. This is +mostly useful to debug a template that does not behave as expected by +introspecting its variables: + +.. code-block:: jinja + + {{ dump(user) }} + +.. note:: + + The ``dump`` function is not available by default. You must add the + ``Twig_Extension_Debug`` extension explicitly when creating your Twig + environment:: + + $twig = new Twig_Environment($loader, array( + 'debug' => true, + // ... + )); + $twig->addExtension(new Twig_Extension_Debug()); + + Even when enabled, the ``dump`` function won't display anything if the + ``debug`` option on the environment is not enabled (to avoid leaking debug + information on a production server). + +In an HTML context, wrap the output with a ``pre`` tag to make it easier to +read: + +.. code-block:: jinja + +
+        {{ dump(user) }}
+    
+ +.. tip:: + + Using a ``pre`` tag is not needed when `XDebug`_ is enabled and + ``html_errors`` is ``on``; as a bonus, the output is also nicer with + XDebug enabled. + +You can debug several variables by passing them as additional arguments: + +.. code-block:: jinja + + {{ dump(user, categories) }} + +If you don't pass any value, all variables from the current context are +dumped: + +.. code-block:: jinja + + {{ dump() }} + +.. note:: + + Internally, Twig uses the PHP `var_dump`_ function. + +.. _`XDebug`: http://xdebug.org/docs/display +.. _`var_dump`: http://php.net/var_dump diff --git a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md b/core/vendor/twig/twig/doc/functions/index.rst similarity index 6% copy from core/vendor/Symfony/Component/Yaml/CHANGELOG.md copy to core/vendor/twig/twig/doc/functions/index.rst index 096cf65..3315528 100644 --- a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md +++ b/core/vendor/twig/twig/doc/functions/index.rst @@ -1,8 +1,15 @@ -CHANGELOG +Functions ========= -2.1.0 ------ +.. toctree:: + :maxdepth: 1 - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) + range + cycle + constant + random + attribute + block + parent + dump + date diff --git a/core/vendor/twig/twig/doc/functions/parent.rst b/core/vendor/twig/twig/doc/functions/parent.rst new file mode 100644 index 0000000..f5bd200 --- /dev/null +++ b/core/vendor/twig/twig/doc/functions/parent.rst @@ -0,0 +1,20 @@ +``parent`` +========== + +When a template uses inheritance, it's possible to render the contents of the +parent block when overriding a block by using the ``parent`` function: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block sidebar %} +

Table Of Contents

+ ... + {{ parent() }} + {% endblock %} + +The ``parent()`` call will return the content of the ``sidebar`` block as +defined in the ``base.html`` template. + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` diff --git a/core/modules/book/book-all-books-block.tpl.php b/core/vendor/twig/twig/doc/functions/random.rst similarity index 8% copy from core/modules/book/book-all-books-block.tpl.php copy to core/vendor/twig/twig/doc/functions/random.rst index 8e5343b..104493d 100644 --- a/core/modules/book/book-all-books-block.tpl.php +++ b/core/vendor/twig/twig/doc/functions/random.rst @@ -1,23 +1,24 @@ - - $menu): ?> - - +.. versionadded:: 1.5 + The random function was added in Twig 1.5. + +.. versionadded:: 1.6 + String and integer handling was added in Twig 1.6. + +The ``random`` function returns a random value depending on the supplied +parameter type: + +* a random item from a sequence; +* a random character from a string; +* a random integer between 0 and the integer parameter (inclusive). + +.. code-block:: jinja + + {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} + {{ random('ABC') }} {# example output: C #} + {{ random() }} {# example output: 15386094 (works as native PHP `mt_rand`_ function) #} + {{ random(5) }} {# example output: 3 #} + +.. _`mt_rand`: http://php.net/mt_rand diff --git a/core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php b/core/vendor/twig/twig/doc/functions/range.rst similarity index 5% rename from core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php rename to core/vendor/twig/twig/doc/functions/range.rst index c41ca31..c9bdd96 100644 --- a/core/vendor/Symfony/Component/HttpKernel/DataCollector/MemoryDataCollector.php +++ b/core/vendor/twig/twig/doc/functions/range.rst @@ -1,51 +1,38 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpKernel\DataCollector; - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - -/** - * MemoryDataCollector. - * - * @author Fabien Potencier - */ -class MemoryDataCollector extends DataCollector -{ - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - $this->data = array( - 'memory' => memory_get_peak_usage(true), - ); - } - - /** - * Gets the memory. - * - * @return integer The memory - */ - public function getMemory() - { - return $this->data['memory']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'memory'; - } -} +``range`` +========= + +Returns a list containing an arithmetic progression of integers: + +.. code-block:: jinja + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + + {# returns 0, 1, 2, 3 #} + +When step is given (as the third parameter), it specifies the increment (or +decrement): + +.. code-block:: jinja + + {% for i in range(0, 6, 2) %} + {{ i }}, + {% endfor %} + + {# returns 0, 2, 4, 6 #} + +The Twig built-in ``..`` operator is just syntactic sugar for the ``range`` +function (with a step of 1): + +.. code-block:: jinja + + {% for i in 0..3 %} + {{ i }}, + {% endfor %} + +.. tip:: + + The ``range`` function works as the native PHP `range`_ function. + +.. _`range`: http://php.net/range diff --git a/core/vendor/twig/twig/doc/index.rst b/core/vendor/twig/twig/doc/index.rst new file mode 100644 index 0000000..56012f7 --- /dev/null +++ b/core/vendor/twig/twig/doc/index.rst @@ -0,0 +1,17 @@ +Twig +==== + +.. toctree:: + :maxdepth: 2 + + intro + templates + api + advanced + internals + recipes + coding_standards + tags/index + filters/index + functions/index + tests/index diff --git a/core/vendor/twig/twig/doc/internals.rst b/core/vendor/twig/twig/doc/internals.rst new file mode 100644 index 0000000..79a3c8d --- /dev/null +++ b/core/vendor/twig/twig/doc/internals.rst @@ -0,0 +1,140 @@ +Twig Internals +============== + +Twig is very extensible and you can easily hack it. Keep in mind that you +should probably try to create an extension before hacking the core, as most +features and enhancements can be done with extensions. This chapter is also +useful for people who want to understand how Twig works under the hood. + +How Twig works? +--------------- + +The rendering of a Twig template can be summarized into four key steps: + +* **Load** the template: If the template is already compiled, load it and go + to the *evaluation* step, otherwise: + + * First, the **lexer** tokenizes the template source code into small pieces + for easier processing; + * Then, the **parser** converts the token stream into a meaningful tree + of nodes (the Abstract Syntax Tree); + * Eventually, the *compiler* transforms the AST into PHP code; + +* **Evaluate** the template: It basically means calling the ``display()`` + method of the compiled template and passing it the context. + +The Lexer +--------- + +The lexer tokenizes a template source code into a token stream (each token is +an instance of ``Twig_Token``, and the stream is an instance of +``Twig_TokenStream``). The default lexer recognizes 13 different token types: + +* ``Twig_Token::BLOCK_START_TYPE``, ``Twig_Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) +* ``Twig_Token::VAR_START_TYPE``, ``Twig_Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) +* ``Twig_Token::TEXT_TYPE``: A text outside an expression; +* ``Twig_Token::NAME_TYPE``: A name in an expression; +* ``Twig_Token::NUMBER_TYPE``: A number in an expression; +* ``Twig_Token::STRING_TYPE``: A string in an expression; +* ``Twig_Token::OPERATOR_TYPE``: An operator; +* ``Twig_Token::PUNCTUATION_TYPE``: A punctuation sign; +* ``Twig_Token::INTERPOLATION_START_TYPE``, ``Twig_Token::INTERPOLATION_END_TYPE`` (as of Twig 1.5): Delimiters for string interpolation; +* ``Twig_Token::EOF_TYPE``: Ends of template. + +You can manually convert a source code into a token stream by calling the +``tokenize()`` of an environment:: + + $stream = $twig->tokenize($source, $identifier); + +As the stream has a ``__toString()`` method, you can have a textual +representation of it by echoing the object:: + + echo $stream."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + TEXT_TYPE(Hello ) + VAR_START_TYPE() + NAME_TYPE(name) + VAR_END_TYPE() + EOF_TYPE() + +.. note:: + + You can change the default lexer use by Twig (``Twig_Lexer``) by calling + the ``setLexer()`` method:: + + $twig->setLexer($lexer); + +The Parser +---------- + +The parser converts the token stream into an AST (Abstract Syntax Tree), or a +node tree (an instance of ``Twig_Node_Module``). The core extension defines +the basic nodes like: ``for``, ``if``, ... and the expression nodes. + +You can manually convert a token stream into a node tree by calling the +``parse()`` method of an environment:: + + $nodes = $twig->parse($stream); + +Echoing the node object gives you a nice representation of the tree:: + + echo $nodes."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + Twig_Node_Module( + Twig_Node_Text(Hello ) + Twig_Node_Print( + Twig_Node_Expression_Name(name) + ) + ) + +.. note:: + + The default parser (``Twig_TokenParser``) can be also changed by calling the + ``setParser()`` method:: + + $twig->setParser($parser); + +The Compiler +------------ + +The last step is done by the compiler. It takes a node tree as an input and +generates PHP code usable for runtime execution of the template. + +You can call the compiler by hand with the ``compile()`` method of an +environment:: + + $php = $twig->compile($nodes); + +The ``compile()`` method returns the PHP source code representing the node. + +The generated template for a ``Hello {{ name }}`` template reads as follows +(the actual output can differ depending on the version of Twig you are +using):: + + /* Hello {{ name }} */ + class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends Twig_Template + { + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo "Hello "; + echo twig_escape_filter($this->env, $this->getContext($context, "name"), "ndex", null, true); + } + + // some more code + } + +.. note:: + + As for the lexer and the parser, the default compiler (``Twig_Compiler``) can + be changed by calling the ``setCompiler()`` method:: + + $twig->setCompiler($compiler); diff --git a/core/vendor/twig/twig/doc/intro.rst b/core/vendor/twig/twig/doc/intro.rst new file mode 100644 index 0000000..f9dc226 --- /dev/null +++ b/core/vendor/twig/twig/doc/intro.rst @@ -0,0 +1,160 @@ +Introduction +============ + +This is the documentation for Twig, the flexible, fast, and secure template +engine for PHP. + +If you have any exposure to other text-based template languages, such as +Smarty, Django, or Jinja, you should feel right at home with Twig. It's both +designer and developer friendly by sticking to PHP's principles and adding +functionality useful for templating environments. + +The key-features are... + +* *Fast*: Twig compiles templates down to plain optimized PHP code. The + overhead compared to regular PHP code was reduced to the very minimum. + +* *Secure*: Twig has a sandbox mode to evaluate untrusted template code. This + allows Twig to be used as a template language for applications where users + may modify the template design. + +* *Flexible*: Twig is powered by a flexible lexer and parser. This allows the + developer to define its own custom tags and filters, and create its own DSL. + +Prerequisites +------------- + +Twig needs at least **PHP 5.2.4** to run. + +Installation +------------ + +You have multiple ways to install Twig. If you are unsure what to do, go with +the tarball. + +Installing from the tarball release +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Download the most recent tarball from the `download page`_ +2. Unpack the tarball +3. Move the files somewhere in your project + +Installing the development version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Install Subversion or Git +2. For Git: ``git clone git://github.com/fabpot/Twig.git`` +3. For Subversion: ``svn co http://svn.twig-project.org/trunk/ twig`` + +Installing the PEAR package +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Install PEAR +2. ``pear channel-discover pear.twig-project.org`` +3. ``pear install twig/Twig`` (or ``pear install twig/Twig-beta``) + +Installing via Composer +~~~~~~~~~~~~~~~~~~~~~~~ + +1. Install composer in your project: + +.. code-block:: bash + + curl -s http://getcomposer.org/installer | php + +2. Create a ``composer.json`` file in your project root: + +.. code-block:: javascript + + { + "require": { + "twig/twig": "1.*" + } + } + +3. Install via composer + +.. code-block:: bash + + php composer.phar install + +.. note:: + If you want to learn more about Composer, the ``composer.json`` file syntax + and its usage, you can read the `online documentation`_. + +Installing the C extension +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.4 + The C extension was added in Twig 1.4. + +Twig comes with a C extension that enhances the performance of the Twig +runtime engine. You can install it like any other PHP extension: + +.. code-block:: bash + + $ cd ext/twig + $ phpize + $ ./configure + $ make + $ make install + +Finally, enable the extension in your ``php.ini`` configuration file: + +.. code-block:: ini + + extension=twig.so + +And from now on, Twig will automatically compile your templates to take +advantage of the C extension. Note that this extension does not replace the +PHP code but only provides an optimized version of the +``Twig_Template::getAttribute()`` method. + +.. tip:: + + On Windows, you can also simply download and install a `pre-build DLL`_. + +Basic API Usage +--------------- + +This section gives you a brief introduction to the PHP API for Twig. + +The first step to use Twig is to register its autoloader:: + + require_once '/path/to/lib/Twig/Autoloader.php'; + Twig_Autoloader::register(); + +Replace the ``/path/to/lib/`` path with the path you used for Twig +installation. + +.. note:: + + Twig follows the PEAR convention names for its classes, which means you + can easily integrate Twig classes loading in your own autoloader. + +.. code-block:: php + + $loader = new Twig_Loader_String(); + $twig = new Twig_Environment($loader); + + echo $twig->render('Hello {{ name }}!', array('name' => 'Fabien')); + +Twig uses a loader (``Twig_Loader_String``) to locate templates, and an +environment (``Twig_Environment``) to store the configuration. + +The ``render()`` method loads the template passed as a first argument and +renders it with the variables passed as a second argument. + +As templates are generally stored on the filesystem, Twig also comes with a +filesystem loader:: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + )); + + echo $twig->render('index.html', array('name' => 'Fabien')); + +.. _`download page`: https://github.com/fabpot/Twig/tags +.. _`online documentation`: http://getcomposer.org/doc +.. _`pre-build DLL`: https://github.com/stealth35/stealth35.github.com/downloads diff --git a/core/vendor/twig/twig/doc/recipes.rst b/core/vendor/twig/twig/doc/recipes.rst new file mode 100644 index 0000000..59a6dfb --- /dev/null +++ b/core/vendor/twig/twig/doc/recipes.rst @@ -0,0 +1,362 @@ +Recipes +======= + +Making a Layout conditional +--------------------------- + +Working with Ajax means that the same content is sometimes displayed as is, +and sometimes decorated with a layout. As Twig layout template names can be +any valid expression, you can pass a variable that evaluates to ``true`` when +the request is made via Ajax and choose the layout accordingly: + +.. code-block:: jinja + + {% extends request.ajax ? "base_ajax.html" : "base.html" %} + + {% block content %} + This is the content to be displayed. + {% endblock %} + +Making an Include dynamic +------------------------- + +When including a template, its name does not need to be a string. For +instance, the name can depend on the value of a variable: + +.. code-block:: jinja + + {% include var ~ '_foo.html' %} + +If ``var`` evaluates to ``index``, the ``index_foo.html`` template will be +rendered. + +As a matter of fact, the template name can be any valid expression, such as +the following: + +.. code-block:: jinja + + {% include var|default('index') ~ '_foo.html' %} + +Overriding a Template that also extends itself +---------------------------------------------- + +A template can be customized in two different ways: + +* *Inheritance*: A template *extends* a parent template and overrides some + blocks; + +* *Replacement*: If you use the filesystem loader, Twig loads the first + template it finds in a list of configured directories; a template found in a + directory *replaces* another one from a directory further in the list. + +But how do you combine both: *replace* a template that also extends itself +(aka a template in a directory further in the list)? + +Let's say that your templates are loaded from both ``.../templates/mysite`` +and ``.../templates/default`` in this order. The ``page.twig`` template, +stored in ``.../templates/default`` reads as follows: + +.. code-block:: jinja + + {# page.twig #} + {% extends "layout.twig" %} + + {% block content %} + {% endblock %} + +You can replace this template by putting a file with the same name in +``.../templates/mysite``. And if you want to extend the original template, you +might be tempted to write the following: + +.. code-block:: jinja + + {# page.twig in .../templates/mysite #} + {% extends "page.twig" %} {# from .../templates/default #} + +Of course, this will not work as Twig will always load the template from +``.../templates/mysite``. + +It turns out it is possible to get this to work, by adding a directory right +at the end of your template directories, which is the parent of all of the +other directories: ``.../templates`` in our case. This has the effect of +making every template file within our system uniquely addressable. Most of the +time you will use the "normal" paths, but in the special case of wanting to +extend a template with an overriding version of itself we can reference its +parent's full, unambiguous template path in the extends tag: + +.. code-block:: jinja + + {# page.twig in .../templates/mysite #} + {% extends "default/page.twig" %} {# from .../templates #} + +.. note:: + + This recipe was inspired by the following Django wiki page: + http://code.djangoproject.com/wiki/ExtendingTemplates + +Customizing the Syntax +---------------------- + +Twig allows some syntax customization for the block delimiters. It's not +recommended to use this feature as templates will be tied with your custom +syntax. But for specific projects, it can make sense to change the defaults. + +To change the block delimiters, you need to create your own lexer object:: + + $twig = new Twig_Environment(); + + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('{#', '#}'), + 'tag_block' => array('{%', '%}'), + 'tag_variable' => array('{{', '}}'), + )); + $twig->setLexer($lexer); + +Here are some configuration example that simulates some other template engines +syntax:: + + // Ruby erb syntax + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('<%#', '%>'), + 'tag_block' => array('<%', '%>'), + 'tag_variable' => array('<%=', '%>'), + )); + + // SGML Comment Syntax + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array(''), + 'tag_block' => array(''), + 'tag_variable' => array('${', '}'), + )); + + // Smarty like + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('{*', '*}'), + 'tag_block' => array('{', '}'), + 'tag_variable' => array('{$', '}'), + )); + +Using dynamic Object Properties +------------------------------- + +When Twig encounters a variable like ``article.title``, it tries to find a +``title`` public property in the ``article`` object. + +It also works if the property does not exist but is rather defined dynamically +thanks to the magic ``__get()`` method; you just need to also implement the +``__isset()`` magic method like shown in the following snippet of code:: + + class Article + { + public function __get($name) + { + if ('title' == $name) { + return 'The title'; + } + + // throw some kind of error + } + + public function __isset($name) + { + if ('title' == $name) { + return true; + } + + return false; + } + } + +Accessing the parent Context in Nested Loops +-------------------------------------------- + +Sometimes, when using nested loops, you need to access the parent context. The +parent context is always accessible via the ``loop.parent`` variable. For +instance, if you have the following template data:: + + $data = array( + 'topics' => array( + 'topic1' => array('Message 1 of topic 1', 'Message 2 of topic 1'), + 'topic2' => array('Message 1 of topic 2', 'Message 2 of topic 2'), + ), + ); + +And the following template to display all messages in all topics: + +.. code-block:: jinja + + {% for topic, messages in topics %} + * {{ loop.index }}: {{ topic }} + {% for message in messages %} + - {{ loop.parent.loop.index }}.{{ loop.index }}: {{ message }} + {% endfor %} + {% endfor %} + +The output will be similar to: + +.. code-block:: text + + * 1: topic1 + - 1.1: The message 1 of topic 1 + - 1.2: The message 2 of topic 1 + * 2: topic2 + - 2.1: The message 1 of topic 2 + - 2.2: The message 2 of topic 2 + +In the inner loop, the ``loop.parent`` variable is used to access the outer +context. So, the index of the current ``topic`` defined in the outer for loop +is accessible via the ``loop.parent.loop.index`` variable. + +Defining undefined Functions and Filters on the Fly +--------------------------------------------------- + +When a function (or a filter) is not defined, Twig defaults to throw a +``Twig_Error_Syntax`` exception. However, it can also call a `callback`_ (any +valid PHP callable) which should return a function (or a filter). + +For filters, register callbacks with ``registerUndefinedFilterCallback()``. +For functions, use ``registerUndefinedFunctionCallback()``:: + + // auto-register all native PHP functions as Twig functions + // don't try this at home as it's not secure at all! + $twig->registerUndefinedFunctionCallback(function ($name) { + if (function_exists($name)) { + return new Twig_Function_Function($name); + } + + return false; + }); + +If the callable is not able to return a valid function (or filter), it must +return ``false``. + +If you register more than one callback, Twig will call them in turn until one +does not return ``false``. + +.. tip:: + + As the resolution of functions and filters is done during compilation, + there is no overhead when registering these callbacks. + +Validating the Template Syntax +------------------------------ + +When template code is providing by a third-party (through a web interface for +instance), it might be interesting to validate the template syntax before +saving it. If the template code is stored in a `$template` variable, here is +how you can do it:: + + try { + $twig->parse($twig->tokenize($template)); + + // the $template is valid + } catch (Twig_Error_Syntax $e) { + // $template contains one or more syntax errors + } + +If you iterate over a set of files, you can pass the filename to the +``tokenize()`` method to get the filename in the exception message:: + + foreach ($files as $file) { + try { + $twig->parse($twig->tokenize($template, $file)); + + // the $template is valid + } catch (Twig_Error_Syntax $e) { + // $template contains one or more syntax errors + } + } + +.. note:: + + This method won't catch any sandbox policy violations because the policy + is enforced during template rendering (as Twig needs the context for some + checks like allowed methods on objects). + +Refreshing modified Templates when APC is enabled and apc.stat = 0 +------------------------------------------------------------------ + +When using APC with ``apc.stat`` set to ``0`` and Twig cache enabled, clearing +the template cache won't update the APC cache. To get around this, one can +extend ``Twig_Environment`` and force the update of the APC cache when Twig +rewrites the cache:: + + class Twig_Environment_APC extends Twig_Environment + { + protected function writeCacheFile($file, $content) + { + parent::writeCacheFile($file, $content); + + // Compile cached file into bytecode cache + apc_compile_file($file); + } + } + +Reusing a stateful Node Visitor +------------------------------- + +When attaching a visitor to a ``Twig_Environment`` instance, Twig uses it to +visit *all* templates it compiles. If you need to keep some state information +around, you probably want to reset it when visiting a new template. + +This can be easily achieved with the following code:: + + protected $someTemplateState = array(); + + public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + { + if ($node instanceof Twig_Node_Module) { + // reset the state as we are entering a new template + $this->someTemplateState = array(); + } + + // ... + + return $node; + } + +Using the Template name to set the default Escaping Strategy +------------------------------------------------------------ + +.. versionadded:: 1.8 + This recipe requires Twig 1.8 or later. + +The ``autoescape`` option determines the default escaping strategy to use when +no escaping is applied on a variable. When Twig is used to mostly generate +HTML files, you can set it to ``html`` and explicitly change it to ``js`` when +you have some dynamic JavaScript files thanks to the ``autoescape`` tag: + +.. code-block:: jinja + + {% autoescape js %} + ... some JS ... + {% endautoescape %} + +But if you have many HTML and JS files, and if your template names follow some +conventions, you can instead determine the default escaping strategy to use +based on the template name. Let's say that your template names always ends +with ``.html`` for HTML files and ``.js`` for JavaScript ones, here is how you +can configure Twig:: + + function twig_escaping_guesser($filename) + { + // get the format + $format = substr($filename, strrpos($filename, '.') + 1); + + switch ($format) { + 'js': + return 'js'; + default: + return 'html'; + } + } + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'autoescape' => 'twig_escaping_guesser', + )); + +This dynamic strategy does not incur any overhead at runtime as auto-escaping +is done at compilation time. + +.. _callback: http://www.php.net/manual/en/function.is-callable.php diff --git a/core/vendor/twig/twig/doc/tags/autoescape.rst b/core/vendor/twig/twig/doc/tags/autoescape.rst new file mode 100644 index 0000000..c5ff0c2 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/autoescape.rst @@ -0,0 +1,71 @@ +``autoescape`` +============== + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the ``autoescape`` tag: + +.. code-block:: jinja + + {# The following syntax works as of Twig 1.8 -- see the note below for previous versions #} + + {% autoescape %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'html' %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'js' %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + +.. note:: + + Before Twig 1.8, the syntax was different: + + .. code-block:: jinja + + {% autoescape true %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + + {% autoescape true js %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + +When automatic escaping is enabled everything is escaped by default except for +values explicitly marked as safe. Those can be marked in the template by using +the :doc:`raw<../filters/raw>` filter: + +.. code-block:: jinja + + {% autoescape %} + {{ safe_value|raw }} + {% endautoescape %} + +Functions returning template data (like :doc:`macros` and +:doc:`parent<../functions/parent>`) always return safe markup. + +.. note:: + + Twig is smart enough to not escape an already escaped value by the + :doc:`escape<../filters/escape>` filter. + +.. note:: + + The chapter :doc:`Twig for Developers<../api>` gives more information + about when and how automatic escaping is applied. diff --git a/core/vendor/twig/twig/doc/tags/block.rst b/core/vendor/twig/twig/doc/tags/block.rst new file mode 100644 index 0000000..e380482 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/block.rst @@ -0,0 +1,11 @@ +``block`` +========= + +Blocks are used for inheritance and act as placeholders and replacements at +the same time. They are documented in detail in the documentation for the +:doc:`extends<../tags/extends>` tag. + +Block names should consist of alphanumeric characters, and underscores. Dashes +are not permitted. + +.. seealso:: :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` diff --git a/core/vendor/twig/twig/doc/tags/do.rst b/core/vendor/twig/twig/doc/tags/do.rst new file mode 100644 index 0000000..eca63d0 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/do.rst @@ -0,0 +1,12 @@ +``do`` +====== + +.. versionadded:: 1.5 + The do tag was added in Twig 1.5. + +The ``do`` tag works exactly like the regular variable expression (``{{ ... +}}``) just that it doesn't print anything: + +.. code-block:: jinja + + {% do 1 + 2 %} diff --git a/core/vendor/twig/twig/doc/tags/embed.rst b/core/vendor/twig/twig/doc/tags/embed.rst new file mode 100644 index 0000000..5a6a029 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/embed.rst @@ -0,0 +1,178 @@ +``embed`` +========= + +.. versionadded:: 1.8 + The ``embed`` tag was added in Twig 1.8. + +The ``embed`` tag combines the behaviour of :doc:`include` and +:doc:`extends`. +It allows you to include another template's contents, just like ``include`` +does. But it also allows you to override any block defined inside the +included template, like when extending a template. + +Think of an embedded template as a "micro layout skeleton". + +.. code-block:: jinja + + {% embed "teasers_skeleton.twig" %} + {# These blocks are defined in "teasers_skeleton.twig" #} + {# and we override them right here: #} + {% block left_teaser %} + Some content for the left teaser box + {% endblock %} + {% block right_teaser %} + Some content for the right teaser box + {% endblock %} + {% endembed %} + +The ``embed`` tag takes the idea of template inheritance to the level of +content fragments. While template inheritance allows for "document skeletons", +which are filled with life by child templates, the ``embed`` tag allows you to +create "skeletons" for smaller units of content and re-use and fill them +anywhere you like. + +Since the use case may not be obvious, let's look at a simplified example. +Imagine a base template shared by multiple HTML pages, defining a single block +named "content": + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ │ │ + │ │ (child template to │ │ + │ │ put content here) │ │ + │ │ │ │ + │ │ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Some pages ("foo" and "bar") share the same content structure - +two vertically stacked boxes: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ ┌─ block "top" ───┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ │ ┌─ block "bottom" ┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +While other pages ("boom" and "baz") share a different content structure - +two boxes side by side: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ ┌ block ┐ ┌ block ┐ │ │ + │ │ │"left" │ │"right"│ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ └───────┘ └───────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Without the ``embed`` tag, you have two ways to design your templates: + + * Create two "intermediate" base templates that extend the master layout + template: one with vertically stacked boxes to be used by the "foo" and + "bar" pages and another one with side-by-side boxes for the "boom" and + "baz" pages. + + * Embed the markup for the top/bottom and left/right boxes into each page + template directly. + +These two solutions do not scale well because they each have a major drawback: + + * The first solution may indeed work for this simplified example. But imagine + we add a sidebar, which may again contain different, recurring structures + of content. Now we would need to create intermediate base templates for + all occurring combinations of content structure and sidebar structure... + and so on. + + * The second solution involves duplication of common code with all its negative + consequences: any change involves finding and editing all affected copies + of the structure, correctness has to be verified for each copy, copies may + go out of sync by careless modifications etc. + +In such a situation, the ``embed`` tag comes in handy. The common layout +code can live in a single base template, and the two different content structures, +let's call them "micro layouts" go into separate templates which are embedded +as necessary: + +Page template ``foo.twig``: + +.. code-block:: jinja + + {% extends "layout_skeleton.twig" %} + + {% block content %} + {% embed "vertical_boxes_skeleton.twig" %} + {% block top %} + Some content for the top box + {% endblock %} + + {% block bottom %} + Some content for the bottom box + {% endblock %} + {% endembed %} + {% endblock %} + +And here is the code for ``vertical_boxes_skeleton.twig``: + +.. code-block:: html+jinja + +
+ {% block top %} + Top box default content + {% endblock %} +
+ +
+ {% block bottom %} + Bottom box default content + {% endblock %} +
+ +The goal of the ``vertical_boxes_skeleton.twig`` template being to factor +out the HTML markup for the boxes. + +The ``embed`` tag takes the exact same arguments as the ``include`` tag: + +.. code-block:: jinja + + {% embed "base" with {'foo': 'bar'} %} + ... + {% endembed %} + + {% embed "base" with {'foo': 'bar'} only %} + ... + {% endembed %} + + {% embed "base" ignore missing %} + ... + {% endembed %} + +.. warning:: + + As embedded templates do not have "names", auto-escaping strategies based + on the template "filename" won't work as expected if you change the + context (for instance, if you embed a CSS/JavaScript template into an HTML + one). In that case, explicitly set the default auto-escaping strategy with + the ``autoescape`` tag. + +.. seealso:: :doc:`include<../tags/include>` diff --git a/core/vendor/twig/twig/doc/tags/extends.rst b/core/vendor/twig/twig/doc/tags/extends.rst new file mode 100644 index 0000000..8d64436 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/extends.rst @@ -0,0 +1,187 @@ +``extends`` +=========== + +The ``extends`` tag can be used to extend a template from another one. + +.. note:: + + Like PHP, Twig does not support multiple inheritance. So you can only have + one extends tag called per rendering. However, Twig supports horizontal + :doc:`reuse`. + +Let's define a base template, ``base.html``, which defines a simple HTML +skeleton document: + +.. code-block:: html+jinja + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
{% block content %}{% endblock %}
+ + + + +In this example, the :doc:`block` tags define four blocks that child +templates can fill in. All the ``block`` tag does is to tell the template +engine that a child template may override those portions of the template. + +Child Template +-------------- + +A child template might look like this: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

Index

+

+ Welcome on my awesome homepage. +

+ {% endblock %} + +The ``extends`` tag is the key here. It tells the template engine that this +template "extends" another template. When the template system evaluates this +template, first it locates the parent. The extends tag should be the first tag +in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +You can't define multiple ``block`` tags with the same name in the same +template. This limitation exists because a block tag works in "both" +directions. That is, a block tag doesn't just provide a hole to fill - it also +defines the content that fills the hole in the *parent*. If there were two +similarly-named ``block`` tags in a template, that template's parent wouldn't +know which one of the blocks' content to use. + +If you want to print a block multiple times you can however use the +``block`` function: + +.. code-block:: jinja + + {% block title %}{% endblock %} +

{{ block('title') }}

+ {% block body %}{% endblock %} + +Parent Blocks +------------- + +It's possible to render the contents of the parent block by using the +:doc:`parent<../functions/parent>` function. This gives back the results of +the parent block: + +.. code-block:: jinja + + {% block sidebar %} +

Table Of Contents

+ ... + {{ parent() }} + {% endblock %} + +Named Block End-Tags +-------------------- + +Twig allows you to put the name of the block after the end tag for better +readability: + +.. code-block:: jinja + + {% block sidebar %} + {% block inner_sidebar %} + ... + {% endblock inner_sidebar %} + {% endblock sidebar %} + +Of course, the name after the ``endblock`` word must match the block name. + +Block Nesting and Scope +----------------------- + +Blocks can be nested for more complex layouts. Per default, blocks have access +to variables from outer scopes: + +.. code-block:: jinja + + {% for item in seq %} +
  • {% block loop_item %}{{ item }}{% endblock %}
  • + {% endfor %} + +Block Shortcuts +--------------- + +For blocks with few content, it's possible to use a shortcut syntax. The +following constructs do the same: + +.. code-block:: jinja + + {% block title %} + {{ page_title|title }} + {% endblock %} + +.. code-block:: jinja + + {% block title page_title|title %} + +Dynamic Inheritance +------------------- + +Twig supports dynamic inheritance by using a variable as the base template: + +.. code-block:: jinja + + {% extends some_var %} + +If the variable evaluates to a ``Twig_Template`` object, Twig will use it as +the parent template:: + + // {% extends layout %} + + $layout = $twig->loadTemplate('some_layout_template.twig'); + + $twig->display('template.twig', array('layout' => $layout)); + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence. The +first template that exists will be used as a parent: + +.. code-block:: jinja + + {% extends ['layout.html', 'base_layout.html'] %} + +Conditional Inheritance +----------------------- + +As the template name for the parent can be any valid Twig expression, it's +possible to make the inheritance mechanism conditional: + +.. code-block:: jinja + + {% extends standalone ? "minimum.html" : "base.html" %} + +In this example, the template will extend the "minimum.html" layout template +if the ``standalone`` variable evaluates to ``true``, and "base.html" +otherwise. + +.. seealso:: :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff --git a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php b/core/vendor/twig/twig/doc/tags/filter.rst similarity index 9% rename from core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php rename to core/vendor/twig/twig/doc/tags/filter.rst index 3af81cb..82ca5c6 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Tests/Fixtures/ExtensionLoadedBundle/ExtensionLoadedBundle.php +++ b/core/vendor/twig/twig/doc/tags/filter.rst @@ -1,18 +1,21 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ +Filter sections allow you to apply regular Twig filters on a block of template +data. Just wrap the code in the special ``filter`` section: -namespace Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionLoadedBundle; +.. code-block:: jinja -use Symfony\Component\HttpKernel\Bundle\Bundle; + {% filter upper %} + This text becomes uppercase + {% endfilter %} -class ExtensionLoadedBundle extends Bundle -{ -} +You can also chain filters: + +.. code-block:: jinja + + {% filter lower|escape %} + SOME TEXT + {% endfilter %} + + {# outputs "<strong>some text</strong>" #} diff --git a/core/vendor/twig/twig/doc/tags/flush.rst b/core/vendor/twig/twig/doc/tags/flush.rst new file mode 100644 index 0000000..55ef593 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/flush.rst @@ -0,0 +1,17 @@ +``flush`` +========= + +.. versionadded:: 1.5 + The flush tag was added in Twig 1.5. + +The ``flush`` tag tells Twig to flush the output buffer: + +.. code-block:: jinja + + {% flush %} + +.. note:: + + Internally, Twig uses the PHP `flush`_ function. + +.. _`flush`: http://php.net/flush diff --git a/core/vendor/twig/twig/doc/tags/for.rst b/core/vendor/twig/twig/doc/tags/for.rst new file mode 100644 index 0000000..722861a --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/for.rst @@ -0,0 +1,157 @@ +``for`` +======= + +Loop over each item in a sequence. For example, to display a list of users +provided in a variable called ``users``: + +.. code-block:: jinja + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +.. note:: + + A sequence can be either an array or an object implementing the + ``Traversable`` interface. + +If you do need to iterate over a sequence of numbers, you can use the ``..`` +operator: + +.. code-block:: jinja + + {% for i in 0..10 %} + * {{ i }} + {% endfor %} + +The above snippet of code would print all numbers from 0 to 10. + +It can be also useful with letters: + +.. code-block:: jinja + + {% for letter in 'a'..'z' %} + * {{ letter }} + {% endfor %} + +The ``..`` operator can take any expression at both sides: + +.. code-block:: jinja + + {% for letter in 'a'|upper..'z'|upper %} + * {{ letter }} + {% endfor %} + +.. tip: + + If you need a step different from 1, you can use the ``range`` function + instead. + +The `loop` variable +------------------- + +Inside of a ``for`` loop block you can access some special variables: + +===================== ============================================================= +Variable Description +===================== ============================================================= +``loop.index`` The current iteration of the loop. (1 indexed) +``loop.index0`` The current iteration of the loop. (0 indexed) +``loop.revindex`` The number of iterations from the end of the loop (1 indexed) +``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) +``loop.first`` True if first iteration +``loop.last`` True if last iteration +``loop.length`` The number of items in the sequence +``loop.parent`` The parent context +===================== ============================================================= + +.. code-block:: jinja + + {% for user in users %} + {{ loop.index }} - {{ user.username }} + {% endfor %} + +.. note:: + + The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and + ``loop.last`` variables are only available for PHP arrays, or objects that + implement the ``Countable`` interface. They are also not available when + looping with a condition. + +.. versionadded:: 1.2 + The ``if`` modifier support has been added in Twig 1.2. + +Adding a condition +------------------ + +Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You +can however filter the sequence during iteration which allows you to skip +items. The following example skips all the users which are not active: + +.. code-block:: jinja + +
      + {% for user in users if user.active %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The advantage is that the special loop variable will count correctly thus not +counting the users not iterated over. Keep in mind that properties like +``loop.last`` will not be defined when using loop conditions. + +.. note:: + + Using the ``loop`` variable within the condition is not recommended as it + will probably not be doing what you expect it to. For instance, adding a + condition like ``loop.index > 4`` won't work as the index is only + incremented when the condition is true (so the condition will never + match). + +The `else` Clause +----------------- + +If no iteration took place because the sequence was empty, you can render a +replacement block by using ``else``: + +.. code-block:: jinja + +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% else %} +
    • no user found
    • + {% endfor %} +
    + +Iterating over Keys +------------------- + +By default, a loop iterates over the values of the sequence. You can iterate +on keys by using the ``keys`` filter: + +.. code-block:: jinja + +

    Members

    +
      + {% for key in users|keys %} +
    • {{ key }}
    • + {% endfor %} +
    + +Iterating over Keys and Values +------------------------------ + +You can also access both keys and values: + +.. code-block:: jinja + +

    Members

    +
      + {% for key, user in users %} +
    • {{ key }}: {{ user.username|e }}
    • + {% endfor %} +
    diff --git a/core/vendor/twig/twig/doc/tags/from.rst b/core/vendor/twig/twig/doc/tags/from.rst new file mode 100644 index 0000000..5337a23 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/from.rst @@ -0,0 +1,8 @@ +``from`` +======== + +The ``from`` tags import :doc:`macro<../tags/macro>` names into the current +namespace. The tag is documented in detail in the documentation for the +:doc:`import<../tags/import>` tag. + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`import<../tags/import>` diff --git a/core/lib/Drupal/Core/Database/Driver/pgsql/Merge.php b/core/vendor/twig/twig/doc/tags/if.rst similarity index 5% copy from core/lib/Drupal/Core/Database/Driver/pgsql/Merge.php copy to core/vendor/twig/twig/doc/tags/if.rst index c3a2ae0..14e12b1 100644 --- a/core/lib/Drupal/Core/Database/Driver/pgsql/Merge.php +++ b/core/vendor/twig/twig/doc/tags/if.rst @@ -1,12 +1,43 @@ -Our website is in maintenance mode. Please, come back later.

    + {% endif %} + +You can also test if an array is not empty: + +.. code-block:: jinja + + {% if users %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +.. note:: + + If you want to test if the variable is defined, use ``if users is + defined`` instead. + +For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can use +more complex ``expressions`` there too: + +.. code-block:: jinja + + {% if kenny.sick %} + Kenny is sick. + {% elseif kenny.dead %} + You killed Kenny! You bastard!!! + {% else %} + Kenny looks okay --- so far + {% endif %} diff --git a/core/vendor/twig/twig/doc/tags/import.rst b/core/vendor/twig/twig/doc/tags/import.rst new file mode 100644 index 0000000..8d47b36 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/import.rst @@ -0,0 +1,79 @@ +``import`` +========== + +Twig supports putting often used code into :doc:`macros<../tags/macro>`. These +macros can go into different templates and get imported from there. + +There are two ways to import templates. You can import the complete template +into a variable or request specific macros from it. + +Imagine we have a helper module that renders forms (called ``forms.html``): + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro textarea(name, value, rows) %} + + {% endmacro %} + +The easiest and most flexible is importing the whole module into a variable. +That way you can access the attributes: + +.. code-block:: jinja + + {% import 'forms.html' as forms %} + +
    +
    Username
    +
    {{ forms.input('username') }}
    +
    Password
    +
    {{ forms.input('password', null, 'password') }}
    +
    +

    {{ forms.textarea('comment') }}

    + +Alternatively you can import names from the template into the current +namespace: + +.. code-block:: jinja + + {% from 'forms.html' import input as input_field, textarea %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    +

    {{ textarea('comment') }}

    + +Importing is not needed if the macros and the template are defined in the same +file; use the special ``_self`` variable instead: + +.. code-block:: jinja + + {# index.html template #} + + {% macro textarea(name, value, rows) %} + + {% endmacro %} + +

    {{ _self.textarea('comment') }}

    + +But you can still create an alias by importing from the ``_self`` variable: + +.. code-block:: jinja + + {# index.html template #} + + {% macro textarea(name, value, rows) %} + + {% endmacro %} + + {% import _self as forms %} + +

    {{ forms.textarea('comment') }}

    + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`from<../tags/from>` diff --git a/core/vendor/twig/twig/doc/tags/include.rst b/core/vendor/twig/twig/doc/tags/include.rst new file mode 100644 index 0000000..1440c50 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/include.rst @@ -0,0 +1,86 @@ +``include`` +=========== + +The ``include`` statement includes a template and return the rendered content +of that file into the current namespace: + +.. code-block:: jinja + + {% include 'header.html' %} + Body + {% include 'footer.html' %} + +Included templates have access to the variables of the active context. + +If you are using the filesystem loader, the templates are looked for in the +paths defined by it. + +You can add additional variables by passing them after the ``with`` keyword: + +.. code-block:: jinja + + {# the foo template will have access to the variables from the current context and the foo one #} + {% include 'foo' with {'foo': 'bar'} %} + + {% set vars = {'foo': 'bar'} %} + {% include 'foo' with vars %} + +You can disable access to the context by appending the ``only`` keyword: + +.. code-block:: jinja + + {# only the foo variable will be accessible #} + {% include 'foo' with {'foo': 'bar'} only %} + +.. code-block:: jinja + + {# no variable will be accessible #} + {% include 'foo' only %} + +.. tip:: + + When including a template created by an end user, you should consider + sandboxing it. More information in the :doc:`Twig for Developers<../api>` + chapter and in the :doc:`sandbox<../tags/sandbox>` tag documentation. + +The template name can be any valid Twig expression: + +.. code-block:: jinja + + {% include some_var %} + {% include ajax ? 'ajax.html' : 'not_ajax.html' %} + +And if the expression evaluates to a ``Twig_Template`` object, Twig will use it +directly:: + + // {% include template %} + + $template = $twig->loadTemplate('some_template.twig'); + + $twig->loadTemplate('template.twig')->display(array('template' => $template)); + +.. versionadded:: 1.2 + The ``ignore missing`` feature has been added in Twig 1.2. + +You can mark an include with ``ignore missing`` in which case Twig will ignore +the statement if the template to be ignored does not exist. It has to be +placed just after the template name. Here some valid examples: + +.. code-block:: jinja + + {% include "sidebar.html" ignore missing %} + {% include "sidebar.html" ignore missing with {'foo': 'bar} %} + {% include "sidebar.html" ignore missing only %} + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence before +inclusion. The first template that exists will be included: + +.. code-block:: jinja + + {% include ['page_detailed.html', 'page.html'] %} + +If ``ignore missing`` is given, it will fall back to rendering nothing if none +of the templates exist, otherwise it will throw an exception. diff --git a/core/vendor/twig/twig/doc/tags/index.rst b/core/vendor/twig/twig/doc/tags/index.rst new file mode 100644 index 0000000..fe0a00f --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/index.rst @@ -0,0 +1,24 @@ +Tags +==== + +.. toctree:: + :maxdepth: 1 + + for + if + macro + filter + set + extends + block + include + import + from + use + spaceless + autoescape + raw + flush + do + sandbox + embed diff --git a/core/vendor/twig/twig/doc/tags/macro.rst b/core/vendor/twig/twig/doc/tags/macro.rst new file mode 100644 index 0000000..3d920e3 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/macro.rst @@ -0,0 +1,91 @@ +``macro`` +========= + +Macros are comparable with functions in regular programming languages. They +are useful to put often used HTML idioms into reusable elements to not repeat +yourself. + +Here is a small example of a macro that renders a form element: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros differs from native PHP functions in a few ways: + +* Default argument values are defined by using the ``default`` filter in the + macro body; + +* Arguments of a macro are always optional. + +But as PHP functions, macros don't have access to the current template +variables. + +.. tip:: + + You can pass the whole context as an argument by using the special + ``_context`` variable. + +Macros can be defined in any template, and need to be "imported" before being +used (see the documentation for the :doc:`import<../tags/import>` tag for more +information): + +.. code-block:: jinja + + {% import "forms.html" as forms %} + +The above ``import`` call imports the "forms.html" file (which can contain only +macros, or a template and some macros), and import the functions as items of +the ``forms`` variable. + +The macro can then be called at will: + +.. code-block:: jinja + +

    {{ forms.input('username') }}

    +

    {{ forms.input('password', null, 'password') }}

    + +If macros are defined and used in the same template, you can use the +special ``_self`` variable, without importing them: + +.. code-block:: jinja + +

    {{ _self.input('username') }}

    + +When you want to use a macro in another one from the same file, use the ``_self`` +variable: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro wrapped_input(name, value, type, size) %} +
    + {{ _self.input(name, value, type, size) }} +
    + {% endmacro %} + +When the macro is defined in another file, you need to import it: + +.. code-block:: jinja + + {# forms.html #} + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {# shortcuts.html #} + + {% macro wrapped_input(name, value, type, size) %} + {% import "forms.html" as forms %} +
    + {{ forms.input(name, value, type, size) }} +
    + {% endmacro %} + +.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>` diff --git a/core/vendor/twig/twig/doc/tags/raw.rst b/core/vendor/twig/twig/doc/tags/raw.rst new file mode 100644 index 0000000..4136c70 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/raw.rst @@ -0,0 +1,16 @@ +``raw`` +======= + +The ``raw`` tag marks sections as being raw text that should not be parsed. +For example to put Twig syntax as example into a template you can use this +snippet: + +.. code-block:: jinja + + {% raw %} +
      + {% for item in seq %} +
    • {{ item }}
    • + {% endfor %} +
    + {% endraw %} diff --git a/core/vendor/twig/twig/doc/tags/sandbox.rst b/core/vendor/twig/twig/doc/tags/sandbox.rst new file mode 100644 index 0000000..0275537 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/sandbox.rst @@ -0,0 +1,30 @@ +``sandbox`` +=========== + +The ``sandbox`` tag can be used to enable the sandboxing mode for an included +template, when sandboxing is not enabled globally for the Twig environment: + +.. code-block:: jinja + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +.. warning:: + + The ``sandbox`` tag is only available when the sandbox extension is + enabled (see the :doc:`Twig for Developers<../api>` chapter). + +.. note:: + + The ``sandbox`` tag can only be used to sandbox an include tag and it + cannot be used to sandbox a section of a template. The following example + won't work for example: + + .. code-block:: jinja + + {% sandbox %} + {% for i in 1..2 %} + {{ i }} + {% endfor %} + {% endsandbox %} diff --git a/core/vendor/twig/twig/doc/tags/set.rst b/core/vendor/twig/twig/doc/tags/set.rst new file mode 100644 index 0000000..15090e7 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/set.rst @@ -0,0 +1,32 @@ +``set`` +======= + +Inside code blocks you can also assign values to variables. Assignments use +the ``set`` tag and can have multiple targets: + +.. code-block:: jinja + + {% set foo = 'foo' %} + + {% set foo = [1, 2] %} + + {% set foo = {'foo': 'bar'} %} + + {% set foo = 'foo' ~ 'bar' %} + + {% set foo, bar = 'foo', 'bar' %} + +The ``set`` tag can also be used to 'capture' chunks of text: + +.. code-block:: jinja + + {% set foo %} + + {% endset %} + +.. caution:: + + If you enable automatic output escaping, Twig will only consider the + content to be safe when capturing chunks of text. diff --git a/core/vendor/twig/twig/doc/tags/spaceless.rst b/core/vendor/twig/twig/doc/tags/spaceless.rst new file mode 100644 index 0000000..12e77b2 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/spaceless.rst @@ -0,0 +1,37 @@ +``spaceless`` +============= + +Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not +whitespace within HTML tags or whitespace in plain text: + +.. code-block:: jinja + + {% spaceless %} +
    + foo +
    + {% endspaceless %} + + {# output will be
    foo
    #} + +This tag is not meant to "optimize" the size of the generated HTML content but +merely to avoid extra whitespace between HTML tags to avoid browser rendering +quirks under some circumstances. + +.. tip:: + + If you want to optimize the size of the generated HTML content, gzip + compress the output instead. + +.. tip:: + + If you want to create a tag that actually removes all extra whitespace in + an HTML string, be warned that this is not as easy as it seems to be + (think of ``textarea`` or ``pre`` tags for instance). Using a third-party + library like Tidy is probably a better idea. + +.. tip:: + + For more information on whitespace control, read the + :doc:`dedicated<../templates>` section of the documentation and learn how + you can also use the whitespace control modifier on your tags. diff --git a/core/vendor/twig/twig/doc/tags/use.rst b/core/vendor/twig/twig/doc/tags/use.rst new file mode 100644 index 0000000..085f916 --- /dev/null +++ b/core/vendor/twig/twig/doc/tags/use.rst @@ -0,0 +1,123 @@ +``use`` +======= + +.. versionadded:: 1.1 + Horizontal reuse was added in Twig 1.1. + +.. note:: + + Horizontal reuse is an advanced Twig feature that is hardly ever needed in + regular templates. It is mainly used by projects that need to make + template blocks reusable without using inheritance. + +Template inheritance is one of the most powerful Twig's feature but it is +limited to single inheritance; a template can only extend one other template. +This limitation makes template inheritance simple to understand and easy to +debug: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +Horizontal reuse is a way to achieve the same goal as multiple inheritance, +but without the associated complexity: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +The ``use`` statement tells Twig to import the blocks defined in +```blocks.html`` into the current template (it's like macros, but for blocks): + +.. code-block:: jinja + + # blocks.html + {% block sidebar %}{% endblock %} + +In this example, the ``use`` statement imports the ``sidebar`` block into the +main template. The code is mostly equivalent to the following one (the +imported blocks are not outputted automatically): + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. note:: + + The ``use`` tag only imports a template if it does not extend another + template, if it does not define macros, and if the body is empty. But it + can *use* other templates. + +.. note:: + + Because ``use`` statements are resolved independently of the context + passed to the template, the template reference cannot be an expression. + +The main template can also override any imported block. If the template +already defines the ``sidebar`` block, then the one defined in ``blocks.html`` +is ignored. To avoid name conflicts, you can rename imported blocks: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as base_sidebar %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. versionadded:: 1.3 + The ``parent()`` support was added in Twig 1.3. + +The ``parent()`` function automatically determines the correct inheritance +tree, so it can be used when overriding a block defined in an imported +template: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block sidebar %} + {{ parent() }} + {% endblock %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +In this example, ``parent()`` will correctly call the ``sidebar`` block from +the ``blocks.html`` template. + +.. tip:: + + In Twig 1.2, renaming allows you to simulate inheritance by calling the + "parent" block: + + .. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as parent_sidebar %} + + {% block sidebar %} + {{ block('parent_sidebar') }} + {% endblock %} + +.. note:: + + You can use as many ``use`` statements as you want in any given template. + If two imported templates define the same block, the latest one wins. diff --git a/core/vendor/twig/twig/doc/templates.rst b/core/vendor/twig/twig/doc/templates.rst new file mode 100644 index 0000000..278e56d --- /dev/null +++ b/core/vendor/twig/twig/doc/templates.rst @@ -0,0 +1,727 @@ +Twig for Template Designers +=========================== + +This document describes the syntax and semantics of the template engine and +will be most useful as reference to those creating Twig templates. + +Synopsis +-------- + +A template is simply a text file. It can generate any text-based format (HTML, +XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or +``.xml`` are just fine. + +A template contains **variables** or **expressions**, which get replaced with +values when the template is evaluated, and **tags**, which control the logic +of the template. + +Below is a minimal template that illustrates a few basics. We will cover the +details later on: + +.. code-block:: html+jinja + + + + + My Webpage + + + + +

    My Webpage

    + {{ a_variable }} + + + +There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first +one is used to execute statements such as for-loops, the latter prints the +result of an expression to the template. + +IDEs Integration +---------------- + +Many IDEs support syntax highlighting and auto-completion for Twig: + +* *Textmate* via the `Twig bundle`_ +* *Vim* via the `Jinja syntax plugin`_ +* *Netbeans* via the `Twig syntax plugin`_ +* *PhpStorm* (native as of 2.1) +* *Eclipse* via the `Twig plugin`_ +* *Sublime Text* via the `Twig bundle`_ +* *GtkSourceView* via the `Twig language definition`_ (used by gedit and other projects) +* *Coda* and *SubEthaEdit* via the `Twig syntax mode`_ +* *Coda 2* via the `other Twig syntax mode`_ +* *Komodo* and *Komodo Edit* via the Django highlight/syntax check mode + +Variables +--------- + +The application passes variables to the templates you can mess around in the +template. Variables may have attributes or elements on them you can access +too. How a variable looks like heavily depends on the application providing +those. + +You can use a dot (``.``) to access attributes of a variable (methods or +properties of a PHP object, or items of a PHP array), or the so-called +"subscript" syntax (``[]``): + +.. code-block:: jinja + + {{ foo.bar }} + {{ foo['bar'] }} + +.. note:: + + It's important to know that the curly braces are *not* part of the + variable but the print statement. If you access variables inside tags + don't put the braces around. + +If a variable or attribute does not exist, you will get back a ``null`` value +when the ``strict_variables`` option is set to ``false``, otherwise Twig will +throw an error (see :ref:`environment options`). + +.. sidebar:: Implementation + + For convenience sake ``foo.bar`` does the following things on the PHP + layer: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid property; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid method + (even if ``bar`` is the constructor - use ``__construct()`` instead); + * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method; + * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; + * if not, return a ``null`` value. + + ``foo['bar']`` on the other hand only works with PHP arrays: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, return a ``null`` value. + +.. note:: + + If you want to get a dynamic attribute on a variable, use the + :doc:`attribute` function instead. + +Global Variables +~~~~~~~~~~~~~~~~ + +The following variables are always available in templates: + +* ``_self``: references the current template; +* ``_context``: references the current context; +* ``_charset``: references the current charset. + +Setting Variables +~~~~~~~~~~~~~~~~~ + +You can assign values to variables inside code blocks. Assignments use the +:doc:`set` tag: + +.. code-block:: jinja + + {% set foo = 'foo' %} + {% set foo = [1, 2] %} + {% set foo = {'foo': 'bar'} %} + +Filters +------- + +Variables can be modified by **filters**. Filters are separated from the +variable by a pipe symbol (``|``) and may have optional arguments in +parentheses. Multiple filters can be chained. The output of one filter is +applied to the next. + +The following example removes all HTML tags from the ``name`` and title-cases +it: + +.. code-block:: jinja + + {{ name|striptags|title }} + +Filters that accept arguments have parentheses around the arguments. This +example will join a list by commas: + +.. code-block:: jinja + + {{ list|join(', ') }} + +To apply a filter on a section of code, wrap it with the +:doc:`filter` tag: + +.. code-block:: jinja + + {% filter upper %} + This text becomes uppercase + {% endfilter %} + +Go to the :doc:`filters` page to learn more about the built-in +filters. + +Functions +--------- + +Functions can be called to generate content. Functions are called by their +name followed by parentheses (``()``) and may have arguments. + +For instance, the ``range`` function returns a list containing an arithmetic +progression of integers: + +.. code-block:: jinja + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + +Go to the :doc:`functions` page to learn more about the +built-in functions. + +Control Structure +----------------- + +A control structure refers to all those things that control the flow of a +program - conditionals (i.e. ``if``/``elseif``/``else``), ``for``-loops, as +well as things like blocks. Control structures appear inside ``{% ... %}`` +blocks. + +For example, to display a list of users provided in a variable called +``users``, use the :doc:`for` tag: + +.. code-block:: jinja + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The :doc:`if` tag can be used to test an expression: + +.. code-block:: jinja + + {% if users|length > 0 %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +Go to the :doc:`tags` page to learn more about the built-in tags. + +Comments +-------- + +To comment-out part of a line in a template, use the comment syntax ``{# ... +#}``. This is useful for debugging or to add information for other template +designers or yourself: + +.. code-block:: jinja + + {# note: disabled template because we no longer use this + {% for user in users %} + ... + {% endfor %} + #} + +Including other Templates +------------------------- + +The :doc:`include` tag is useful to include a template and +return the rendered content of that template into the current one: + +.. code-block:: jinja + + {% include 'sidebar.html' %} + +Per default included templates are passed the current context. + +The context that is passed to the included template includes variables defined +in the template: + +.. code-block:: jinja + + {% for box in boxes %} + {% include "render_box.html" %} + {% endfor %} + +The included template ``render_box.html`` is able to access ``box``. + +The filename of the template depends on the template loader. For instance, the +``Twig_Loader_Filesystem`` allows you to access other templates by giving the +filename. You can access templates in subdirectories with a slash: + +.. code-block:: jinja + + {% include "sections/articles/sidebar.html" %} + +This behavior depends on the application embedding Twig. + +Template Inheritance +-------------------- + +The most powerful part of Twig is template inheritance. Template inheritance +allows you to build a base "skeleton" template that contains all the common +elements of your site and defines **blocks** that child templates can +override. + +Sounds complicated but is very basic. It's easier to understand it by +starting with an example. + +Let's define a base template, ``base.html``, which defines a simple HTML +skeleton document that you might use for a simple two-column page: + +.. code-block:: html+jinja + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
    {% block content %}{% endblock %}
    + + + + +In this example, the :doc:`block` tags define four blocks that +child templates can fill in. All the ``block`` tag does is to tell the +template engine that a child template may override those portions of the +template. + +A child template might look like this: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

    Index

    +

    + Welcome on my awesome homepage. +

    + {% endblock %} + +The :doc:`extends` tag is the key here. It tells the template +engine that this template "extends" another template. When the template system +evaluates this template, first it locates the parent. The extends tag should +be the first tag in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +It's possible to render the contents of the parent block by using the +:doc:`parent` function. This gives back the results of the +parent block: + +.. code-block:: jinja + + {% block sidebar %} +

    Table Of Contents

    + ... + {{ parent() }} + {% endblock %} + +.. tip:: + + The documentation page for the :doc:`extends` tag describes + more advanced features like block nesting, scope, dynamic inheritance, and + conditional inheritance. + +.. note:: + + Twig also supports multiple inheritance with the so called horizontal reuse + with the help of the :doc:`use` tag. This is an advanced feature + hardly ever needed in regular templates. + +HTML Escaping +------------- + +When generating HTML from templates, there's always a risk that a variable +will include characters that affect the resulting HTML. There are two +approaches: manually escaping each variable or automatically escaping +everything by default. + +Twig supports both, automatic escaping is enabled by default. + +.. note:: + + Automatic escaping is only supported if the *escaper* extension has been + enabled (which is the default). + +Working with Manual Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If manual escaping is enabled it's **your** responsibility to escape variables +if needed. What to escape? If you have a variable that *may* include any of +the following chars (``>``, ``<``, ``&``, or ``"``) you **have to** escape it +unless the variable contains well-formed and trusted HTML. Escaping works by +piping the variable through the :doc:`escape` or ``e`` filter: + +.. code-block:: jinja + + {{ user.username|e }} + {{ user.username|e('js') }} + +Working with Automatic Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the :doc:`autoescape` +tag: + +.. code-block:: jinja + + {% autoescape true %} + Everything will be automatically escaped in this block + {% endautoescape %} + +Escaping +-------- + +It is sometimes desirable or even necessary to have Twig ignore parts it would +otherwise handle as variables or blocks. For example if the default syntax is +used and you want to use ``{{`` as raw string in the template and not start a +variable you have to use a trick. + +The easiest way is to output the variable delimiter (``{{``) by using a variable +expression: + +.. code-block:: jinja + + {{ '{{' }} + +For bigger sections it makes sense to mark a block :doc:`raw`. + +Macros +------ + +Macros are comparable with functions in regular programming languages. They +are useful to reuse often used HTML fragments to not repeat yourself. + +A macro is defined via the :doc:`macro` tag. Here is a small example +(subsequently called ``forms.html``) of a macro that renders a form element: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros can be defined in any template, and need to be "imported" via the +:doc:`import` tag before being used: + +.. code-block:: jinja + + {% import "forms.html" as forms %} + +

    {{ forms.input('username') }}

    + +Alternatively, you can import individual macro names from a template into the +current namespace via the :doc:`from` tag and optionally alias them: + +.. code-block:: jinja + + {% from 'forms.html' import input as input_field %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    + +Expressions +----------- + +Twig allows expressions everywhere. These work very similar to regular PHP and +even if you're not working with PHP you should feel comfortable with it. + +.. note:: + + The operator precedence is as follows, with the lowest-precedence + operators listed first: ``b-and``, ``b-xor``, ``b-or``, ``or``, ``and``, + ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, ``..``, ``+``, + ``-``, ``~``, ``*``, ``/``, ``//``, ``%``, ``is``, and ``**``. + +Literals +~~~~~~~~ + +.. versionadded:: 1.5 + Support for hash keys as names and expressions was added in Twig 1.5. + +The simplest form of expressions are literals. Literals are representations +for PHP types such as strings, numbers, and arrays. The following literals +exist: + +* ``"Hello World"``: Everything between two double or single quotes is a + string. They are useful whenever you need a string in the template (for + example as arguments to function calls, filters or just to extend or + include a template). + +* ``42`` / ``42.23``: Integers and floating point numbers are created by just + writing the number down. If a dot is present the number is a float, + otherwise an integer. + +* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions + separated by a comma (``,``) and wrapped with squared brackets (``[]``). + +* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values + separated by a comma (``,``) and wrapped with curly braces (``{}``): + + .. code-block:: jinja + + {# keys as string #} + { 'foo': 'foo', 'bar': 'bar' } + + {# keys as names (equivalent to the previous hash) -- as of Twig 1.5 #} + { foo: 'foo', bar: 'bar' } + + {# keys as integer #} + { 2: 'foo', 4: 'bar' } + + {# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #} + { (1 + 1): 'foo', (a ~ 'b'): 'bar' } + +* ``true`` / ``false``: ``true`` represents the true value, ``false`` + represents the false value. + +* ``null``: ``null`` represents no specific value. This is the value returned + when a variable does not exist. ``none`` is an alias for ``null``. + +Arrays and hashes can be nested: + +.. code-block:: jinja + + {% set foo = [1, {"foo": "bar"}] %} + +Math +~~~~ + +Twig allows you to calculate with values. This is rarely useful in templates +but exists for completeness' sake. The following operators are supported: + +* ``+``: Adds two objects together (the operands are casted to numbers). ``{{ + 1 + 1 }}`` is ``2``. + +* ``-``: Substracts the second number from the first one. ``{{ 3 - 2 }}`` is + ``1``. + +* ``/``: Divides two numbers. The returned value will be a floating point + number. ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``. + +* ``%``: Calculates the remainder of an integer division. ``{{ 11 % 7 }}`` is + ``4``. + +* ``//``: Divides two numbers and returns the truncated integer result. ``{{ + 20 // 7 }}`` is ``2``. + +* ``*``: Multiplies the left operand with the right one. ``{{ 2 * 2 }}`` would + return ``4``. + +* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** + 3 }}`` would return ``8``. + +Logic +~~~~~ + +You can combine multiple expressions with the following operators: + +* ``and``: Returns true if the left and the right operands are both true. + +* ``or``: Returns true if the left or the right operand is true. + +* ``not``: Negates a statement. + +* ``(expr)``: Groups an expression. + +.. note:: + + Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``). + +Comparisons +~~~~~~~~~~~ + +The following comparison operators are supported in any expression: ``==``, +``!=``, ``<``, ``>``, ``>=``, and ``<=``. + +Containment Operator +~~~~~~~~~~~~~~~~~~~~ + +The ``in`` operator performs containment test. + +It returns ``true`` if the left operand is contained in the right: + +.. code-block:: jinja + + {# returns true #} + + {{ 1 in [1, 2, 3] }} + + {{ 'cd' in 'abcde' }} + +.. tip:: + + You can use this filter to perform a containment test on strings, arrays, + or objects implementing the ``Traversable`` interface. + +To perform a negative test, use the ``not in`` operator: + +.. code-block:: jinja + + {% if 1 not in [1, 2, 3] %} + + {# is equivalent to #} + {% if not (1 in [1, 2, 3]) %} + +Test Operator +~~~~~~~~~~~~~ + +The ``is`` operator performs tests. Tests can be used to test a variable against +a common expression. The right operand is name of the test: + +.. code-block:: jinja + + {# find out if a variable is odd #} + + {{ name is odd }} + +Tests can accept arguments too: + +.. code-block:: jinja + + {% if loop.index is divisibleby(3) %} + +Tests can be negated by using the ``is not`` operator: + +.. code-block:: jinja + + {% if loop.index is not divisibleby(3) %} + + {# is equivalent to #} + {% if not (loop.index is divisibleby(3)) %} + +Go to the :doc:`tests` page to learn more about the built-in +tests. + +Other Operators +~~~~~~~~~~~~~~~ + +The following operators are very useful but don't fit into any of the other +categories: + +* ``..``: Creates a sequence based on the operand before and after the + operator (this is just syntactic sugar for the :doc:`range` + function). + +* ``|``: Applies a filter. + +* ``~``: Converts all operands into strings and concatenates them. ``{{ "Hello + " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello + John!``. + +* ``.``, ``[]``: Gets an attribute of an object. + +* ``?:``: The PHP ternary operator: ``{{ foo ? 'yes' : 'no' }}`` + +String Interpolation +~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + String interpolation was added in Twig 1.5. + +String interpolation (`#{expression}`) allows any valid expression to appear +within a string. The result of evaluating that expression is inserted into the +string: + +.. code-block:: jinja + + {{ "foo #{bar} baz" }} + {{ "foo #{1 + 2} baz" }} + +Whitespace Control +------------------ + +.. versionadded:: 1.1 + Tag level whitespace control was added in Twig 1.1. + +The first newline after a template tag is removed automatically (like in PHP.) +Whitespace is not further modified by the template engine, so each whitespace +(spaces, tabs, newlines etc.) is returned unchanged. + +Use the ``spaceless`` tag to remove whitespace *between HTML tags*: + +.. code-block:: jinja + + {% spaceless %} +
    + foo +
    + {% endspaceless %} + + {# output will be
    foo
    #} + +In addition to the spaceless tag you can also control whitespace on a per tag +level. By using the whitespace control modifier on your tags, you can trim +leading and or trailing whitespace: + +.. code-block:: jinja + + {% set value = 'no spaces' %} + {#- No leading/trailing whitespace -#} + {%- if true -%} + {{- value -}} + {%- endif -%} + + {# output 'no spaces' #} + +The above sample shows the default whitespace control modifier, and how you can +use it to remove whitespace around tags. Trimming space will consume all whitespace +for that side of the tag. It is possible to use whitespace trimming on one side +of a tag: + +.. code-block:: jinja + + {% set value = 'no spaces' %} +
  • {{- value }}
  • + + {# outputs '
  • no spaces
  • ' #} + +Extensions +---------- + +Twig can be easily extended. + +If you are looking for new tags, filters, or functions, have a look at the Twig official +`extension repository`_. + +If you want to create your own, read the :ref:`Creating an +Extension` chapter. + +.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle +.. _`Jinja syntax plugin`: http://jinja.pocoo.org/2/documentation/integration +.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig +.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin +.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language +.. _`extension repository`: http://github.com/fabpot/Twig-extensions +.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode +.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode diff --git a/core/vendor/twig/twig/doc/tests/constant.rst b/core/vendor/twig/twig/doc/tests/constant.rst new file mode 100644 index 0000000..7970933 --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/constant.rst @@ -0,0 +1,11 @@ +``constant`` +============ + +``constant`` checks if a variable has the exact same value as a constant. You +can use either global constants or class constants: + +.. code-block:: jinja + + {% if post.status is constant('Post::PUBLISHED') %} + the status attribute is exactly the same as Post::PUBLISHED + {% endif %} diff --git a/core/modules/book/book-node-export-html.tpl.php b/core/vendor/twig/twig/doc/tests/defined.rst similarity index 8% copy from core/modules/book/book-node-export-html.tpl.php copy to core/vendor/twig/twig/doc/tests/defined.rst index 50c878f..702ce72 100644 --- a/core/modules/book/book-node-export-html.tpl.php +++ b/core/vendor/twig/twig/doc/tests/defined.rst @@ -1,25 +1,30 @@ - -
    -

    - - -
    +``defined`` +=========== + +``defined`` checks if a variable is defined in the current context. This is very +useful if you use the ``strict_variables`` option: + +.. code-block:: jinja + + {# defined works with variable names #} + {% if foo is defined %} + ... + {% endif %} + + {# and attributes on variables names #} + {% if foo.bar is defined %} + ... + {% endif %} + + {% if foo['bar'] is defined %} + ... + {% endif %} + +When using the ``defined`` test on an expression that uses variables in some +method calls, be sure that they are all defined first: + +.. code-block:: jinja + + {% if var is defined and foo.method(var) is defined %} + ... + {% endif %} diff --git a/core/vendor/twig/twig/doc/tests/divisibleby.rst b/core/vendor/twig/twig/doc/tests/divisibleby.rst new file mode 100644 index 0000000..9b0b964 --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/divisibleby.rst @@ -0,0 +1,10 @@ +``divisibleby`` +=============== + +``divisibleby`` checks if a variable is divisible by a number: + +.. code-block:: jinja + + {% if loop.index is divisibleby(3) %} + ... + {% endif %} diff --git a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md b/core/vendor/twig/twig/doc/tests/empty.rst similarity index 5% rename from core/vendor/Symfony/Component/Yaml/CHANGELOG.md rename to core/vendor/twig/twig/doc/tests/empty.rst index 096cf65..0d1eb32 100644 --- a/core/vendor/Symfony/Component/Yaml/CHANGELOG.md +++ b/core/vendor/twig/twig/doc/tests/empty.rst @@ -1,8 +1,11 @@ -CHANGELOG +``empty`` ========= -2.1.0 ------ +``empty`` checks if a variable is empty: - * Yaml::parse() does not evaluate loaded files as PHP files by default - anymore (call Yaml::enablePhpParsing() to get back the old behavior) +.. code-block:: jinja + + {# evaluates to true if the foo variable is null, false, or the empty string #} + {% if foo is empty %} + ... + {% endif %} diff --git a/core/vendor/twig/twig/doc/tests/even.rst b/core/vendor/twig/twig/doc/tests/even.rst new file mode 100644 index 0000000..6ab5cc3 --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/even.rst @@ -0,0 +1,10 @@ +``even`` +======== + +``even`` returns ``true`` if the given number is even: + +.. code-block:: jinja + + {{ var is even }} + +.. seealso:: :doc:`odd<../tests/odd>` diff --git a/core/vendor/twig/twig/doc/tests/index.rst b/core/vendor/twig/twig/doc/tests/index.rst new file mode 100644 index 0000000..7b8c535 --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/index.rst @@ -0,0 +1,15 @@ +Tests +===== + +.. toctree:: + :maxdepth: 1 + + divisibleby + null + even + odd + sameas + constant + defined + empty + iterable diff --git a/core/vendor/twig/twig/doc/tests/iterable.rst b/core/vendor/twig/twig/doc/tests/iterable.rst new file mode 100644 index 0000000..89a172f --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/iterable.rst @@ -0,0 +1,19 @@ +``iterable`` +============ + +.. versionadded:: 1.7 + The iterable test was added in Twig 1.7. + +``iterable`` checks if a variable is an array or a traversable object: + +.. code-block:: jinja + + {# evaluates to true if the foo variable is iterable #} + {% if users is iterable %} + {% for user in users %} + Hello {{ user }}! + {% endfor %} + {% else %} + {# users is probably a string #} + Hello {{ users }}! + {% endif %} diff --git a/core/vendor/twig/twig/doc/tests/null.rst b/core/vendor/twig/twig/doc/tests/null.rst new file mode 100644 index 0000000..44eec62 --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/null.rst @@ -0,0 +1,12 @@ +``null`` +======== + +``null`` returns ``true`` if the variable is ``null``: + +.. code-block:: jinja + + {{ var is null }} + +.. note:: + + ``none`` is an alias for ``null``. diff --git a/core/vendor/twig/twig/doc/tests/odd.rst b/core/vendor/twig/twig/doc/tests/odd.rst new file mode 100644 index 0000000..9eece77 --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/odd.rst @@ -0,0 +1,10 @@ +``odd`` +======= + +``odd`` returns ``true`` if the given number is odd: + +.. code-block:: jinja + + {{ var is odd }} + +.. seealso:: :doc:`even<../tests/even>` diff --git a/core/vendor/twig/twig/doc/tests/sameas.rst b/core/vendor/twig/twig/doc/tests/sameas.rst new file mode 100644 index 0000000..efb15c3 --- /dev/null +++ b/core/vendor/twig/twig/doc/tests/sameas.rst @@ -0,0 +1,11 @@ +``sameas`` +========== + +``sameas`` checks if a variable points to the same memory address than another +variable: + +.. code-block:: jinja + + {% if foo.attribute is sameas(false) %} + the foo attribute really is the ``false`` PHP value + {% endif %} diff --git a/core/vendor/twig/twig/ext/twig/.gitignore b/core/vendor/twig/twig/ext/twig/.gitignore new file mode 100644 index 0000000..56ea76c --- /dev/null +++ b/core/vendor/twig/twig/ext/twig/.gitignore @@ -0,0 +1,30 @@ +*.sw* +.deps +Makefile +Makefile.fragments +Makefile.global +Makefile.objects +acinclude.m4 +aclocal.m4 +build/ +config.cache +config.guess +config.h +config.h.in +config.log +config.nice +config.status +config.sub +configure +configure.in +install-sh +libtool +ltmain.sh +missing +mkinstalldirs +run-tests.php +twig.loT +.libs/ +modules/ +twig.la +twig.lo diff --git a/core/vendor/Twig/LICENSE b/core/vendor/twig/twig/ext/twig/LICENSE similarity index 25% rename from core/vendor/Twig/LICENSE rename to core/vendor/twig/twig/ext/twig/LICENSE index 5063d8d..66b8bb4 100644 --- a/core/vendor/Twig/LICENSE +++ b/core/vendor/twig/twig/ext/twig/LICENSE @@ -1,31 +1,22 @@ -Copyright (c) 2009 by the Twig Team, see AUTHORS for more details. +Copyright (c) 2011, Derick Rethans +All rights reserved. -Some rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. - - * The names of the contributors may not be used to endorse or - promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/core/vendor/twig/twig/ext/twig/config.m4 b/core/vendor/twig/twig/ext/twig/config.m4 new file mode 100644 index 0000000..83486be --- /dev/null +++ b/core/vendor/twig/twig/ext/twig/config.m4 @@ -0,0 +1,8 @@ +dnl config.m4 for extension twig + +PHP_ARG_ENABLE(twig, whether to enable twig support, +[ --enable-twig Enable twig support]) + +if test "$PHP_TWIG" != "no"; then + PHP_NEW_EXTENSION(twig, twig.c, $ext_shared) +fi diff --git a/core/vendor/twig/twig/ext/twig/config.w32 b/core/vendor/twig/twig/ext/twig/config.w32 new file mode 100644 index 0000000..cb287b9 --- /dev/null +++ b/core/vendor/twig/twig/ext/twig/config.w32 @@ -0,0 +1,8 @@ +// vim:ft=javascript + +ARG_ENABLE("twig", "Twig support", "no"); + +if (PHP_TWIG != "no") { + AC_DEFINE('HAVE_TWIG', 1); + EXTENSION('twig', 'twig.c'); +} diff --git a/core/vendor/twig/twig/ext/twig/php_twig.h b/core/vendor/twig/twig/ext/twig/php_twig.h new file mode 100644 index 0000000..f0f25e4 --- /dev/null +++ b/core/vendor/twig/twig/ext/twig/php_twig.h @@ -0,0 +1,49 @@ +/* + +----------------------------------------------------------------------+ + | Twig Extension | + +----------------------------------------------------------------------+ + | Copyright (c) 2011 Derick Rethans | + +----------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met (BSD, revised). | + +----------------------------------------------------------------------+ + | Author: Derick Rethans | + +----------------------------------------------------------------------+ + */ + +#ifndef PHP_TWIG_H +#define PHP_TWIG_H + +#define PHP_TWIG_VERSION "1.8.4-DEV" + +#include "php.h" + +extern zend_module_entry twig_module_entry; +#define phpext_twig_ptr &twig_module_entry + +#ifdef PHP_WIN32 +#define PHP_TWIG_API __declspec(dllexport) +#else +#define PHP_TWIG_API +#endif + +#ifdef ZTS +#include "TSRM.h" +#endif + +PHP_FUNCTION(twig_template_get_attributes); + +PHP_MINIT_FUNCTION(twig); +PHP_MSHUTDOWN_FUNCTION(twig); +PHP_RINIT_FUNCTION(twig); +PHP_RSHUTDOWN_FUNCTION(twig); +PHP_MINFO_FUNCTION(twig); + +#ifdef ZTS +#define TWIG_G(v) TSRMG(twig_globals_id, zend_twig_globals *, v) +#else +#define TWIG_G(v) (twig_globals.v) +#endif + +#endif diff --git a/core/vendor/twig/twig/ext/twig/twig.c b/core/vendor/twig/twig/ext/twig/twig.c new file mode 100644 index 0000000..880b964 --- /dev/null +++ b/core/vendor/twig/twig/ext/twig/twig.c @@ -0,0 +1,1025 @@ +/* + +----------------------------------------------------------------------+ + | Twig Extension | + +----------------------------------------------------------------------+ + | Copyright (c) 2011 Derick Rethans | + +----------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted provided that the conditions mentioned | + | in the accompanying LICENSE file are met (BSD, revised). | + +----------------------------------------------------------------------+ + | Author: Derick Rethans | + +----------------------------------------------------------------------+ + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php.h" +#include "php_ini.h" +#include "ext/standard/info.h" +#include "php_twig.h" +#include "ext/standard/php_string.h" +#include "ext/standard/php_smart_str.h" + +#include "Zend/zend_object_handlers.h" +#include "Zend/zend_interfaces.h" +#include "Zend/zend_exceptions.h" + +#ifndef Z_ADDREF_P +#define Z_ADDREF_P(pz) (pz)->refcount++ +#endif + +ZEND_BEGIN_ARG_INFO_EX(twig_template_get_attribute_args, ZEND_SEND_BY_VAL, ZEND_RETURN_VALUE, 6) + ZEND_ARG_INFO(0, template) + ZEND_ARG_INFO(0, object) + ZEND_ARG_INFO(0, item) + ZEND_ARG_INFO(0, arguments) + ZEND_ARG_INFO(0, type) + ZEND_ARG_INFO(0, isDefinedTest) +ZEND_END_ARG_INFO() + +zend_function_entry twig_functions[] = { + PHP_FE(twig_template_get_attributes, twig_template_get_attribute_args) + {NULL, NULL, NULL} +}; + + +zend_module_entry twig_module_entry = { +#if ZEND_MODULE_API_NO >= 20010901 + STANDARD_MODULE_HEADER, +#endif + "twig", + twig_functions, + PHP_MINIT(twig), + PHP_MSHUTDOWN(twig), + PHP_RINIT(twig), + PHP_RSHUTDOWN(twig), + PHP_MINFO(twig), +#if ZEND_MODULE_API_NO >= 20010901 + PHP_TWIG_VERSION, +#endif + STANDARD_MODULE_PROPERTIES +}; + + +#ifdef COMPILE_DL_TWIG +ZEND_GET_MODULE(twig) +#endif + +PHP_INI_BEGIN() +PHP_INI_END() + +PHP_MINIT_FUNCTION(twig) +{ + REGISTER_INI_ENTRIES(); + + return SUCCESS; +} + + +PHP_MSHUTDOWN_FUNCTION(twig) +{ + UNREGISTER_INI_ENTRIES(); + + return SUCCESS; +} + + + +PHP_RINIT_FUNCTION(twig) +{ + return SUCCESS; +} + + + +PHP_RSHUTDOWN_FUNCTION(twig) +{ + return SUCCESS; +} + + +PHP_MINFO_FUNCTION(twig) +{ + php_info_print_table_start(); + php_info_print_table_header(2, "Twig support", "enabled"); + php_info_print_table_row(2, "Version", PHP_TWIG_VERSION); + php_info_print_table_end(); + + DISPLAY_INI_ENTRIES(); + +} + +int TWIG_ARRAY_KEY_EXISTS(zval *array, char* key, int key_len) +{ + if (Z_TYPE_P(array) != IS_ARRAY) { + return 0; + } + return zend_symtable_exists(Z_ARRVAL_P(array), key, key_len + 1); +} + +int TWIG_INSTANCE_OF(zval *object, zend_class_entry *interface TSRMLS_DC) +{ + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), interface TSRMLS_CC); +} + +int TWIG_INSTANCE_OF_USERLAND(zval *object, char *interface TSRMLS_DC) +{ + zend_class_entry **pce; + if (Z_TYPE_P(object) != IS_OBJECT) { + return 0; + } + if (zend_lookup_class(interface, strlen(interface), &pce TSRMLS_CC) == FAILURE) { + return 0; + } + return instanceof_function(Z_OBJCE_P(object), *pce TSRMLS_CC); +} + +zval *TWIG_GET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetget", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name); + } + return NULL; + } + + return retval; + } + return NULL; +} + +int TWIG_ISSET_ARRAYOBJECT_ELEMENT(zval *object, zval *offset TSRMLS_DC) +{ + zend_class_entry *ce = Z_OBJCE_P(object); + zval *retval; + + if (Z_TYPE_P(object) == IS_OBJECT) { + SEPARATE_ARG_IF_REF(offset); + zend_call_method_with_1_params(&object, ce, NULL, "offsetexists", &retval, offset); + + zval_ptr_dtor(&offset); + + if (!retval) { + if (!EG(exception)) { + zend_error(E_ERROR, "Undefined offset for object of type %s used as array", ce->name); + } + return 0; + } + + return (retval && Z_TYPE_P(retval) == IS_BOOL && Z_LVAL_P(retval)); + } + return 0; +} + +char *TWIG_STRTOLOWER(const char *str, int str_len) +{ + char *item_dup; + + item_dup = estrndup(str, str_len); + php_strtolower(item_dup, str_len); + return item_dup; +} + +zval *TWIG_CALL_USER_FUNC_ARRAY(zval *object, char *function, zval *arguments TSRMLS_DC) +{ + zend_fcall_info fci; + zval ***args = NULL; + int arg_count = 0; + HashTable *table; + HashPosition pos; + int i = 0; + zval *retval_ptr; + zval *zfunction; + + if (arguments) { + table = HASH_OF(arguments); + args = safe_emalloc(sizeof(zval **), table->nNumOfElements, 0); + + zend_hash_internal_pointer_reset_ex(table, &pos); + + while (zend_hash_get_current_data_ex(table, (void **)&args[i], &pos) == SUCCESS) { + i++; + zend_hash_move_forward_ex(table, &pos); + } + arg_count = table->nNumOfElements; + } + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, function, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = arg_count; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + zval_dtor(zfunction); + efree(zfunction); + zend_throw_exception_ex(zend_exception_get_default(TSRMLS_C), 0 TSRMLS_CC, "Could not execute %s::%s()", zend_get_class_entry(object TSRMLS_CC)->name, function TSRMLS_CC); + } + + if (args) { + efree(fci.params); + } + zval_dtor(zfunction); + efree(zfunction); + return retval_ptr; +} + +int TWIG_CALL_BOOLEAN(zval *object, char *functionName TSRMLS_DC) +{ + zval *ret; + int res; + + ret = TWIG_CALL_USER_FUNC_ARRAY(object, functionName, NULL TSRMLS_CC); + res = Z_LVAL_P(ret); + zval_ptr_dtor(&ret); + return res; +} + +zval *TWIG_GET_STATIC_PROPERTY(zval *class, char *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + zend_class_entry *ce; + + if (class == NULL || Z_TYPE_P(class) != IS_OBJECT) { + return NULL; + } + + ce = zend_get_class_entry(class TSRMLS_CC); +#if PHP_VERSION_ID >= 50400 + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0, NULL TSRMLS_CC); +#else + tmp_zval = zend_std_get_static_property(ce, prop_name, strlen(prop_name), 0 TSRMLS_CC); +#endif + return *tmp_zval; +} + +zval *TWIG_GET_ARRAY_ELEMENT_ZVAL(zval *class, zval *prop_name TSRMLS_DC) +{ + zval **tmp_zval; + char *tmp_name; + + if (class == NULL || Z_TYPE_P(class) != IS_ARRAY || Z_TYPE_P(prop_name) != IS_STRING) { + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + return TWIG_GET_ARRAYOBJECT_ELEMENT(class, prop_name TSRMLS_CC); + } + return NULL; + } + + convert_to_string(prop_name); + tmp_name = Z_STRVAL_P(prop_name); + if (zend_symtable_find(HASH_OF(class), tmp_name, strlen(tmp_name)+1, (void**) &tmp_zval) == SUCCESS) { + return *tmp_zval; + } + return NULL; +} + +zval *TWIG_GET_ARRAY_ELEMENT(zval *class, char *prop_name, int prop_name_length TSRMLS_DC) +{ + zval **tmp_zval; + + if (class == NULL/* || Z_TYPE_P(class) != IS_ARRAY*/) { + return NULL; + } + + if (class != NULL && Z_TYPE_P(class) == IS_OBJECT && TWIG_INSTANCE_OF(class, zend_ce_arrayaccess TSRMLS_CC)) { + // array access object + zval *tmp_name_zval; + zval *tmp_ret_zval; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, prop_name, 1); + tmp_ret_zval = TWIG_GET_ARRAYOBJECT_ELEMENT(class, tmp_name_zval TSRMLS_CC); + zval_dtor(tmp_name_zval); + efree(tmp_name_zval); + return tmp_ret_zval; + } + + if (zend_symtable_find(HASH_OF(class), prop_name, prop_name_length+1, (void**)&tmp_zval) == SUCCESS) { + return *tmp_zval; + } + return NULL; +} + +zval *TWIG_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + char *prot_name; + int prot_name_length; + zval *tmp = NULL; + + tmp = TWIG_GET_ARRAY_ELEMENT(object, Z_STRVAL_P(propname), Z_STRLEN_P(propname) TSRMLS_CC); + if (tmp) { + return tmp; + } + + zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, Z_STRVAL_P(propname), Z_STRLEN_P(propname), 0); + tmp = TWIG_GET_ARRAY_ELEMENT(object, prot_name, prot_name_length TSRMLS_CC); + efree(prot_name); + if (tmp) { + return tmp; + } + + if (Z_OBJ_HT_P(object)->read_property) { +#if PHP_VERSION_ID >= 50400 + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS, NULL TSRMLS_CC); +#else + tmp = Z_OBJ_HT_P(object)->read_property(object, propname, BP_VAR_IS TSRMLS_CC); +#endif + if (tmp != EG(uninitialized_zval_ptr)) { + return tmp; + } else { + return NULL; + } + } + return tmp; +} + +int TWIG_HAS_PROPERTY(zval *object, zval *propname TSRMLS_DC) +{ + if (Z_OBJ_HT_P(object)->has_property) { +#if PHP_VERSION_ID >= 50400 + return Z_OBJ_HT_P(object)->has_property(object, propname, 0, NULL TSRMLS_CC); +#else + return Z_OBJ_HT_P(object)->has_property(object, propname, 0 TSRMLS_CC); +#endif + } + return 0; +} + +zval *TWIG_PROPERTY_CHAR(zval *object, char *propname TSRMLS_DC) +{ + zval *tmp_name_zval, *tmp; + + ALLOC_INIT_ZVAL(tmp_name_zval); + ZVAL_STRING(tmp_name_zval, propname, 1); + tmp = TWIG_PROPERTY(object, tmp_name_zval TSRMLS_CC); + zval_dtor(tmp_name_zval); + efree(tmp_name_zval); + return tmp; +} + +int TWIG_CALL_B_0(zval *object, char *method) +{ + return 0; +} + +zval *TWIG_CALL_S(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[1]; + zval *argument; + zval *zfunction; + zval *retval_ptr; + + MAKE_STD_ZVAL(argument); + ZVAL_STRING(argument, arg0, 1); + args[0] = &argument; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 1; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + zval_dtor(argument); + return 0; + } + zval_dtor(zfunction); + efree(zfunction); + zval_dtor(argument); + efree(argument); + return retval_ptr; +} + +int TWIG_CALL_SB(zval *object, char *method, char *arg0 TSRMLS_DC) +{ + zval *retval_ptr; + int success; + + retval_ptr = TWIG_CALL_S(object, method, arg0 TSRMLS_CC); + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +int TWIG_CALL_Z(zval *object, char *method, zval *arg1 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[1]; + zval *zfunction; + zval *retval_ptr; + int success; + + args[0] = &arg1; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 1; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + zval_dtor(zfunction); + efree(zfunction); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + return 0; + } + + zval_dtor(zfunction); + efree(zfunction); + + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +int TWIG_CALL_ZZ(zval *object, char *method, zval *arg1, zval *arg2 TSRMLS_DC) +{ + zend_fcall_info fci; + zval **args[2]; + zval *zfunction; + zval *retval_ptr; + int success; + + args[0] = &arg1; + args[1] = &arg2; + + MAKE_STD_ZVAL(zfunction); + ZVAL_STRING(zfunction, method, 1); + fci.size = sizeof(fci); + fci.function_table = EG(function_table); + fci.function_name = zfunction; + fci.symbol_table = NULL; +#if PHP_VERSION_ID >= 50300 + fci.object_ptr = object; +#else + fci.object_pp = &object; +#endif + fci.retval_ptr_ptr = &retval_ptr; + fci.param_count = 2; + fci.params = args; + fci.no_separation = 0; + + if (zend_call_function(&fci, NULL TSRMLS_CC) == FAILURE) { + zval_dtor(zfunction); + return 0; + } + + zval_dtor(zfunction); + + success = (retval_ptr && (Z_TYPE_P(retval_ptr) == IS_BOOL) && Z_LVAL_P(retval_ptr)); + if (retval_ptr) { + zval_ptr_dtor(&retval_ptr); + } + + return success; +} + +#ifndef Z_SET_REFCOUNT_P +# define Z_SET_REFCOUNT_P(pz, rc) pz->refcount = rc +# define Z_UNSET_ISREF_P(pz) pz->is_ref = 0 +#endif + +void TWIG_NEW(zval *object, char *class, zval *arg0, zval *arg1 TSRMLS_DC) +{ + zend_class_entry **pce; + + if (zend_lookup_class(class, strlen(class), &pce TSRMLS_CC) == FAILURE) { + return; + } + + Z_TYPE_P(object) = IS_OBJECT; + object_init_ex(object, *pce); + Z_SET_REFCOUNT_P(object, 1); + Z_UNSET_ISREF_P(object); + + TWIG_CALL_ZZ(object, "__construct", arg0, arg1 TSRMLS_CC); +} + +static int twig_add_array_key_to_string(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + smart_str *buf; + char *joiner; + + buf = va_arg(args, smart_str*); + joiner = va_arg(args, char*); + + if (buf->len != 0) { + smart_str_appends(buf, joiner); + } + + if (hash_key->nKeyLength == 0) { + smart_str_append_long(buf, (long) hash_key->h); + } else { + char *key, *tmp_str; + int key_len, tmp_len; + key = php_addcslashes(hash_key->arKey, hash_key->nKeyLength - 1, &key_len, 0, "'\\", 2 TSRMLS_CC); + tmp_str = php_str_to_str_ex(key, key_len, "\0", 1, "' . \"\\0\" . '", 12, &tmp_len, 0, NULL); + + smart_str_appendl(buf, tmp_str, tmp_len); + efree(key); + efree(tmp_str); + } + + return 0; +} + +char *TWIG_IMPLODE_ARRAY_KEYS(char *joiner, zval *array TSRMLS_DC) +{ + smart_str collector = { 0, 0, 0 }; + + smart_str_appendl(&collector, "", 0); + zend_hash_apply_with_arguments(HASH_OF(array) TSRMLS_CC, twig_add_array_key_to_string, 2, &collector, joiner); + smart_str_0(&collector); + + return collector.c; +} + +static void TWIG_THROW_EXCEPTION(char *exception_name TSRMLS_DC, char *message, ...) +{ + char *buffer; + va_list args; + zend_class_entry **pce; + + if (zend_lookup_class(exception_name, strlen(exception_name), &pce TSRMLS_CC) == FAILURE) + { + return; + } + + va_start(args, message); + vspprintf(&buffer, 0, message, args); + va_end(args); + + zend_throw_exception_ex(*pce, 0 TSRMLS_CC, buffer); +} + +char *TWIG_GET_CLASS_NAME(zval *object TSRMLS_DC) +{ + char *class_name; + zend_uint class_name_len; + + if (Z_TYPE_P(object) != IS_OBJECT) { + return ""; + } + zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC); + return class_name; +} + +static int twig_add_method_to_class(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zval *retval; + char *item; + size_t item_len; + zend_function *mptr = (zend_function *) pDest; + + if (!(mptr->common.fn_flags & ZEND_ACC_PUBLIC)) { + return 0; + } + + retval = va_arg(args, zval*); + + item_len = strlen(mptr->common.function_name); + item = estrndup(mptr->common.function_name, item_len); + php_strtolower(item, item_len); + + add_assoc_stringl_ex(retval, item, item_len+1, item, item_len, 0); + + return 0; +} + +static int twig_add_property_to_class(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce; + zval *retval; + char *class_name, *prop_name; + zend_property_info *pptr = (zend_property_info *) pDest; + + if (!(pptr->flags & ZEND_ACC_PUBLIC)) { + return 0; + } + + ce = *va_arg(args, zend_class_entry**); + retval = va_arg(args, zval*); + + zend_unmangle_property_name(pptr->name, pptr->name_length, &class_name, &prop_name); + + add_assoc_string(retval, prop_name, prop_name, 1); + + return 0; +} + +/* {{{ _adddynproperty */ +static int twig_add_dyn_property_to_class(void *pDest TSRMLS_DC, int num_args, va_list args, zend_hash_key *hash_key) +{ + zend_class_entry *ce = *va_arg(args, zend_class_entry**); + zval *retval = va_arg(args, zval*), member; + char *class_name, *prop_name; + + if (hash_key->nKeyLength < 1 || hash_key->arKey[0] == '\0') { + return 0; /* non public cannot be dynamic */ + } + + ZVAL_STRINGL(&member, hash_key->arKey, hash_key->nKeyLength-1, 0); + if (zend_get_property_info(ce, &member, 1 TSRMLS_CC) == &EG(std_property_info)) { + zend_unmangle_property_name((&EG(std_property_info))->name, (&EG(std_property_info))->name_length, &class_name, &prop_name); + add_assoc_string(retval, prop_name, prop_name, 1); + } + return 0; +} + +static void twig_add_class_to_cache(zval *cache, zval *object, char *class_name TSRMLS_DC) +{ + zval *class_info, *class_methods, *class_properties; + zend_class_entry *class_ce; + + class_ce = zend_get_class_entry(object TSRMLS_CC); + + ALLOC_INIT_ZVAL(class_info); + ALLOC_INIT_ZVAL(class_methods); + ALLOC_INIT_ZVAL(class_properties); + array_init(class_info); + array_init(class_methods); + array_init(class_properties); + // add all methods to self::cache[$class]['methods'] + zend_hash_apply_with_arguments(&class_ce->function_table TSRMLS_CC, twig_add_method_to_class, 1, class_methods); + zend_hash_apply_with_arguments(&class_ce->properties_info TSRMLS_CC, twig_add_property_to_class, 2, &class_ce, class_properties); + + if (object && Z_OBJ_HT_P(object)->get_properties) { + HashTable *properties = Z_OBJ_HT_P(object)->get_properties(object TSRMLS_CC); + zend_hash_apply_with_arguments(properties TSRMLS_CC, twig_add_dyn_property_to_class, 2, &class_ce, class_properties); + } + add_assoc_zval(class_info, "methods", class_methods); + add_assoc_zval(class_info, "properties", class_properties); + add_assoc_zval(cache, class_name, class_info); +} + +/* {{{ proto mixed twig_template_get_attributes(TwigTemplate template, mixed object, mixed item, array arguments, string type, boolean isDefinedTest, boolean ignoreStrictCheck) + A C implementation of TwigTemplate::getAttribute() */ +PHP_FUNCTION(twig_template_get_attributes) +{ + zval *template; + zval *object; + char *item; + int item_len; + zval zitem; + zval *arguments = NULL; + zval *ret = NULL; + char *type = NULL; + int type_len = 0; + zend_bool isDefinedTest = 0; + zend_bool ignoreStrictCheck = 0; + int free_ret = 0; + zval *tmp_self_cache; + + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ozs|asbb", &template, &object, &item, &item_len, &arguments, &type, &type_len, &isDefinedTest, &ignoreStrictCheck) == FAILURE) { + return; + } + + INIT_PZVAL(&zitem); + ZVAL_STRINGL(&zitem, item, item_len, 0); + + if (!type) { + type = "any"; + } + +/* + // array + if (Twig_TemplateInterface::METHOD_CALL !== $type) { + if ((is_array($object) && array_key_exists($item, $object)) + || ($object instanceof ArrayAccess && isset($object[$item])) + ) { + if ($isDefinedTest) { + return true; + } + + return $object[$item]; + } +*/ + if (strcmp("method", type) != 0) { +// printf("XXXmethod: %s\n", type); + if ((TWIG_ARRAY_KEY_EXISTS(object, item, item_len)) + || (TWIG_INSTANCE_OF(object, zend_ce_arrayaccess TSRMLS_CC) && TWIG_ISSET_ARRAYOBJECT_ELEMENT(object, &zitem TSRMLS_CC)) + ) { + zval *ret; + + if (isDefinedTest) { + RETURN_TRUE; + } + + ret = TWIG_GET_ARRAY_ELEMENT(object, item, item_len TSRMLS_CC); + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + return; + } +/* + if (Twig_TemplateInterface::ARRAY_CALL === $type) { + if ($isDefinedTest) { + return false; + } + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } +*/ + if (strcmp("array", type) == 0) { + if (isDefinedTest) { + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + return; + } +/* + if (is_object($object)) { + throw new Twig_Error_Runtime(sprintf('Key "%s" in object (with ArrayAccess) of type "%s" does not exist', $item, get_class($object))); + // array + } else { + throw new Twig_Error_Runtime(sprintf('Key "%s" for array with keys "%s" does not exist', $item, implode(', ', array_keys($object)))); + } + } + } +*/ + if (Z_TYPE_P(object) == IS_OBJECT) { + TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Key \"%s\" in object (with ArrayAccess) of type \"%s\" does not exist", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + } else { + TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Key \"%s\" for array with keys \"%s\" does not exist", item, TWIG_IMPLODE_ARRAY_KEYS(", ", object TSRMLS_CC)); + } + return; + } + } + +/* + if (!is_object($object)) { + if ($isDefinedTest) { + return false; + } +*/ + + if (Z_TYPE_P(object) != IS_OBJECT) { + if (isDefinedTest) { + RETURN_FALSE; + } +/* + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + throw new Twig_Error_Runtime(sprintf('Item "%s" for "%s" does not exist', $item, implode(', ', array_keys($object)))); + } +*/ + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + RETURN_FALSE; + } + if (Z_TYPE_P(object) == IS_ARRAY) { + TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Item \"%s\" for \"Array\" does not exist", item); + } else { + Z_ADDREF_P(object); + convert_to_string_ex(&object); + TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Item \"%s\" for \"%s\" does not exist", item, Z_STRVAL_P(object)); + zval_ptr_dtor(&object); + } + return; + } +/* + // get some information about the object + $class = get_class($object); + if (!isset(self::$cache[$class])) { + $r = new ReflectionClass($class); + self::$cache[$class] = array('methods' => array(), 'properties' => array()); + foreach ($r->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { + self::$cache[$class]['methods'][strtolower($method->getName())] = true; + } + + foreach ($r->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { + self::$cache[$class]['properties'][$property->getName()] = true; + } + } +*/ + if (Z_TYPE_P(object) == IS_OBJECT) { + char *class_name = NULL; + + class_name = TWIG_GET_CLASS_NAME(object TSRMLS_CC); + tmp_self_cache = TWIG_GET_STATIC_PROPERTY(template, "cache" TSRMLS_CC); + + if (!TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC)) { + twig_add_class_to_cache(tmp_self_cache, object, class_name TSRMLS_CC); + } + efree(class_name); + } + +/* + // object property + if (Twig_TemplateInterface::METHOD_CALL !== $type) { + if (isset(self::$cache[$class]['properties'][$item]) + || isset($object->$item) || array_key_exists($item, $object) + ) { + if ($isDefinedTest) { + return true; + } + if ($this->env->hasExtension('sandbox')) { + $this->env->getExtension('sandbox')->checkPropertyAllowed($object, $item); + } + + return $object->$item; + } + } +*/ + if (strcmp("method", type) != 0) { + zval *tmp_class, *tmp_properties, *tmp_item; + char *class_name = NULL; + + class_name = TWIG_GET_CLASS_NAME(object TSRMLS_CC); + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + tmp_properties = TWIG_GET_ARRAY_ELEMENT(tmp_class, "properties", strlen("properties") TSRMLS_CC); + tmp_item = TWIG_GET_ARRAY_ELEMENT(tmp_properties, item, item_len TSRMLS_CC); + + efree(class_name); + + if (tmp_item || TWIG_HAS_PROPERTY(object, &zitem TSRMLS_CC) || TWIG_ARRAY_KEY_EXISTS(object, item, item_len) // FIXME: Array key? is that array access here? + ) { + if (isDefinedTest) { + RETURN_TRUE; + } + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "sandbox" TSRMLS_CC), "checkPropertyAllowed", object, &zitem TSRMLS_CC); + } + if (EG(exception)) { + return; + } + + ret = TWIG_PROPERTY(object, &zitem TSRMLS_CC); + RETURN_ZVAL(ret, 1, 0); + } + } +/* + // object method + $lcItem = strtolower($item); + if (isset(self::$cache[$class]['methods'][$lcItem])) { + $method = $item; + } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) { + $method = 'get'.$item; + } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) { + $method = 'is'.$item; + } elseif (isset(self::$cache[$class]['methods']['__call'])) { + $method = $item; +*/ + { + char *lcItem = TWIG_STRTOLOWER(item, item_len); + int lcItem_length; + char *method = NULL; + char *tmp_method_name_get; + char *tmp_method_name_is; + zval *tmp_class, *tmp_methods; + char *class_name = NULL; + + class_name = TWIG_GET_CLASS_NAME(object TSRMLS_CC); + lcItem_length = strlen(lcItem); + tmp_method_name_get = emalloc(4 + lcItem_length); + tmp_method_name_is = emalloc(3 + lcItem_length); + + sprintf(tmp_method_name_get, "get%s", lcItem); + sprintf(tmp_method_name_is, "is%s", lcItem); + + tmp_class = TWIG_GET_ARRAY_ELEMENT(tmp_self_cache, class_name, strlen(class_name) TSRMLS_CC); + tmp_methods = TWIG_GET_ARRAY_ELEMENT(tmp_class, "methods", strlen("methods") TSRMLS_CC); + efree(class_name); + + if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, lcItem, lcItem_length TSRMLS_CC)) { + method = item; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_get, lcItem_length + 3 TSRMLS_CC)) { + method = tmp_method_name_get; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, tmp_method_name_is, lcItem_length + 2 TSRMLS_CC)) { + method = tmp_method_name_is; + } else if (TWIG_GET_ARRAY_ELEMENT(tmp_methods, "__call", 6 TSRMLS_CC)) { + method = item; +/* + } else { + if ($isDefinedTest) { + return false; + } + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { + return null; + } + throw new Twig_Error_Runtime(sprintf('Method "%s" for object "%s" does not exist', $item, get_class($object))); + } + if ($isDefinedTest) { + return true; + } +*/ + } else { + if (isDefinedTest) { + RETURN_FALSE; + } + if (ignoreStrictCheck || !TWIG_CALL_BOOLEAN(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "isStrictVariables" TSRMLS_CC)) { + return; + } + TWIG_THROW_EXCEPTION("Twig_Error_Runtime" TSRMLS_CC, "Method \"%s\" for object \"%s\" does not exist", item, TWIG_GET_CLASS_NAME(object TSRMLS_CC)); + return; + } + if (isDefinedTest) { + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); + RETURN_TRUE; + } +/* + if ($this->env->hasExtension('sandbox')) { + $this->env->getExtension('sandbox')->checkMethodAllowed($object, $method); + } +*/ + if (TWIG_CALL_SB(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "hasExtension", "sandbox" TSRMLS_CC)) { + TWIG_CALL_ZZ(TWIG_CALL_S(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getExtension", "sandbox" TSRMLS_CC), "checkMethodAllowed", object, &zitem TSRMLS_CC); + } + if (EG(exception)) { + return; + } +/* + $ret = call_user_func_array(array($object, $method), $arguments); +*/ + if (Z_TYPE_P(object) == IS_OBJECT) { + ret = TWIG_CALL_USER_FUNC_ARRAY(object, method, arguments TSRMLS_CC); + free_ret = 1; + } + efree(tmp_method_name_get); + efree(tmp_method_name_is); + efree(lcItem); + } +/* + if ($object instanceof Twig_TemplateInterface) { + return new Twig_Markup($ret, $this->env->getCharset()); + } +*/ + if (TWIG_INSTANCE_OF_USERLAND(object, "Twig_TemplateInterface" TSRMLS_CC)) { + zval *charset = TWIG_CALL_USER_FUNC_ARRAY(TWIG_PROPERTY_CHAR(template, "env" TSRMLS_CC), "getCharset", NULL TSRMLS_CC); + TWIG_NEW(return_value, "Twig_Markup", ret, charset TSRMLS_CC); + zval_ptr_dtor(&charset); + if (ret) { + zval_ptr_dtor(&ret); + } + return; + } +/* + return $ret; +*/ + if (ret) { + RETVAL_ZVAL(ret, 1, 0); + if (free_ret) { + zval_ptr_dtor(&ret); + } + } +} diff --git a/core/vendor/Twig/Autoloader.php b/core/vendor/twig/twig/lib/Twig/Autoloader.php similarity index 93% copy from core/vendor/Twig/Autoloader.php copy to core/vendor/twig/twig/lib/Twig/Autoloader.php index 0f62884..59f28f7 100644 --- a/core/vendor/Twig/Autoloader.php +++ b/core/vendor/twig/twig/lib/Twig/Autoloader.php @@ -30,8 +30,6 @@ class Twig_Autoloader * Handles autoloading of classes. * * @param string $class A class name. - * - * @return boolean Returns true if the class has been loaded */ static public function autoload($class) { diff --git a/core/vendor/Twig/Compiler.php b/core/vendor/twig/twig/lib/Twig/Compiler.php similarity index 95% rename from core/vendor/Twig/Compiler.php rename to core/vendor/twig/twig/lib/Twig/Compiler.php index 5cd1b31..d03dfa0 100644 --- a/core/vendor/Twig/Compiler.php +++ b/core/vendor/twig/twig/lib/Twig/Compiler.php @@ -119,6 +119,11 @@ class Twig_Compiler implements Twig_CompilerInterface return $this; } + /** + * Appends an indentation to the current PHP code after compilation. + * + * @return Twig_Compiler The current compiler instance + */ public function addIndentation() { $this->source .= str_repeat(' ', $this->indentation * 4); @@ -239,12 +244,13 @@ class Twig_Compiler implements Twig_CompilerInterface */ public function outdent($step = 1) { - $this->indentation -= $step; - - if ($this->indentation < 0) { + // can't outdent by more steps that the current indentation level + if ($this->indentation < $step) { throw new Twig_Error('Unable to call outdent() as the indentation would become negative'); } + $this->indentation -= $step; + return $this; } } diff --git a/core/vendor/Twig/CompilerInterface.php b/core/vendor/twig/twig/lib/Twig/CompilerInterface.php similarity index 100% copy from core/vendor/Twig/CompilerInterface.php copy to core/vendor/twig/twig/lib/Twig/CompilerInterface.php diff --git a/core/vendor/Twig/Environment.php b/core/vendor/twig/twig/lib/Twig/Environment.php similarity index 99% rename from core/vendor/Twig/Environment.php rename to core/vendor/twig/twig/lib/Twig/Environment.php index 333d667..8cf70fd 100644 --- a/core/vendor/Twig/Environment.php +++ b/core/vendor/twig/twig/lib/Twig/Environment.php @@ -17,7 +17,7 @@ */ class Twig_Environment { - const VERSION = '1.8.3-DEV'; + const VERSION = '1.8.4-DEV'; protected $charset; protected $loader; @@ -1094,7 +1094,7 @@ class Twig_Environment if (false !== @file_put_contents($tmpFile, $content)) { // rename does not work on Win32 before 5.2.6 if (@rename($tmpFile, $file) || (@copy($tmpFile, $file) && unlink($tmpFile))) { - @chmod($file, 0644); + @chmod($file, 0666 & ~umask()); return; } diff --git a/core/vendor/Twig/Error.php b/core/vendor/twig/twig/lib/Twig/Error.php similarity index 100% rename from core/vendor/Twig/Error.php rename to core/vendor/twig/twig/lib/Twig/Error.php diff --git a/core/vendor/Twig/Error/Loader.php b/core/vendor/twig/twig/lib/Twig/Error/Loader.php similarity index 100% rename from core/vendor/Twig/Error/Loader.php rename to core/vendor/twig/twig/lib/Twig/Error/Loader.php diff --git a/core/vendor/Twig/Error/Runtime.php b/core/vendor/twig/twig/lib/Twig/Error/Runtime.php similarity index 100% rename from core/vendor/Twig/Error/Runtime.php rename to core/vendor/twig/twig/lib/Twig/Error/Runtime.php diff --git a/core/vendor/Twig/Error/Syntax.php b/core/vendor/twig/twig/lib/Twig/Error/Syntax.php similarity index 100% rename from core/vendor/Twig/Error/Syntax.php rename to core/vendor/twig/twig/lib/Twig/Error/Syntax.php diff --git a/core/vendor/Twig/ExpressionParser.php b/core/vendor/twig/twig/lib/Twig/ExpressionParser.php similarity index 100% rename from core/vendor/Twig/ExpressionParser.php rename to core/vendor/twig/twig/lib/Twig/ExpressionParser.php diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/lib/Twig/Extension.php similarity index 100% copy from core/vendor/Twig/Extension.php copy to core/vendor/twig/twig/lib/Twig/Extension.php diff --git a/core/vendor/Twig/Extension/Core.php b/core/vendor/twig/twig/lib/Twig/Extension/Core.php similarity index 100% rename from core/vendor/Twig/Extension/Core.php rename to core/vendor/twig/twig/lib/Twig/Extension/Core.php diff --git a/core/vendor/Twig/Extension/Debug.php b/core/vendor/twig/twig/lib/Twig/Extension/Debug.php similarity index 100% copy from core/vendor/Twig/Extension/Debug.php copy to core/vendor/twig/twig/lib/Twig/Extension/Debug.php diff --git a/core/vendor/Twig/Extension/Escaper.php b/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php similarity index 91% copy from core/vendor/Twig/Extension/Escaper.php copy to core/vendor/twig/twig/lib/Twig/Extension/Escaper.php index b0aa8b1..c02c3a8 100644 --- a/core/vendor/Twig/Extension/Escaper.php +++ b/core/vendor/twig/twig/lib/Twig/Extension/Escaper.php @@ -76,7 +76,9 @@ class Twig_Extension_Escaper extends Twig_Extension */ public function getDefaultStrategy($filename) { - if (is_callable($this->defaultStrategy)) { + // disable string callables to avoid calling a function named html or js, + // or any other upcoming escaping strategy + if (!is_string($this->defaultStrategy) && is_callable($this->defaultStrategy)) { return call_user_func($this->defaultStrategy, $filename); } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/lib/Twig/Extension/Optimizer.php similarity index 100% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/lib/Twig/Extension/Optimizer.php diff --git a/core/vendor/Twig/Extension/Sandbox.php b/core/vendor/twig/twig/lib/Twig/Extension/Sandbox.php similarity index 100% rename from core/vendor/Twig/Extension/Sandbox.php rename to core/vendor/twig/twig/lib/Twig/Extension/Sandbox.php diff --git a/core/vendor/Twig/ExtensionInterface.php b/core/vendor/twig/twig/lib/Twig/ExtensionInterface.php similarity index 100% rename from core/vendor/Twig/ExtensionInterface.php rename to core/vendor/twig/twig/lib/Twig/ExtensionInterface.php diff --git a/core/vendor/Twig/Filter.php b/core/vendor/twig/twig/lib/Twig/Filter.php similarity index 100% rename from core/vendor/Twig/Filter.php rename to core/vendor/twig/twig/lib/Twig/Filter.php diff --git a/core/vendor/Twig/Filter/Function.php b/core/vendor/twig/twig/lib/Twig/Filter/Function.php similarity index 100% rename from core/vendor/Twig/Filter/Function.php rename to core/vendor/twig/twig/lib/Twig/Filter/Function.php diff --git a/core/vendor/Twig/Filter/Method.php b/core/vendor/twig/twig/lib/Twig/Filter/Method.php similarity index 100% rename from core/vendor/Twig/Filter/Method.php rename to core/vendor/twig/twig/lib/Twig/Filter/Method.php diff --git a/core/vendor/Twig/Filter/Node.php b/core/vendor/twig/twig/lib/Twig/Filter/Node.php similarity index 100% rename from core/vendor/Twig/Filter/Node.php rename to core/vendor/twig/twig/lib/Twig/Filter/Node.php diff --git a/core/vendor/Twig/FilterInterface.php b/core/vendor/twig/twig/lib/Twig/FilterInterface.php similarity index 100% rename from core/vendor/Twig/FilterInterface.php rename to core/vendor/twig/twig/lib/Twig/FilterInterface.php diff --git a/core/vendor/Twig/Function.php b/core/vendor/twig/twig/lib/Twig/Function.php similarity index 100% copy from core/vendor/Twig/Function.php copy to core/vendor/twig/twig/lib/Twig/Function.php diff --git a/core/vendor/Twig/Function/Function.php b/core/vendor/twig/twig/lib/Twig/Function/Function.php similarity index 100% rename from core/vendor/Twig/Function/Function.php rename to core/vendor/twig/twig/lib/Twig/Function/Function.php diff --git a/core/vendor/Twig/Function/Method.php b/core/vendor/twig/twig/lib/Twig/Function/Method.php similarity index 100% rename from core/vendor/Twig/Function/Method.php rename to core/vendor/twig/twig/lib/Twig/Function/Method.php diff --git a/core/vendor/Twig/Function/Node.php b/core/vendor/twig/twig/lib/Twig/Function/Node.php similarity index 100% rename from core/vendor/Twig/Function/Node.php rename to core/vendor/twig/twig/lib/Twig/Function/Node.php diff --git a/core/vendor/Twig/FunctionInterface.php b/core/vendor/twig/twig/lib/Twig/FunctionInterface.php similarity index 100% rename from core/vendor/Twig/FunctionInterface.php rename to core/vendor/twig/twig/lib/Twig/FunctionInterface.php diff --git a/core/vendor/Twig/Lexer.php b/core/vendor/twig/twig/lib/Twig/Lexer.php similarity index 100% rename from core/vendor/Twig/Lexer.php rename to core/vendor/twig/twig/lib/Twig/Lexer.php diff --git a/core/vendor/Twig/LexerInterface.php b/core/vendor/twig/twig/lib/Twig/LexerInterface.php similarity index 100% rename from core/vendor/Twig/LexerInterface.php rename to core/vendor/twig/twig/lib/Twig/LexerInterface.php diff --git a/core/vendor/Twig/Loader/Array.php b/core/vendor/twig/twig/lib/Twig/Loader/Array.php similarity index 100% rename from core/vendor/Twig/Loader/Array.php rename to core/vendor/twig/twig/lib/Twig/Loader/Array.php diff --git a/core/vendor/Twig/Loader/Chain.php b/core/vendor/twig/twig/lib/Twig/Loader/Chain.php similarity index 100% rename from core/vendor/Twig/Loader/Chain.php rename to core/vendor/twig/twig/lib/Twig/Loader/Chain.php diff --git a/core/vendor/Twig/Loader/Filesystem.php b/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php similarity index 98% rename from core/vendor/Twig/Loader/Filesystem.php rename to core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php index fd93219..18104a5 100644 --- a/core/vendor/Twig/Loader/Filesystem.php +++ b/core/vendor/twig/twig/lib/Twig/Loader/Filesystem.php @@ -71,7 +71,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path)); } - $this->paths[] = $path; + $this->paths[] = rtrim($path, '/\\'); } /** diff --git a/core/vendor/Twig/Loader/String.php b/core/vendor/twig/twig/lib/Twig/Loader/String.php similarity index 100% rename from core/vendor/Twig/Loader/String.php rename to core/vendor/twig/twig/lib/Twig/Loader/String.php diff --git a/core/vendor/Twig/LoaderInterface.php b/core/vendor/twig/twig/lib/Twig/LoaderInterface.php similarity index 100% rename from core/vendor/Twig/LoaderInterface.php rename to core/vendor/twig/twig/lib/Twig/LoaderInterface.php diff --git a/core/vendor/Twig/Markup.php b/core/vendor/twig/twig/lib/Twig/Markup.php similarity index 100% rename from core/vendor/Twig/Markup.php rename to core/vendor/twig/twig/lib/Twig/Markup.php diff --git a/core/vendor/Twig/Node.php b/core/vendor/twig/twig/lib/Twig/Node.php similarity index 100% rename from core/vendor/Twig/Node.php rename to core/vendor/twig/twig/lib/Twig/Node.php diff --git a/core/vendor/Twig/Node/AutoEscape.php b/core/vendor/twig/twig/lib/Twig/Node/AutoEscape.php similarity index 100% rename from core/vendor/Twig/Node/AutoEscape.php rename to core/vendor/twig/twig/lib/Twig/Node/AutoEscape.php diff --git a/core/vendor/Twig/Node/Block.php b/core/vendor/twig/twig/lib/Twig/Node/Block.php similarity index 100% rename from core/vendor/Twig/Node/Block.php rename to core/vendor/twig/twig/lib/Twig/Node/Block.php diff --git a/core/vendor/Twig/Node/BlockReference.php b/core/vendor/twig/twig/lib/Twig/Node/BlockReference.php similarity index 100% rename from core/vendor/Twig/Node/BlockReference.php rename to core/vendor/twig/twig/lib/Twig/Node/BlockReference.php diff --git a/core/vendor/Twig/Node/Body.php b/core/vendor/twig/twig/lib/Twig/Node/Body.php similarity index 100% rename from core/vendor/Twig/Node/Body.php rename to core/vendor/twig/twig/lib/Twig/Node/Body.php diff --git a/core/vendor/Twig/Node/Do.php b/core/vendor/twig/twig/lib/Twig/Node/Do.php similarity index 100% rename from core/vendor/Twig/Node/Do.php rename to core/vendor/twig/twig/lib/Twig/Node/Do.php diff --git a/core/vendor/Twig/Node/Embed.php b/core/vendor/twig/twig/lib/Twig/Node/Embed.php similarity index 100% rename from core/vendor/Twig/Node/Embed.php rename to core/vendor/twig/twig/lib/Twig/Node/Embed.php diff --git a/core/vendor/Twig/Node/Expression.php b/core/vendor/twig/twig/lib/Twig/Node/Expression.php similarity index 100% rename from core/vendor/Twig/Node/Expression.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression.php diff --git a/core/vendor/Twig/Node/Expression/Array.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Array.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Array.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Array.php diff --git a/core/vendor/Twig/Node/Expression/AssignName.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php similarity index 100% rename from core/vendor/Twig/Node/Expression/AssignName.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/AssignName.php diff --git a/core/vendor/Twig/Node/Expression/Binary.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Add.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Add.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Add.php diff --git a/core/vendor/Twig/Node/Expression/Binary/And.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/And.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/And.php diff --git a/core/vendor/Twig/Node/Expression/Binary/BitwiseAnd.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/BitwiseAnd.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseAnd.php diff --git a/core/vendor/Twig/Node/Expression/Binary/BitwiseOr.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/BitwiseOr.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseOr.php diff --git a/core/vendor/Twig/Node/Expression/Binary/BitwiseXor.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/BitwiseXor.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/BitwiseXor.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Concat.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php similarity index 100% copy from core/vendor/Twig/Node/Expression/Binary/Concat.php copy to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Concat.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Div.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Div.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Div.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Equal.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Equal.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Equal.php diff --git a/core/vendor/Twig/Node/Expression/Binary/FloorDiv.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/FloorDiv.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/FloorDiv.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Greater.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Greater.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Greater.php diff --git a/core/vendor/Twig/Node/Expression/Binary/GreaterEqual.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/GreaterEqual.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/GreaterEqual.php diff --git a/core/vendor/Twig/Node/Expression/Binary/In.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/In.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/In.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Less.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Less.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Less.php diff --git a/core/vendor/Twig/Node/Expression/Binary/LessEqual.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/LessEqual.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/LessEqual.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Mod.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Mod.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mod.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Mul.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Mul.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Mul.php diff --git a/core/vendor/Twig/Node/Expression/Binary/NotEqual.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/NotEqual.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotEqual.php diff --git a/core/vendor/Twig/Node/Expression/Binary/NotIn.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/NotIn.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/NotIn.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Or.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Or.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Or.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Power.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Power.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Power.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Range.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Range.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Range.php diff --git a/core/vendor/Twig/Node/Expression/Binary/Sub.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Binary/Sub.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Binary/Sub.php diff --git a/core/vendor/Twig/Node/Expression/BlockReference.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php similarity index 100% rename from core/vendor/Twig/Node/Expression/BlockReference.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/BlockReference.php diff --git a/core/vendor/Twig/Node/Expression/Conditional.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Conditional.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Conditional.php diff --git a/core/vendor/Twig/Node/Expression/Constant.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Constant.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Constant.php diff --git a/core/vendor/Twig/Node/Expression/ExtensionReference.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php similarity index 100% rename from core/vendor/Twig/Node/Expression/ExtensionReference.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php diff --git a/core/vendor/Twig/Node/Expression/Filter.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Filter.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Filter.php diff --git a/core/vendor/Twig/Node/Expression/Filter/Default.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Filter/Default.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Filter/Default.php diff --git a/core/vendor/Twig/Node/Expression/Function.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Function.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Function.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Function.php diff --git a/core/vendor/Twig/Node/Expression/GetAttr.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php similarity index 100% rename from core/vendor/Twig/Node/Expression/GetAttr.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/GetAttr.php diff --git a/core/vendor/Twig/Node/Expression/MethodCall.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php similarity index 100% rename from core/vendor/Twig/Node/Expression/MethodCall.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/MethodCall.php diff --git a/core/vendor/Twig/Node/Expression/Name.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Name.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Name.php diff --git a/core/vendor/Twig/Node/Expression/Parent.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Parent.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Parent.php diff --git a/core/vendor/Twig/Node/Expression/TempName.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php similarity index 100% rename from core/vendor/Twig/Node/Expression/TempName.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/TempName.php diff --git a/core/vendor/Twig/Node/Expression/Test.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test.php diff --git a/core/vendor/Twig/Node/Expression/Test/Constant.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test/Constant.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Constant.php diff --git a/core/vendor/Twig/Node/Expression/Test/Defined.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test/Defined.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Defined.php diff --git a/core/vendor/Twig/Node/Expression/Test/Divisibleby.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test/Divisibleby.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Divisibleby.php diff --git a/core/vendor/Twig/Node/Expression/Test/Even.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test/Even.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Even.php diff --git a/core/vendor/Twig/Node/Expression/Test/Null.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test/Null.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Null.php diff --git a/core/vendor/Twig/Node/Expression/Test/Odd.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test/Odd.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Odd.php diff --git a/core/vendor/Twig/Node/Expression/Test/Sameas.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Test/Sameas.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Test/Sameas.php diff --git a/core/vendor/Twig/Node/Expression/Unary.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Unary.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Unary.php diff --git a/core/vendor/Twig/Node/Expression/Unary/Neg.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Unary/Neg.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Neg.php diff --git a/core/vendor/Twig/Node/Expression/Unary/Not.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Unary/Not.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Not.php diff --git a/core/vendor/Twig/Node/Expression/Unary/Pos.php b/core/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php similarity index 100% rename from core/vendor/Twig/Node/Expression/Unary/Pos.php rename to core/vendor/twig/twig/lib/Twig/Node/Expression/Unary/Pos.php diff --git a/core/vendor/Twig/Node/Flush.php b/core/vendor/twig/twig/lib/Twig/Node/Flush.php similarity index 100% rename from core/vendor/Twig/Node/Flush.php rename to core/vendor/twig/twig/lib/Twig/Node/Flush.php diff --git a/core/vendor/Twig/Node/For.php b/core/vendor/twig/twig/lib/Twig/Node/For.php similarity index 100% rename from core/vendor/Twig/Node/For.php rename to core/vendor/twig/twig/lib/Twig/Node/For.php diff --git a/core/vendor/Twig/Node/ForLoop.php b/core/vendor/twig/twig/lib/Twig/Node/ForLoop.php similarity index 100% rename from core/vendor/Twig/Node/ForLoop.php rename to core/vendor/twig/twig/lib/Twig/Node/ForLoop.php diff --git a/core/vendor/Twig/Node/If.php b/core/vendor/twig/twig/lib/Twig/Node/If.php similarity index 100% rename from core/vendor/Twig/Node/If.php rename to core/vendor/twig/twig/lib/Twig/Node/If.php diff --git a/core/vendor/Twig/Node/Import.php b/core/vendor/twig/twig/lib/Twig/Node/Import.php similarity index 100% rename from core/vendor/Twig/Node/Import.php rename to core/vendor/twig/twig/lib/Twig/Node/Import.php diff --git a/core/vendor/Twig/Node/Include.php b/core/vendor/twig/twig/lib/Twig/Node/Include.php similarity index 100% rename from core/vendor/Twig/Node/Include.php rename to core/vendor/twig/twig/lib/Twig/Node/Include.php diff --git a/core/vendor/Twig/Node/Macro.php b/core/vendor/twig/twig/lib/Twig/Node/Macro.php similarity index 100% rename from core/vendor/Twig/Node/Macro.php rename to core/vendor/twig/twig/lib/Twig/Node/Macro.php diff --git a/core/vendor/Twig/Node/Module.php b/core/vendor/twig/twig/lib/Twig/Node/Module.php similarity index 100% rename from core/vendor/Twig/Node/Module.php rename to core/vendor/twig/twig/lib/Twig/Node/Module.php diff --git a/core/vendor/Twig/Node/Print.php b/core/vendor/twig/twig/lib/Twig/Node/Print.php similarity index 100% rename from core/vendor/Twig/Node/Print.php rename to core/vendor/twig/twig/lib/Twig/Node/Print.php diff --git a/core/vendor/Twig/Node/Sandbox.php b/core/vendor/twig/twig/lib/Twig/Node/Sandbox.php similarity index 100% rename from core/vendor/Twig/Node/Sandbox.php rename to core/vendor/twig/twig/lib/Twig/Node/Sandbox.php diff --git a/core/vendor/Twig/Node/SandboxedModule.php b/core/vendor/twig/twig/lib/Twig/Node/SandboxedModule.php similarity index 100% rename from core/vendor/Twig/Node/SandboxedModule.php rename to core/vendor/twig/twig/lib/Twig/Node/SandboxedModule.php diff --git a/core/vendor/Twig/Node/SandboxedPrint.php b/core/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php similarity index 100% rename from core/vendor/Twig/Node/SandboxedPrint.php rename to core/vendor/twig/twig/lib/Twig/Node/SandboxedPrint.php diff --git a/core/vendor/Twig/Node/Set.php b/core/vendor/twig/twig/lib/Twig/Node/Set.php similarity index 100% rename from core/vendor/Twig/Node/Set.php rename to core/vendor/twig/twig/lib/Twig/Node/Set.php diff --git a/core/vendor/Twig/Node/SetTemp.php b/core/vendor/twig/twig/lib/Twig/Node/SetTemp.php similarity index 100% rename from core/vendor/Twig/Node/SetTemp.php rename to core/vendor/twig/twig/lib/Twig/Node/SetTemp.php diff --git a/core/vendor/Twig/Node/Spaceless.php b/core/vendor/twig/twig/lib/Twig/Node/Spaceless.php similarity index 100% rename from core/vendor/Twig/Node/Spaceless.php rename to core/vendor/twig/twig/lib/Twig/Node/Spaceless.php diff --git a/core/vendor/Twig/Node/Text.php b/core/vendor/twig/twig/lib/Twig/Node/Text.php similarity index 100% rename from core/vendor/Twig/Node/Text.php rename to core/vendor/twig/twig/lib/Twig/Node/Text.php diff --git a/core/vendor/Twig/NodeInterface.php b/core/vendor/twig/twig/lib/Twig/NodeInterface.php similarity index 100% rename from core/vendor/Twig/NodeInterface.php rename to core/vendor/twig/twig/lib/Twig/NodeInterface.php diff --git a/core/vendor/Twig/NodeOutputInterface.php b/core/vendor/twig/twig/lib/Twig/NodeOutputInterface.php similarity index 100% rename from core/vendor/Twig/NodeOutputInterface.php rename to core/vendor/twig/twig/lib/Twig/NodeOutputInterface.php diff --git a/core/vendor/Twig/NodeTraverser.php b/core/vendor/twig/twig/lib/Twig/NodeTraverser.php similarity index 100% copy from core/vendor/Twig/NodeTraverser.php copy to core/vendor/twig/twig/lib/Twig/NodeTraverser.php diff --git a/core/vendor/Twig/NodeVisitor/Escaper.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php similarity index 100% rename from core/vendor/Twig/NodeVisitor/Escaper.php rename to core/vendor/twig/twig/lib/Twig/NodeVisitor/Escaper.php diff --git a/core/vendor/Twig/NodeVisitor/Optimizer.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php similarity index 100% rename from core/vendor/Twig/NodeVisitor/Optimizer.php rename to core/vendor/twig/twig/lib/Twig/NodeVisitor/Optimizer.php diff --git a/core/vendor/Twig/NodeVisitor/SafeAnalysis.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php similarity index 100% rename from core/vendor/Twig/NodeVisitor/SafeAnalysis.php rename to core/vendor/twig/twig/lib/Twig/NodeVisitor/SafeAnalysis.php diff --git a/core/vendor/Twig/NodeVisitor/Sandbox.php b/core/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php similarity index 100% rename from core/vendor/Twig/NodeVisitor/Sandbox.php rename to core/vendor/twig/twig/lib/Twig/NodeVisitor/Sandbox.php diff --git a/core/vendor/Twig/NodeVisitorInterface.php b/core/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php similarity index 100% rename from core/vendor/Twig/NodeVisitorInterface.php rename to core/vendor/twig/twig/lib/Twig/NodeVisitorInterface.php diff --git a/core/vendor/Twig/Parser.php b/core/vendor/twig/twig/lib/Twig/Parser.php similarity index 100% copy from core/vendor/Twig/Parser.php copy to core/vendor/twig/twig/lib/Twig/Parser.php diff --git a/core/vendor/Twig/ParserInterface.php b/core/vendor/twig/twig/lib/Twig/ParserInterface.php similarity index 100% rename from core/vendor/Twig/ParserInterface.php rename to core/vendor/twig/twig/lib/Twig/ParserInterface.php diff --git a/core/vendor/Twig/Sandbox/SecurityError.php b/core/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php similarity index 100% rename from core/vendor/Twig/Sandbox/SecurityError.php rename to core/vendor/twig/twig/lib/Twig/Sandbox/SecurityError.php diff --git a/core/vendor/Twig/Sandbox/SecurityPolicy.php b/core/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php similarity index 100% rename from core/vendor/Twig/Sandbox/SecurityPolicy.php rename to core/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicy.php diff --git a/core/vendor/Twig/Sandbox/SecurityPolicyInterface.php b/core/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php similarity index 100% rename from core/vendor/Twig/Sandbox/SecurityPolicyInterface.php rename to core/vendor/twig/twig/lib/Twig/Sandbox/SecurityPolicyInterface.php diff --git a/core/vendor/Twig/Template.php b/core/vendor/twig/twig/lib/Twig/Template.php similarity index 100% rename from core/vendor/Twig/Template.php rename to core/vendor/twig/twig/lib/Twig/Template.php diff --git a/core/vendor/Twig/TemplateInterface.php b/core/vendor/twig/twig/lib/Twig/TemplateInterface.php similarity index 100% rename from core/vendor/Twig/TemplateInterface.php rename to core/vendor/twig/twig/lib/Twig/TemplateInterface.php diff --git a/core/vendor/Twig/Test/Function.php b/core/vendor/twig/twig/lib/Twig/Test/Function.php similarity index 100% copy from core/vendor/Twig/Test/Function.php copy to core/vendor/twig/twig/lib/Twig/Test/Function.php diff --git a/core/vendor/Twig/Test/Method.php b/core/vendor/twig/twig/lib/Twig/Test/Method.php similarity index 100% rename from core/vendor/Twig/Test/Method.php rename to core/vendor/twig/twig/lib/Twig/Test/Method.php diff --git a/core/vendor/Twig/Test/Node.php b/core/vendor/twig/twig/lib/Twig/Test/Node.php similarity index 100% copy from core/vendor/Twig/Test/Node.php copy to core/vendor/twig/twig/lib/Twig/Test/Node.php diff --git a/core/vendor/Twig/TestInterface.php b/core/vendor/twig/twig/lib/Twig/TestInterface.php similarity index 100% rename from core/vendor/Twig/TestInterface.php rename to core/vendor/twig/twig/lib/Twig/TestInterface.php diff --git a/core/vendor/Twig/Token.php b/core/vendor/twig/twig/lib/Twig/Token.php similarity index 100% rename from core/vendor/Twig/Token.php rename to core/vendor/twig/twig/lib/Twig/Token.php diff --git a/core/vendor/Twig/TokenParser.php b/core/vendor/twig/twig/lib/Twig/TokenParser.php similarity index 100% rename from core/vendor/Twig/TokenParser.php rename to core/vendor/twig/twig/lib/Twig/TokenParser.php diff --git a/core/vendor/Twig/TokenParser/AutoEscape.php b/core/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php similarity index 100% rename from core/vendor/Twig/TokenParser/AutoEscape.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/AutoEscape.php diff --git a/core/vendor/Twig/TokenParser/Block.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Block.php similarity index 100% rename from core/vendor/Twig/TokenParser/Block.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Block.php diff --git a/core/vendor/Twig/TokenParser/Do.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Do.php similarity index 100% rename from core/vendor/Twig/TokenParser/Do.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Do.php diff --git a/core/vendor/Twig/TokenParser/Embed.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Embed.php similarity index 100% rename from core/vendor/Twig/TokenParser/Embed.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Embed.php diff --git a/core/vendor/Twig/TokenParser/Extends.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Extends.php similarity index 100% rename from core/vendor/Twig/TokenParser/Extends.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Extends.php diff --git a/core/vendor/Twig/TokenParser/Filter.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Filter.php similarity index 100% copy from core/vendor/Twig/TokenParser/Filter.php copy to core/vendor/twig/twig/lib/Twig/TokenParser/Filter.php diff --git a/core/vendor/Twig/TokenParser/Flush.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Flush.php similarity index 100% rename from core/vendor/Twig/TokenParser/Flush.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Flush.php diff --git a/core/vendor/Twig/TokenParser/For.php b/core/vendor/twig/twig/lib/Twig/TokenParser/For.php similarity index 100% rename from core/vendor/Twig/TokenParser/For.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/For.php diff --git a/core/vendor/Twig/TokenParser/From.php b/core/vendor/twig/twig/lib/Twig/TokenParser/From.php similarity index 100% rename from core/vendor/Twig/TokenParser/From.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/From.php diff --git a/core/vendor/Twig/TokenParser/If.php b/core/vendor/twig/twig/lib/Twig/TokenParser/If.php similarity index 100% rename from core/vendor/Twig/TokenParser/If.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/If.php diff --git a/core/vendor/Twig/TokenParser/Import.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Import.php similarity index 100% rename from core/vendor/Twig/TokenParser/Import.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Import.php diff --git a/core/vendor/Twig/TokenParser/Include.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Include.php similarity index 100% rename from core/vendor/Twig/TokenParser/Include.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Include.php diff --git a/core/vendor/Twig/TokenParser/Macro.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Macro.php similarity index 100% rename from core/vendor/Twig/TokenParser/Macro.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Macro.php diff --git a/core/vendor/Twig/TokenParser/Sandbox.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php similarity index 100% rename from core/vendor/Twig/TokenParser/Sandbox.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Sandbox.php diff --git a/core/vendor/Twig/TokenParser/Set.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Set.php similarity index 100% rename from core/vendor/Twig/TokenParser/Set.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Set.php diff --git a/core/vendor/Twig/TokenParser/Spaceless.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php similarity index 100% copy from core/vendor/Twig/TokenParser/Spaceless.php copy to core/vendor/twig/twig/lib/Twig/TokenParser/Spaceless.php diff --git a/core/vendor/Twig/TokenParser/Use.php b/core/vendor/twig/twig/lib/Twig/TokenParser/Use.php similarity index 100% rename from core/vendor/Twig/TokenParser/Use.php rename to core/vendor/twig/twig/lib/Twig/TokenParser/Use.php diff --git a/core/vendor/Twig/TokenParserBroker.php b/core/vendor/twig/twig/lib/Twig/TokenParserBroker.php similarity index 100% rename from core/vendor/Twig/TokenParserBroker.php rename to core/vendor/twig/twig/lib/Twig/TokenParserBroker.php diff --git a/core/vendor/Twig/TokenParserBrokerInterface.php b/core/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php similarity index 100% rename from core/vendor/Twig/TokenParserBrokerInterface.php rename to core/vendor/twig/twig/lib/Twig/TokenParserBrokerInterface.php diff --git a/core/vendor/Twig/TokenParserInterface.php b/core/vendor/twig/twig/lib/Twig/TokenParserInterface.php similarity index 100% rename from core/vendor/Twig/TokenParserInterface.php rename to core/vendor/twig/twig/lib/Twig/TokenParserInterface.php diff --git a/core/vendor/Twig/TokenStream.php b/core/vendor/twig/twig/lib/Twig/TokenStream.php similarity index 100% rename from core/vendor/Twig/TokenStream.php rename to core/vendor/twig/twig/lib/Twig/TokenStream.php diff --git a/core/vendor/twig/twig/package.xml.tpl b/core/vendor/twig/twig/package.xml.tpl new file mode 100644 index 0000000..f9a9b89 --- /dev/null +++ b/core/vendor/twig/twig/package.xml.tpl @@ -0,0 +1,64 @@ + + + Twig + pear.twig-project.org + Twig is a PHP template engine. + + Twig is a template language for PHP, released under the new BSD license + (code and documentation). + + Twig uses a syntax similar to the Django and Jinja template languages which + inspired the Twig runtime environment. + + + Fabien Potencier + fabpot + fabien.potencier@symfony-project.org + yes + + + Armin Ronacher + armin + armin.ronacher@active-4.com + no + + {{ date }} + + + {{ version }} + {{ api_version }} + + + {{ stability }} + {{ stability }} + + BSD Style + - + + + + + + + + +{{ files }} + + + + + + + + 5.2.4 + + + 1.4.0 + + + + + diff --git a/core/vendor/Symfony/Component/Yaml/phpunit.xml.dist b/core/vendor/twig/twig/phpunit.xml.dist similarity index 45% rename from core/vendor/Symfony/Component/Yaml/phpunit.xml.dist rename to core/vendor/twig/twig/phpunit.xml.dist index d025f9e..6c5046f 100644 --- a/core/vendor/Symfony/Component/Yaml/phpunit.xml.dist +++ b/core/vendor/twig/twig/phpunit.xml.dist @@ -9,21 +9,17 @@ processIsolation="false" stopOnFailure="false" syntaxCheck="false" - bootstrap="Tests/bootstrap.php" + bootstrap="test/bootstrap.php" > - - - ./Tests/ - - + + + ./test/Twig/ + + - - - ./ - - ./vendor - ./Tests - - - + + + ./lib/Twig/ + + diff --git a/core/vendor/Twig/Test/Node.php b/core/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php similarity index 31% rename from core/vendor/Twig/Test/Node.php rename to core/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php index 47a978e..c8b7999 100644 --- a/core/vendor/Twig/Test/Node.php +++ b/core/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php @@ -3,33 +3,19 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Represents a template test as a Node. - * - * @package twig - * @author Fabien Potencier - */ -class Twig_Test_Node implements Twig_TestInterface +class Twig_Tests_AutoloaderTest extends PHPUnit_Framework_TestCase { - protected $class; - - public function __construct($class) - { - $this->class = $class; - } - - public function getClass() + public function testAutoload() { - return $this->class; - } + $this->assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig'); - public function compile() - { + $autoloader = new Twig_Autoloader(); + $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class'); } } diff --git a/core/vendor/Twig/Autoloader.php b/core/vendor/twig/twig/test/Twig/Tests/CompilerTest.php similarity index 20% copy from core/vendor/Twig/Autoloader.php copy to core/vendor/twig/twig/test/Twig/Tests/CompilerTest.php index 0f62884..ebe79ae 100644 --- a/core/vendor/Twig/Autoloader.php +++ b/core/vendor/twig/twig/test/Twig/Tests/CompilerTest.php @@ -3,44 +3,31 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Autoloads Twig classes. - * - * @package twig - * @author Fabien Potencier - */ -class Twig_Autoloader +class Twig_Tests_CompilerTest extends PHPUnit_Framework_TestCase { - /** - * Registers Twig_Autoloader as an SPL autoloader. - */ - static public function register() + public function testReprNumericValueWithLocale() { - ini_set('unserialize_callback_func', 'spl_autoload_call'); - spl_autoload_register(array(new self, 'autoload')); - } + $compiler = new Twig_Compiler(new Twig_Environment()); - /** - * Handles autoloading of classes. - * - * @param string $class A class name. - * - * @return boolean Returns true if the class has been loaded - */ - static public function autoload($class) - { - if (0 !== strpos($class, 'Twig')) { - return; + $locale = setlocale(LC_NUMERIC, 0); + if (false === $locale) { + $this->markTestSkipped('Your platform does not support locales.'); } - if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { - require $file; + $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); + if (false === setlocale(LC_ALL, $required_locales)) { + $this->markTestSkipped('Could not set any of required locales: ' . implode(", ", $required_locales)); } + + $this->assertEquals('1.2', $compiler->repr(1.2)->getSource()); + $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); + + setlocale(LC_ALL, $locale); } } diff --git a/core/vendor/Symfony/Component/DependencyInjection/ContainerAware.php b/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php similarity index 21% rename from core/vendor/Symfony/Component/DependencyInjection/ContainerAware.php rename to core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php index 1ae1db4..bb31690 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/ContainerAware.php +++ b/core/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php @@ -1,41 +1,35 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\DependencyInjection; - -/** - * A simple implementation of ContainerAwareInterface. - * - * @author Fabien Potencier - * - * @api - */ -class ContainerAware implements ContainerAwareInterface +class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase { - /** - * @var ContainerInterface - * - * @api - */ - protected $container; + public function testAutoescapeOption() + { + $loader = new Twig_Loader_Array(array( + 'html' => '{{ foo }} {{ foo }}', + 'js' => '{{ bar }} {{ bar }}', + )); + + $twig = new Twig_Environment($loader, array( + 'debug' => true, + 'cache' => false, + 'autoescape' => array($this, 'escapingStrategyCallback'), + )); + + $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', array('foo' => 'foo
    '))); + $this->assertEquals('foo\x3cbr\x2f \x3e foo\x3cbr\x2f \x3e', $twig->render('js', array('bar' => 'foo
    '))); + } - /** - * Sets the Container associated with this Controller. - * - * @param ContainerInterface $container A ContainerInterface instance - * - * @api - */ - public function setContainer(ContainerInterface $container = null) + public function escapingStrategyCallback($filename) { - $this->container = $container; + return $filename; } } diff --git a/core/vendor/Twig/Extension/Escaper.php b/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php similarity index 9% copy from core/vendor/Twig/Extension/Escaper.php copy to core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php index b0aa8b1..d0e48be 100644 --- a/core/vendor/Twig/Extension/Escaper.php +++ b/core/vendor/twig/twig/test/Twig/Tests/ErrorTest.php @@ -3,104 +3,98 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Escaper extends Twig_Extension -{ - protected $defaultStrategy; - public function __construct($defaultStrategy = 'html') +class Twig_Tests_ErrorTest extends PHPUnit_Framework_TestCase +{ + public function testErrorWithObjectFilename() { - $this->setDefaultStrategy($defaultStrategy); - } + $error = new Twig_Error('foo'); + $error->setTemplateFile(new SplFileInfo(__FILE__)); - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(new Twig_TokenParser_AutoEscape()); + $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage()); } - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() + public function testErrorWithArrayFilename() { - return array(new Twig_NodeVisitor_Escaper()); - } + $error = new Twig_Error('foo'); + $error->setTemplateFile(array('foo' => 'bar')); - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - public function getFilters() - { - return array( - 'raw' => new Twig_Filter_Function('twig_raw_filter', array('is_safe' => array('all'))), - ); + $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage()); } - /** - * Sets the default strategy to use when not defined by the user. - * - * The strategy can be a valid PHP callback that takes the template - * "filename" as an argument and returns the strategy to use. - * - * @param mixed $defaultStrategy An escaping strategy - */ - public function setDefaultStrategy($defaultStrategy) + public function testTwigExceptionAddsFileAndLineWhenMissing() { - // for BC - if (true === $defaultStrategy) { - $defaultStrategy = 'html'; - } + $loader = new Twig_Loader_Array(array('index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}")); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index'); + + try { + $template->render(array()); - $this->defaultStrategy = $defaultStrategy; + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('Variable "foo" does not exist in "index" at line 3', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index', $e->getTemplateFile()); + } } - /** - * Gets the default strategy to use when not defined by the user. - * - * @param string $filename The template "filename" - * - * @return string The default strategy to use for the template - */ - public function getDefaultStrategy($filename) + public function testRenderWrapsExceptions() { - if (is_callable($this->defaultStrategy)) { - return call_user_func($this->defaultStrategy, $filename); - } + $loader = new Twig_Loader_Array(array('index' => "\n\n\n{{ foo.bar }}\n\n\n\n{{ 'foo' }}")); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index'); - return $this->defaultStrategy; + try { + $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index" at line 4.', $e->getMessage()); + $this->assertEquals(4, $e->getTemplateLine()); + $this->assertEquals('index', $e->getTemplateFile()); + } } - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() + public function testTwigExceptionAddsFileAndLineWhenMissingWithInheritance() { - return 'escaper'; + $loader = new Twig_Loader_Array(array( + 'index' => "{% extends 'base' %} + {% block content %} + {{ foo.bar }} + {% endblock %} + {% block foo %} + {{ foo.bar }} + {% endblock %}", + 'base' => '{% block content %}{% endblock %}' + )); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index'); + + try { + $template->render(array()); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('Variable "foo" does not exist in "index" at line 3', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index', $e->getTemplateFile()); + } } } -/** - * Marks a variable as being safe. - * - * @param string $string A PHP variable - */ -function twig_raw_filter($string) +class Twig_Tests_ErrorTest_Foo { - return $string; + public function bar() + { + throw new Exception('Runtime error...'); + } } - diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php b/core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php similarity index 8% rename from core/vendor/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php rename to core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php index 8ee29b5..b3f300f 100644 --- a/core/vendor/Symfony/Component/ClassLoader/Tests/UniversalClassLoaderTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php @@ -1,195 +1,216 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\ClassLoader\Tests; - -use Symfony\Component\ClassLoader\UniversalClassLoader; - -class UniversalClassLoaderTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_ExpressionParserTest extends PHPUnit_Framework_TestCase { /** - * @dataProvider getLoadClassTests + * @expectedException Twig_Error_Syntax + * @dataProvider getFailingTestsForAssignment */ - public function testLoadClass($className, $testClassName, $message) + public function testCanOnlyAssignToNames($template) { - $loader = new UniversalClassLoader(); - $loader->registerNamespace('Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $loader->registerPrefix('Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $loader->loadClass($testClassName); - $this->assertTrue(class_exists($className), $message); + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); } - public function getLoadClassTests() + public function getFailingTestsForAssignment() { return array( - array('\\Namespaced\\Foo', 'Namespaced\\Foo', '->loadClass() loads Namespaced\Foo class'), - array('\\Pearlike_Foo', 'Pearlike_Foo', '->loadClass() loads Pearlike_Foo class'), - array('\\Namespaced\\Bar', '\\Namespaced\\Bar', '->loadClass() loads Namespaced\Bar class with a leading slash'), - array('\\Pearlike_Bar', '\\Pearlike_Bar', '->loadClass() loads Pearlike_Bar class with a leading slash'), + array('{% set false = "foo" %}'), + array('{% set true = "foo" %}'), + array('{% set none = "foo" %}'), + array('{% set 3 = "foo" %}'), + array('{% set 1 + 2 = "foo" %}'), + array('{% set "bar" = "foo" %}'), + array('{% set %}{% endset %}') ); } - public function testUseIncludePath() + /** + * @dataProvider getTestsForArray + */ + public function testArrayExpression($template, $expected) { - $loader = new UniversalClassLoader(); - $this->assertFalse($loader->getUseIncludePath()); - - $this->assertNull($loader->findFile('Foo')); + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $stream = $env->tokenize($template, 'index'); + $parser = new Twig_Parser($env); - $includePath = get_include_path(); - - $loader->useIncludePath(true); - $this->assertTrue($loader->getUseIncludePath()); - - set_include_path(__DIR__.'/Fixtures/includepath' . PATH_SEPARATOR . $includePath); - - $this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'includepath'.DIRECTORY_SEPARATOR.'Foo.php', $loader->findFile('Foo')); - - set_include_path($includePath); + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); } /** - * @dataProvider getLoadClassFromFallbackTests + * @expectedException Twig_Error_Syntax + * @dataProvider getFailingTestsForArray */ - public function testLoadClassFromFallback($className, $testClassName, $message) + public function testArraySyntaxError($template) { - $loader = new UniversalClassLoader(); - $loader->registerNamespace('Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $loader->registerPrefix('Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $loader->registerNamespaceFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback')); - $loader->registerPrefixFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback')); - $loader->loadClass($testClassName); - $this->assertTrue(class_exists($className), $message); + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); } - public function getLoadClassFromFallbackTests() + public function getFailingTestsForArray() { return array( - array('\\Namespaced\\Baz', 'Namespaced\\Baz', '->loadClass() loads Namespaced\Baz class'), - array('\\Pearlike_Baz', 'Pearlike_Baz', '->loadClass() loads Pearlike_Baz class'), - array('\\Namespaced\\FooBar', 'Namespaced\\FooBar', '->loadClass() loads Namespaced\Baz class from fallback dir'), - array('\\Pearlike_FooBar', 'Pearlike_FooBar', '->loadClass() loads Pearlike_Baz class from fallback dir'), + array('{{ [1, "a": "b"] }}'), + array('{{ {"a": "b", 2} }}'), ); } - public function testRegisterPrefixFallback() + public function getTestsForArray() { - $loader = new UniversalClassLoader(); - $loader->registerPrefixFallback(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback'); - $this->assertEquals(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/fallback'), $loader->getPrefixFallbacks()); - } + return array( + // simple array + array('{{ [1, 2] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + ), - public function testRegisterNamespaceFallback() - { - $loader = new UniversalClassLoader(); - $loader->registerNamespaceFallback(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Namespaced/fallback'); - $this->assertEquals(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Namespaced/fallback'), $loader->getNamespaceFallbacks()); - } + // array with trailing , + array('{{ [1, 2, ] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), - /** - * @dataProvider getLoadClassNamespaceCollisionTests - */ - public function testLoadClassNamespaceCollision($namespaces, $className, $message) - { - $loader = new UniversalClassLoader(); - $loader->registerNamespaces($namespaces); + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + ), - $loader->loadClass($className); - $this->assertTrue(class_exists($className), $message); - } + // simple hash + array('{{ {"a": "b", "b": "c"} }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), - public function getLoadClassNamespaceCollisionTests() - { - return array( - array( - array( - 'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', - 'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - ), - 'NamespaceCollision\A\Foo', - '->loadClass() loads NamespaceCollision\A\Foo from alpha.', + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), ), - array( - array( - 'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - 'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', - ), - 'NamespaceCollision\A\Bar', - '->loadClass() loads NamespaceCollision\A\Bar from alpha.', + + // hash with trailing , + array('{{ {"a": "b", "b": "c", } }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), ), - array( - array( - 'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', - 'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - ), - 'NamespaceCollision\A\B\Foo', - '->loadClass() loads NamespaceCollision\A\B\Foo from beta.', + + // hash in an array + array('{{ [1, {"a": "b", "b": "c"}] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), 1), ), - array( - array( - 'NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - 'NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', - ), - 'NamespaceCollision\A\B\Bar', - '->loadClass() loads NamespaceCollision\A\B\Bar from beta.', + + // array in a hash + array('{{ {"a": [1, 2], "b": "c"} }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), ), ); } /** - * @dataProvider getLoadClassPrefixCollisionTests + * @expectedException Twig_Error_Syntax */ - public function testLoadClassPrefixCollision($prefixes, $className, $message) + public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() { - $loader = new UniversalClassLoader(); - $loader->registerPrefixes($prefixes); + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $stream = $env->tokenize('{{ "a" "b" }}', 'index'); + $parser = new Twig_Parser($env); - $loader->loadClass($className); - $this->assertTrue(class_exists($className), $message); + $parser->parse($stream); } - public function getLoadClassPrefixCollisionTests() + /** + * @dataProvider getTestsForString + */ + public function testStringExpression($template, $expected) + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $stream = $env->tokenize($template, 'index'); + $parser = new Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); + } + + public function getTestsForString() { return array( array( - array( - 'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', - 'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - ), - 'PrefixCollision_A_Foo', - '->loadClass() loads PrefixCollision_A_Foo from alpha.', + '{{ "foo" }}', new Twig_Node_Expression_Constant('foo', 1), ), array( - array( - 'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - 'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', + '{{ "foo #{bar}" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 ), - 'PrefixCollision_A_Bar', - '->loadClass() loads PrefixCollision_A_Bar from alpha.', ), array( - array( - 'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', - 'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - ), - 'PrefixCollision_A_B_Foo', - '->loadClass() loads PrefixCollision_A_B_Foo from beta.', + '{{ "foo #{bar} baz" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ) ), + array( - array( - 'PrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/beta', - 'PrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/alpha', + '{{ "foo #{"foo #{bar} baz"} baz" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 ), - 'PrefixCollision_A_B_Bar', - '->loadClass() loads PrefixCollision_A_B_Bar from beta.', ), ); } diff --git a/core/vendor/Twig/Extension/Escaper.php b/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php similarity index 10% rename from core/vendor/Twig/Extension/Escaper.php rename to core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php index b0aa8b1..77a8101 100644 --- a/core/vendor/Twig/Extension/Escaper.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php @@ -3,104 +3,113 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Escaper extends Twig_Extension + +class Twig_Tests_Extension_CoreTest extends PHPUnit_Framework_TestCase { - protected $defaultStrategy; + /** + * @dataProvider getRandomFunctionTestData + */ + public function testRandomFunction($value, $expectedInArray) + { + for ($i = 0; $i < 100; $i++) { + $this->assertTrue(in_array(twig_random(new Twig_Environment(), $value), $expectedInArray, true)); // assertContains() would not consider the type + } + } - public function __construct($defaultStrategy = 'html') + public function getRandomFunctionTestData() { - $this->setDefaultStrategy($defaultStrategy); + return array( + array( // array + array('apple', 'orange', 'citrus'), + array('apple', 'orange', 'citrus'), + ), + array( // Traversable + new ArrayObject(array('apple', 'orange', 'citrus')), + array('apple', 'orange', 'citrus'), + ), + array( // unicode string + 'Ä€é', + array('Ä', '€', 'é'), + ), + array( // numeric but string + '123', + array('1', '2', '3'), + ), + array( // integer + 5, + range(0, 5, 1), + ), + array( // float + 5.9, + range(0, 5, 1), + ), + array( // negative + -2, + array(0, -1, -2), + ), + ); } - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() + public function testRandomFunctionWithoutParameter() { - return array(new Twig_TokenParser_AutoEscape()); + $max = mt_getrandmax(); + + for ($i = 0; $i < 100; $i++) { + $val = twig_random(new Twig_Environment()); + $this->assertTrue(is_int($val) && $val >= 0 && $val <= $max); + } } - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() + public function testRandomFunctionReturnsAsIs() { - return array(new Twig_NodeVisitor_Escaper()); + $this->assertSame('', twig_random(new Twig_Environment(), '')); + $this->assertSame('', twig_random(new Twig_Environment(null, array('charset' => null)), '')); + + $instance = new stdClass(); + $this->assertSame($instance, twig_random(new Twig_Environment(), $instance)); } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * @expectedException Twig_Error_Runtime */ - public function getFilters() + public function testRandomFunctionOfEmptyArrayThrowsException() { - return array( - 'raw' => new Twig_Filter_Function('twig_raw_filter', array('is_safe' => array('all'))), - ); + twig_random(new Twig_Environment(), array()); } - /** - * Sets the default strategy to use when not defined by the user. - * - * The strategy can be a valid PHP callback that takes the template - * "filename" as an argument and returns the strategy to use. - * - * @param mixed $defaultStrategy An escaping strategy - */ - public function setDefaultStrategy($defaultStrategy) + public function testRandomFunctionOnNonUTF8String() { - // for BC - if (true === $defaultStrategy) { - $defaultStrategy = 'html'; + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); } - $this->defaultStrategy = $defaultStrategy; + $twig = new Twig_Environment(); + $twig->setCharset('ISO-8859-1'); + + $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + for ($i = 0; $i < 30; $i++) { + $rand = twig_random($twig, $text); + $this->assertTrue(in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), array('Ä', 'é'), true)); + } } - /** - * Gets the default strategy to use when not defined by the user. - * - * @param string $filename The template "filename" - * - * @return string The default strategy to use for the template - */ - public function getDefaultStrategy($filename) + public function testReverseFilterOnNonUTF8String() { - if (is_callable($this->defaultStrategy)) { - return call_user_func($this->defaultStrategy, $filename); + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); } - return $this->defaultStrategy; - } + $twig = new Twig_Environment(); + $twig->setCharset('ISO-8859-1'); - /** - * Returns the name of the extension. - * - * @return string The extension name - */ - public function getName() - { - return 'escaper'; - } -} + $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1'); -/** - * Marks a variable as being safe. - * - * @param string $string A PHP variable - */ -function twig_raw_filter($string) -{ - return $string; + $this->assertEquals($output, 'éÄ'); + } } - diff --git a/core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php b/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php similarity index 5% rename from core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php rename to core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php index 8e2bea4..0768c65 100644 --- a/core/vendor/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php @@ -1,239 +1,209 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\HttpKernel\Profiler; - - -/** - * Base PDO storage for profiling information in a PDO database. - * - * @author Fabien Potencier - * @author Jan Schumann - */ -abstract class PdoProfilerStorage implements ProfilerStorageInterface +class Twig_Tests_Extension_SandboxTest extends PHPUnit_Framework_TestCase { - protected $dsn; - protected $username; - protected $password; - protected $lifetime; - protected $db; + static protected $params, $templates; - /** - * Constructor. - * - * @param string $dsn A data source name - * @param string $username The username for the database - * @param string $password The password for the database - * @param integer $lifetime The lifetime to use for the purge - */ - public function __construct($dsn, $username = '', $password = '', $lifetime = 86400) + public function setUp() { - $this->dsn = $dsn; - $this->username = $username; - $this->password = $password; - $this->lifetime = (int) $lifetime; + self::$params = array( + 'name' => 'Fabien', + 'obj' => new FooObject(), + 'arr' => array('obj' => new FooObject()), + ); + + self::$templates = array( + '1_basic1' => '{{ obj.foo }}', + '1_basic2' => '{{ name|upper }}', + '1_basic3' => '{% if name %}foo{% endif %}', + '1_basic4' => '{{ obj.bar }}', + '1_basic5' => '{{ obj }}', + '1_basic6' => '{{ arr.obj }}', + '1_basic7' => '{{ cycle(["foo","bar"], 1) }}', + '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}', + '1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + '1_layout' => '{% block content %}{% endblock %}', + '1_child' => '{% extends "1_layout" %}{% block content %}{{ "a"|json_encode }}{% endblock %}', + ); } /** - * {@inheritdoc} + * @expectedException Twig_Sandbox_SecurityError + * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child". */ - public function find($ip, $url, $limit, $method) + public function testSandboxWithInheritance() { - list($criteria, $args) = $this->buildCriteria($ip, $url, $limit, $method); + $twig = $this->getEnvironment(true, array(), self::$templates, array('block')); + $twig->loadTemplate('1_child')->render(array()); + } - $criteria = $criteria ? 'WHERE '.implode(' AND ', $criteria) : ''; + public function testSandboxGloballySet() + { + $twig = $this->getEnvironment(false, array(), self::$templates); + $this->assertEquals('FOO', $twig->loadTemplate('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); - $db = $this->initDb(); - $tokens = $this->fetch($db, 'SELECT token, ip, method, url, time, parent FROM sf_profiler_data '.$criteria.' ORDER BY time DESC LIMIT '.((integer) $limit), $args); - $this->close($db); + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic1')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); + } catch (Twig_Sandbox_SecurityError $e) { + } - return $tokens; - } + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic2')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); + } catch (Twig_Sandbox_SecurityError $e) { + } - /** - * {@inheritdoc} - */ - public function read($token) - { - $db = $this->initDb(); - $args = array(':token' => $token); - $data = $this->fetch($db, 'SELECT data, parent, ip, method, url, time FROM sf_profiler_data WHERE token = :token LIMIT 1', $args); - $this->close($db); - if (isset($data[0]['data'])) { - return $this->createProfileFromData($token, $data[0]); + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic3')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); + } catch (Twig_Sandbox_SecurityError $e) { } - return null; - } + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic4')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } - /** - * {@inheritdoc} - */ - public function write(Profile $profile) - { - $db = $this->initDb(); - $args = array( - ':token' => $profile->getToken(), - ':parent' => $profile->getParentToken(), - ':data' => base64_encode(serialize($profile->getCollectors())), - ':ip' => $profile->getIp(), - ':method' => $profile->getMethod(), - ':url' => $profile->getUrl(), - ':time' => $profile->getTime(), - ':created_at' => time(), - ); + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic5')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + $twig = $this->getEnvironment(true, array(), self::$templates); try { - if ($this->read($profile->getToken())) { - $this->exec($db, 'UPDATE sf_profiler_data SET parent = :parent, data = :data, ip = :ip, method = :method, url = :url, time = :time, created_at = :created_at WHERE token = :token', $args); - } else { - $this->exec($db, 'INSERT INTO sf_profiler_data (token, parent, data, ip, method, url, time, created_at) VALUES (:token, :parent, :data, :ip, :method, :url, :time, :created_at)', $args); - } - $this->cleanup(); - $status = true; - } catch (\Exception $e) { - $status = false; + $twig->loadTemplate('1_basic6')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { } - $this->close($db); + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic7')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } - return $status; - } + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => 'foo')); + FooObject::reset(); + $this->assertEquals('foo', $twig->loadTemplate('1_basic1')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once'); - /** - * {@inheritdoc} - */ - public function purge() - { - $db = $this->initDb(); - $this->exec($db, 'DELETE FROM sf_profiler_data'); - $this->close($db); - } + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => '__toString')); + FooObject::reset(); + $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); - /** - * Build SQL criteria to fetch records by ip and url - * - * @param string $ip The IP - * @param string $url The URL - * @param string $limit The maximum number of tokens to return - * @param string $method The request method - * - * @return array An array with (criteria, args) - */ - abstract protected function buildCriteria($ip, $url, $limit, $method); + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array('upper')); + $this->assertEquals('FABIEN', $twig->loadTemplate('1_basic2')->render(self::$params), 'Sandbox allow some filters'); - /** - * Initializes the database - * - * @throws \RuntimeException When the requested database driver is not installed - */ - abstract protected function initDb(); + $twig = $this->getEnvironment(true, array(), self::$templates, array('if')); + $this->assertEquals('foo', $twig->loadTemplate('1_basic3')->render(self::$params), 'Sandbox allow some tags'); - protected function cleanup() - { - $db = $this->initDb(); - $this->exec($db, 'DELETE FROM sf_profiler_data WHERE created_at < :time', array(':time' => time() - $this->lifetime)); - $this->close($db); - } + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array('FooObject' => 'bar')); + $this->assertEquals('bar', $twig->loadTemplate('1_basic4')->render(self::$params), 'Sandbox allow some properties'); - protected function exec($db, $query, array $args = array()) - { - $stmt = $this->prepareStatement($db, $query); + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('cycle')); + $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions'); - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); - } - $success = $stmt->execute(); - if (!$success) { - throw new \RuntimeException(sprintf('Error executing query "%s"', $query)); + foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) { + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => $name)); + FooObject::reset(); + $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); + $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once'); } } - protected function prepareStatement($db, $query) + public function testSandboxLocallySetForAnInclude() { + self::$templates = array( + '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}', + '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ); + + $twig = $this->getEnvironment(false, array(), self::$templates); + $this->assertEquals('fooFOOfoo', $twig->loadTemplate('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); + + self::$templates = array( + '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}', + '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ); + + $twig = $this->getEnvironment(true, array(), self::$templates); try { - $stmt = $db->prepare($query); - } catch (\Exception $e) { - $stmt = false; + $twig->loadTemplate('3_basic')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed'); + } catch (Twig_Sandbox_SecurityError $e) { } + } - if (false === $stmt) { - throw new \RuntimeException('The database cannot successfully prepare the statement'); - } + public function testMacrosInASandbox() + { + $twig = $this->getEnvironment(true, array('autoescape' => true), array('index' => <<{{ text }}

    {% endmacro %} +{{ _self.test('username') }} +EOF + ), array('macro'), array('escape')); - return $stmt; + $this->assertEquals('

    username

    ', $twig->loadTemplate('index')->render(array())); } - protected function fetch($db, $query, array $args = array()) + protected function getEnvironment($sandboxed, $options, $templates, $tags = array(), $filters = array(), $methods = array(), $properties = array(), $functions = array()) { - $stmt = $this->prepareStatement($db, $query); - - foreach ($args as $arg => $val) { - $stmt->bindValue($arg, $val, is_int($val) ? \PDO::PARAM_INT : \PDO::PARAM_STR); - } - $stmt->execute(); - $return = $stmt->fetchAll(\PDO::FETCH_ASSOC); + $loader = new Twig_Loader_Array($templates); + $twig = new Twig_Environment($loader, array_merge(array('debug' => true, 'cache' => false, 'autoescape' => false), $options)); + $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); + $twig->addExtension(new Twig_Extension_Sandbox($policy, $sandboxed)); - return $return; + return $twig; } +} - protected function close($db) +class FooObject +{ + static public $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); + + public $bar = 'bar'; + + static public function reset() { + self::$called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); } - protected function createProfileFromData($token, $data, $parent = null) + public function __toString() { - $profile = new Profile($token); - $profile->setIp($data['ip']); - $profile->setMethod($data['method']); - $profile->setUrl($data['url']); - $profile->setTime($data['time']); - $profile->setCollectors(unserialize(base64_decode($data['data']))); - - if (!$parent && !empty($data['parent'])) { - $parent = $this->read($data['parent']); - } + ++self::$called['__toString']; - if ($parent) { - $profile->setParent($parent); - } - - $profile->setChildren($this->readChildren($token, $profile)); - - return $profile; + return 'foo'; } - /** - * Reads the child profiles for the given token. - * - * @param string $token The parent token - * @param string $parent The parent instance - * - * @return array An array of Profile instance - */ - protected function readChildren($token, $parent) + public function foo() { - $db = $this->initDb(); - $data = $this->fetch($db, 'SELECT token, data, ip, method, url, time FROM sf_profiler_data WHERE parent = :token', array(':token' => $token)); - $this->close($db); + ++self::$called['foo']; - if (!$data) { - return array(); - } + return 'foo'; + } - $profiles = array(); - foreach ($data as $d) { - $profiles[] = $this->createProfileFromData($d['token'], $d, $parent); - } + public function getFooBar() + { + ++self::$called['getFooBar']; - return $profiles; + return 'foobar'; } } diff --git a/core/vendor/Twig/NodeTraverser.php b/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php similarity index 7% rename from core/vendor/Twig/NodeTraverser.php rename to core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php index 1e82b03..2c77c06 100644 --- a/core/vendor/Twig/NodeTraverser.php +++ b/core/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php @@ -1,89 +1,70 @@ - */ -class Twig_NodeTraverser +class Twig_Tests_FileCachingTest extends PHPUnit_Framework_TestCase { + protected $fileName; protected $env; - protected $visitors; + protected $tmpDir; - /** - * Constructor. - * - * @param Twig_Environment $env A Twig_Environment instance - * @param array $visitors An array of Twig_NodeVisitorInterface instances - */ - public function __construct(Twig_Environment $env, array $visitors = array()) + public function setUp() { - $this->env = $env; - $this->visitors = array(); - foreach ($visitors as $visitor) { - $this->addVisitor($visitor); + $this->tmpDir = sys_get_temp_dir().'/TwigTests'; + if (!file_exists($this->tmpDir)) { + @mkdir($this->tmpDir, 0777, true);; + } + + if (!is_writable($this->tmpDir)) { + $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir)); } + + $this->env = new Twig_Environment(new Twig_Loader_String(), array('cache' => $this->tmpDir)); } - /** - * Adds a visitor. - * - * @param Twig_NodeVisitorInterface $visitor A Twig_NodeVisitorInterface instance - */ - public function addVisitor(Twig_NodeVisitorInterface $visitor) + public function tearDown() { - if (!isset($this->visitors[$visitor->getPriority()])) { - $this->visitors[$visitor->getPriority()] = array(); + if ($this->fileName) { + unlink($this->fileName); } - $this->visitors[$visitor->getPriority()][] = $visitor; + $this->removeDir($this->tmpDir); } - /** - * Traverses a node and calls the registered visitors. - * - * @param Twig_NodeInterface $node A Twig_NodeInterface instance - */ - public function traverse(Twig_NodeInterface $node) + public function testWritingCacheFiles() { - ksort($this->visitors); - foreach ($this->visitors as $visitors) { - foreach ($visitors as $visitor) { - $node = $this->traverseForVisitor($visitor, $node); - } - } + $name = 'This is just text.'; + $template = $this->env->loadTemplate($name); + $cacheFileName = $this->env->getCacheFilename($name); - return $node; + $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); + $this->fileName = $cacheFileName; } - protected function traverseForVisitor(Twig_NodeVisitorInterface $visitor, Twig_NodeInterface $node = null) + public function testClearingCacheFiles() { - if (null === $node) { - return null; - } + $name = 'I will be deleted.'; + $template = $this->env->loadTemplate($name); + $cacheFileName = $this->env->getCacheFilename($name); + + $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); + $this->env->clearCacheFiles(); + $this->assertFalse(file_exists($cacheFileName), 'Cache file was not cleared.'); + } - $node = $visitor->enterNode($node, $this->env); + private function removeDir($target) + { + $fp = opendir($target); + while (false !== $file = readdir($fp)) { + if (in_array($file, array('.', '..'))) { + continue; + } - foreach ($node as $k => $n) { - if (false !== $n = $this->traverseForVisitor($visitor, $n)) { - $node->setNode($k, $n); + if (is_dir($target.'/'.$file)) { + self::removeDir($target.'/'.$file); } else { - $node->removeNode($k); + unlink($target.'/'.$file); } } - - return $visitor->leaveNode($node, $this->env); + closedir($fp); + rmdir($target); } } diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test new file mode 100644 index 0000000..02245e9 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test @@ -0,0 +1,20 @@ +--TEST-- +Exception for an unclosed tag +--TEMPLATE-- +{% block foo %} + {% if foo %} + + + + + {% for i in fo %} + + + + {% endfor %} + + + +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Unexpected tag name "endblock" (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test new file mode 100644 index 0000000..c69b119 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test @@ -0,0 +1,61 @@ +--TEST-- +Twig supports array notation +--TEMPLATE-- +{# empty array #} +{{ []|join(',') }} + +{{ [1, 2]|join(',') }} +{{ ['foo', "bar"]|join(',') }} +{{ {0: 1, 'foo': 'bar'}|join(',') }} +{{ {0: 1, 'foo': 'bar'}|keys|join(',') }} + +{{ {0: 1, foo: 'bar'}|join(',') }} +{{ {0: 1, foo: 'bar'}|keys|join(',') }} + +{# nested arrays #} +{% set a = [1, 2, [1, 2], {'foo': {'foo': 'bar'}}] %} +{{ a[2]|join(',') }} +{{ a[3]["foo"]|join(',') }} + +{# works even if [] is used inside the array #} +{{ [foo[bar]]|join(',') }} + +{# elements can be any expression #} +{{ ['foo'|upper, bar|upper, bar == foo]|join(',') }} + +{# arrays can have a trailing , like in PHP #} +{{ + [ + 1, + 2, + ]|join(',') +}} + +{# keys can be any expression #} +{% set a = 1 %} +{% set b = "foo" %} +{% set ary = { (a): 'a', (b): 'b', 'c': 'c', (a ~ b): 'd' } %} +{{ ary|keys|join(',') }} +{{ ary|join(',') }} +--DATA-- +return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) +--EXPECT-- +1,2 +foo,bar +1,bar +0,foo + +1,bar +0,foo + +1,2 +bar + +bar + +FOO,BAR, + +1,2 + +1,foo,c,1foo +a,b,c,d diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test new file mode 100644 index 0000000..f3df328 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo }} +{{ items['foo'] }} +{{ items[foo] }} +{{ items[items[foo]] }} +--DATA-- +return array('foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo')) +--EXPECT-- +bar +bar +foo +bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test new file mode 100644 index 0000000..f5e6845 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test @@ -0,0 +1,46 @@ +--TEST-- +Twig supports binary operations (+, -, *, /, ~, %, and, or) +--TEMPLATE-- +{{ 1 + 1 }} +{{ 2 - 1 }} +{{ 2 * 2 }} +{{ 2 / 2 }} +{{ 3 % 2 }} +{{ 1 and 1 }} +{{ 1 and 0 }} +{{ 0 and 1 }} +{{ 0 and 0 }} +{{ 1 or 1 }} +{{ 1 or 0 }} +{{ 0 or 1 }} +{{ 0 or 0 }} +{{ 0 or 1 and 0 }} +{{ 1 or 0 and 1 }} +{{ "foo" ~ "bar" }} +{{ foo ~ "bar" }} +{{ "foo" ~ bar }} +{{ foo ~ bar }} +{{ 20 // 7 }} +--DATA-- +return array('foo' => 'bar', 'bar' => 'foo') +--EXPECT-- +2 +1 +4 +1 +1 +1 + + + +1 +1 +1 + + +1 +foobar +barbar +foofoo +barfoo +2 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test new file mode 100644 index 0000000..911094c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports bitwise operations +--TEMPLATE-- +{{ 1 b-and 5 }} +{{ 1 b-or 5 }} +{{ 1 b-xor 5 }} +--DATA-- +return array() +--EXPECT-- +1 +5 +4 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test new file mode 100644 index 0000000..726b850 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports comparison operators (==, !=, <, >, >=, <=) +--TEMPLATE-- +{{ 1 > 2 }}/{{ 1 > 1 }}/{{ 1 >= 2 }}/{{ 1 >= 1 }} +{{ 1 < 2 }}/{{ 1 < 1 }}/{{ 1 <= 2 }}/{{ 1 <= 1 }} +{{ 1 == 1 }}/{{ 1 == 2 }} +{{ 1 != 1 }}/{{ 1 != 2 }} +--DATA-- +return array() +--EXPECT-- +///1 +1//1/1 +1/ +/1 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test new file mode 100644 index 0000000..9cd0676 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test @@ -0,0 +1,20 @@ +--TEST-- +Twig supports the .. operator +--TEMPLATE-- +{% for i in 0..10 %}{{ i }} {% endfor %} + +{% for letter in 'a'..'z' %}{{ letter }} {% endfor %} + +{% for letter in 'a'|upper..'z'|upper %}{{ letter }} {% endfor %} + +{% for i in foo[0]..foo[1] %}{{ i }} {% endfor %} + +{% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %} +--DATA-- +return array('foo' => array(1, 10)) +--EXPECT-- +0 1 2 3 4 5 6 7 8 9 10 +a b c d e f g h i j k l m n o p q r s t u v w x y z +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z +1 2 3 4 5 6 7 8 9 10 +1 2 3 4 5 6 7 8 9 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test new file mode 100644 index 0000000..79f8e0b --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test @@ -0,0 +1,8 @@ +--TEST-- +Twig supports grouping of expressions +--TEMPLATE-- +{{ (2 + 2) / 2 }} +--DATA-- +return array() +--EXPECT-- +2 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test new file mode 100644 index 0000000..7ae3bae --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test @@ -0,0 +1,22 @@ +--TEST-- +Twig supports literals +--TEMPLATE-- +1 {{ true }} +2 {{ TRUE }} +3 {{ false }} +4 {{ FALSE }} +5 {{ none }} +6 {{ NONE }} +7 {{ null }} +8 {{ NULL }} +--DATA-- +return array() +--EXPECT-- +1 1 +2 1 +3 +4 +5 +6 +7 +8 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test new file mode 100644 index 0000000..159db96 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test @@ -0,0 +1,27 @@ +--TEST-- +Twig supports __call() for attributes +--TEMPLATE-- +{{ foo.foo }} +{{ foo.bar }} +--DATA-- +class TestClassForMagicCallAttributes +{ + public function getBar() + { + return 'bar_from_getbar'; + } + + public function __call($method, $arguments) + { + if ('foo' === $method) + { + return 'foo_from_call'; + } + + return false; + } +} +return array('foo' => new TestClassForMagicCallAttributes()) +--EXPECT-- +foo_from_call +bar_from_getbar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test new file mode 100644 index 0000000..9d84a4c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test @@ -0,0 +1,28 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo.foo }} +{{ items.foo.getFoo() }} +{{ items.foo.bar }} +{{ items.foo['bar'] }} +{{ items.foo.bar('a', 43) }} +{{ items.foo.bar(foo) }} +{{ items.foo.self.foo() }} +{{ items.foo.is }} +{{ items.foo.in }} +{{ items.foo.not }} +--DATA-- +return array('foo' => 'bar', 'items' => array('foo' => new Foo(), 'bar' => 'foo')) +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +foo +foo +bar + +bar_a-43 +bar_bar +foo +is +in +not diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test new file mode 100644 index 0000000..db047c0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test @@ -0,0 +1,21 @@ +--TEST-- +Twig parses postfix expressions +--TEMPLATE-- + +{% macro foo() %}foo{% endmacro %} + +{{ 'a' }} +{{ 'a'|upper }} +{{ ('a')|upper }} +{{ -1|upper }} +{{ _self.foo() }} +{{ (_self).foo() }} +--DATA-- +return array(); +--EXPECT-- +a +A +A +-1 +foo +foo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test new file mode 100644 index 0000000..a911661 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports string interpolation +--TEMPLATE-- +{{ "foo #{"foo #{bar} baz"} baz" }} +{{ "foo #{bar}#{bar} baz" }} +--DATA-- +return array('bar' => 'BAR'); +--EXPECT-- +foo foo BAR baz baz +foo BARBAR baz diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test new file mode 100644 index 0000000..0e6fa96 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test @@ -0,0 +1,18 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 1 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : (1 ? 'YES1' : 'NO1') }} +{{ 0 ? 'YES' : (0 ? 'YES1' : 'NO1') }} +{{ 1 == 1 ? 'foo
    ':'' }} +{{ foo ~ (bar ? ('-' ~ bar) : '') }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--EXPECT-- +YES +NO +YES1 +NO1 +foo
    +foo-bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test new file mode 100644 index 0000000..b79219a --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports unary operators (not, -, +) +--TEMPLATE-- +{{ not 1 }}/{{ not 0 }} +{{ +1 + 1 }}/{{ -1 - 1 }} +{{ not (false or true) }} +--DATA-- +return array() +--EXPECT-- +/1 +2/-2 + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test new file mode 100644 index 0000000..cc6eef8 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test @@ -0,0 +1,14 @@ +--TEST-- +Twig unary operators precedence +--TEMPLATE-- +{{ -1 - 1 }} +{{ -1 - -1 }} +{{ -1 * -1 }} +{{ 4 / -1 * 5 }} +--DATA-- +return array() +--EXPECT-- +-2 +0 +1 +-20 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test new file mode 100644 index 0000000..27e93fd --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test @@ -0,0 +1,30 @@ +--TEST-- +"abs" filter +--TEMPLATE-- +{{ (-5.5)|abs }} +{{ (-5)|abs }} +{{ (-0)|abs }} +{{ 0|abs }} +{{ 5|abs }} +{{ 5.5|abs }} +{{ number1|abs }} +{{ number2|abs }} +{{ number3|abs }} +{{ number4|abs }} +{{ number5|abs }} +{{ number6|abs }} +--DATA-- +return array('number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5) +--EXPECT-- +5.5 +5 +0 +0 +5 +5.5 +5.5 +5 +0 +0 +5 +5.5 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test new file mode 100644 index 0000000..380b04b --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test @@ -0,0 +1,10 @@ +--TEST-- +"convert_encoding" filter +--CONDITION-- +function_exists('iconv') || function_exists('mb_convert_encoding') +--TEMPLATE-- +{{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }} +--DATA-- +return array() +--EXPECT-- +愛していますか? diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test new file mode 100644 index 0000000..ae6d0da --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test @@ -0,0 +1,56 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +{{ date1|date('d/m/Y H:i:s', 'Europe/Paris') }} +{{ date1|date('d/m/Y H:i:s P', 'Europe/Paris') }} +{{ date1|date('d/m/Y H:i:s P', 'America/Chicago') }} +{{ date1|date('e') }} +{{ date1|date('d/m/Y H:i:s') }} +{{ date2|date }} +{{ date2|date('d/m/Y') }} +{{ date2|date('d/m/Y H:i:s', 'Europe/Paris') }} +{{ date2|date('d/m/Y H:i:s') }} +{{ date3|date }} +{{ date3|date('d/m/Y') }} +{{ date4|date }} +{{ date4|date('d/m/Y') }} +{{ date5|date }} +{{ date5|date('d/m/Y') }} +{{ date6|date('d/m/Y H:i:s P', 'Europe/Paris') }} +{{ date6|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} +{{ date6|date('e', 'Europe/Paris') }} +{{ date6|date('e') }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), + 'date2' => new DateTime('2010-10-04 13:45'), + 'date3' => '2010-10-04 13:45', + 'date4' => 1286199900, + 'date5' => -86410, + 'date6' => new DateTime('2010-10-04 13:45', new DateTimeZone('America/New_York')), +) +--EXPECT-- +October 4, 2010 13:45 +04/10/2010 +04/10/2010 15:45:00 +04/10/2010 15:45:00 +02:00 +04/10/2010 08:45:00 -05:00 +UTC +04/10/2010 13:45:00 +October 4, 2010 13:45 +04/10/2010 +04/10/2010 15:45:00 +04/10/2010 13:45:00 +October 4, 2010 13:45 +04/10/2010 +October 4, 2010 13:45 +04/10/2010 +December 30, 1969 23:59 +30/12/1969 +04/10/2010 19:45:00 +02:00 +05/10/2010 01:45:00 +08:00 +Europe/Paris +America/New_York \ No newline at end of file diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test new file mode 100644 index 0000000..11a1ef4 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test @@ -0,0 +1,14 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); +return array( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), +) +--EXPECT-- +2010-10-04 +04/10/2010 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test new file mode 100644 index 0000000..e6d3707 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test @@ -0,0 +1,16 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date2|date }} +{{ date2|date('%d days') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); +return array( + 'date2' => new DateInterval('P2D'), +) +--EXPECT-- +2 days 0 hours +2 days diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test new file mode 100644 index 0000000..2d5adc1 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test @@ -0,0 +1,16 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date6|date }} +{{ date6|date('%d days %h hours') }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date5' => -86410, + 'date6' => new DateInterval('P2D'), +) +--EXPECT-- +2 days +2 days 0 hours diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test new file mode 100644 index 0000000..22e86e4 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test @@ -0,0 +1,150 @@ +--TEST-- +"default" filter +--TEMPLATE-- +Variable: +{{ definedVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ zeroVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ emptyVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nullVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ undefinedVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +Array access: +{{ nested.definedVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested['definedVar'] |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested.zeroVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested.emptyVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested.nullVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested.undefinedVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested['undefinedVar'] |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ undefinedVar.foo |default('default') is sameas('default') ? 'ok' : 'ko' }} +Plain values: +{{ 'defined' |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ 0 |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ '' |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ null |default('default') is sameas('default') ? 'ok' : 'ko' }} +Precedence: +{{ 'o' ~ nullVar |default('k') }} +{{ 'o' ~ nested.nullVar |default('k') }} +Object methods: +{{ object.foo |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.undefinedMethod |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ object.getFoo() |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.getFoo('a') |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.undefinedMethod() |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ object.undefinedMethod('a') |default('default') is sameas('default') ? 'ok' : 'ko' }} +Deep nested: +{{ nested.undefinedVar.foo.bar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested.definedArray.0 |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested['definedArray'][0] |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.self.foo |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.self.undefinedMethod |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ object.undefinedMethod.self |default('default') is sameas('default') ? 'ok' : 'ko' }} +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +) +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +) +--CONFIG-- +return array('strict_variables' => true) +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok diff --git a/core/modules/comment/comment.theme.css b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test similarity index 15% copy from core/modules/comment/comment.theme.css copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test index 6a32a63..93c5913 100644 --- a/core/modules/comment/comment.theme.css +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test @@ -1,12 +1,10 @@ - -/** - * @file - * Basic styling for comment module. - */ - -/** - * Indent threaded comments. - */ -.indented { - margin-left: 25px; /* LTR */ -} +--TEST-- +dynamic filter +--TEMPLATE-- +{{ 'bar'|foo_path }} +{{ 'bar'|a_foo_b_bar }} +--DATA-- +return array() +--EXPECT-- +foo/bar +a/b/bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test new file mode 100644 index 0000000..a606c10 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "foo
    "|e }} +--DATA-- +return array() +--EXPECT-- +foo <br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test new file mode 100644 index 0000000..bba26a0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "愛していますか?
    "|e }} +--DATA-- +return array() +--EXPECT-- +愛していますか? <br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test new file mode 100644 index 0000000..3690e71 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test @@ -0,0 +1,18 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{% set foo %} + foo
    +{% endset %} + +{{ foo|e('html') -}} +{{ foo|e('js') }} +{% autoescape true %} + {{ foo }} +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + foo<br /> + foo\x3cbr \x2f\x3e\x0a + foo
    diff --git a/core/lib/Drupal/Component/Uuid/Pecl.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test similarity index 7% copy from core/lib/Drupal/Component/Uuid/Pecl.php copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test index 3d4cb27..97221ff 100644 --- a/core/lib/Drupal/Component/Uuid/Pecl.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test @@ -1,21 +1,8 @@ - '%s/%d', 'foo' => 'bar') +--EXPECT-- +bar/3 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test new file mode 100644 index 0000000..8feef63 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test @@ -0,0 +1,12 @@ +--TEST-- +"join" filter +--TEMPLATE-- +{{ ["foo", "bar"]|join(', ') }} +{{ foo|join(', ') }} +{{ bar|join(', ') }} +--DATA-- +return array('foo' => new Foo(), 'bar' => new ArrayObject(array(3, 4))) +--EXPECT-- +foo, bar +1, 2 +3, 4 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test new file mode 100644 index 0000000..1738d40 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test @@ -0,0 +1,12 @@ +--TEST-- +"json_encode" filter +--TEMPLATE-- +{{ "foo"|json_encode|raw }} +{{ foo|json_encode|raw }} +{{ [foo, "foo"]|json_encode|raw }} +--DATA-- +return array('foo' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +"foo" +"foo" +["foo","foo"] diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test new file mode 100644 index 0000000..3347474 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test @@ -0,0 +1,14 @@ +--TEST-- +"length" filter +--TEMPLATE-- +{{ array|length }} +{{ string|length }} +{{ number|length }} +{{ markup|length }} +--DATA-- +return array('array' => array(1, 4), 'string' => 'foo', 'number' => 1000, 'markup' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +2 +3 +4 +3 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test new file mode 100644 index 0000000..5d5e243 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test @@ -0,0 +1,12 @@ +--TEST-- +"length" filter +--CONDITION-- +function_exists('mb_get_info') +--TEMPLATE-- +{{ string|length }} +{{ markup|length }} +--DATA-- +return array('string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +3 +3 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test new file mode 100644 index 0000000..357b352 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test @@ -0,0 +1,14 @@ +--TEST-- +"merge" filter +--TEMPLATE-- +{{ items|merge({'bar': 'foo'})|join }} +{{ items|merge({'bar': 'foo'})|keys|join }} +{{ {'bar': 'foo'}|merge(items)|join }} +{{ {'bar': 'foo'}|merge(items)|keys|join }} +--DATA-- +return array('items' => array('foo' => 'bar')) +--EXPECT-- +barfoo +foobar +foobar +barfoo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test new file mode 100644 index 0000000..6545a9b --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test @@ -0,0 +1,14 @@ +--TEST-- +"nl2br" filter +--TEMPLATE-- +{{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }} +{{ text|nl2br }} +--DATA-- +return array('text' => "If you have some HTML\nit will be escaped.") +--EXPECT-- +I like Twig.
    +You will like it too.
    +
    +Everybody like it! +If you have some <strong>HTML</strong>
    +it will be escaped. diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test new file mode 100644 index 0000000..639a865 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test @@ -0,0 +1,18 @@ +--TEST-- +"number_format" filter +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(2) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +return array(); +--EXPECT-- +20 +20 +20.25 +20,25 +1,020,25 +1.020,25 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test new file mode 100644 index 0000000..c6903cc --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test @@ -0,0 +1,21 @@ +--TEST-- +"number_format" filter with defaults. +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(1) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +$twig->getExtension('core')->setNumberFormat(2, '!', '='); +return array(); +--EXPECT-- +20!00 +20!25 +20!3 +20,25 +1=020!25 +1=020,25 +1.020,25 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test new file mode 100644 index 0000000..4021660 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test @@ -0,0 +1,8 @@ +--TEST-- +"replace" filter +--TEMPLATE-- +{{ "I like %this% and %that%."|replace({'%this%': "foo", '%that%': "bar"}) }} +--DATA-- +return array() +--EXPECT-- +I like foo and bar. diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Bar.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test similarity index 11% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Bar.php rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test index 676daad..3c5f410 100644 --- a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/alpha/PrefixCollision/A/Bar.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test @@ -1,6 +1,12 @@ - new ArrayObject(array(1, 2, 3, 4))) +--EXPECT-- +4321 +tnemenèvé4321 +4321 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test new file mode 100644 index 0000000..bb32dfb --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test @@ -0,0 +1,40 @@ +--TEST-- +"slice" filter +--TEMPLATE-- +{{ [1, 2, 3, 4][1:2]|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}[1:2]|join('') }} +{{ [1, 2, 3, 4][start:length]|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|keys|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2, true)|keys|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|keys|join('') }} +{{ '1234'|slice(1, 2) }} +{{ '1234'[1:2] }} +{{ arr|slice(1, 2)|join('') }} +{{ arr[1:2]|join('') }} + +{{ [1, 2, 3, 4]|slice(1)|join('') }} +{{ [1, 2, 3, 4][1:]|join('') }} +{{ '1234'|slice(1) }} +{{ '1234'[1:] }} +--DATA-- +return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4))) +--EXPECT-- +23 +23 +23 +23 +01 +12 +23 +bc +23 +23 +23 +23 + +234 +234 +234 +234 diff --git a/core/modules/file/icons/x-office-spreadsheet.png b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test similarity index 12% copy from core/modules/file/icons/x-office-spreadsheet.png copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test index 9af7b61..21d575f 100644 Binary files a/core/modules/file/icons/x-office-spreadsheet.png and b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test differ diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test new file mode 100644 index 0000000..cc91900 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"☃" custom filter +--TEMPLATE-- +{{ 'foo'|☃ }} +--DATA-- +return array() +--EXPECT-- +☃foo☃ diff --git a/core/modules/system/tests/themes/test_theme/test_theme.info b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test similarity index 6% copy from core/modules/system/tests/themes/test_theme/test_theme.info copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test index b5d1bfc..3192062 100644 --- a/core/modules/system/tests/themes/test_theme/test_theme.info +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test @@ -1,18 +1,12 @@ -name = Test theme -description = Theme for testing the theme system -core = 8.x -hidden = TRUE - -; Normally, themes may list CSS files like this, and if they exist in the theme -; folder, then they get added to the page. If they have the same file name as a -; module CSS file, then the theme's version overrides the module's version, so -; that the module's version is not added to the page. Additionally, a theme may -; have an entry like this one, without having the corresponding CSS file in the -; theme's folder, and in this case, it just stops the module's version from -; being loaded, and does not replace it with an alternate version. We have this -; here in order for a test to ensure that this correctly prevents the module -; version from being loaded, and that errors aren't caused by the lack of this -; file within the theme folder. -stylesheets[all][] = system.base.css - -settings[theme_test_setting] = default value +--TEST-- +"trim" filter +--TEMPLATE-- +{{ " I like Twig. "|trim }} +{{ text|trim }} +{{ " foo/"|trim("/") }} +--DATA-- +return array('text' => " If you have some HTML it will be escaped. ") +--EXPECT-- +I like Twig. +If you have some <strong>HTML</strong> it will be escaped. + foo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test new file mode 100644 index 0000000..ba7d5e8 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test @@ -0,0 +1,12 @@ +--TEST-- +"attribute" function +--TEMPLATE-- +{{ attribute(obj, method) }} +{{ attribute(array, item) }} +{{ attribute(obj, "bar", ["a", "b"]) }} +--DATA-- +return array('obj' => new Foo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo') +--EXPECT-- +foo +bar +bar_a-b diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test new file mode 100644 index 0000000..8e54059 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test @@ -0,0 +1,12 @@ +--TEST-- +"block" function +--TEMPLATE-- +{% extends 'base.twig' %} +{% block bar %}BAR{% endblock %} +--TEMPLATE(base.twig)-- +{% block foo %}{{ block('bar') }}{% endblock %} +{% block bar %}BAR_BASE{% endblock %} +--DATA-- +return array() +--EXPECT-- +BARBAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test new file mode 100644 index 0000000..6d4b374 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test @@ -0,0 +1,12 @@ +--TEST-- +"constant" function +--TEMPLATE-- +{% if constant('DATE_W3C') == expect %} +true +{% else %} +false +{% endif %} +--DATA-- +return array('expect' => DATE_W3C); +--EXPECT-- +true diff --git a/core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.info b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test similarity index 5% copy from core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.info copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test index 9b66cf0..522a63b 100644 --- a/core/modules/system/tests/modules/system_incompatible_core_version_dependencies_test/system_incompatible_core_version_dependencies_test.info +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test @@ -1,7 +1,16 @@ -name = "System incompatible core version dependencies test" -description = "Support module for testing system dependencies." -package = Testing -version = VERSION -core = 8.x -hidden = TRUE -dependencies[] = system_incompatible_core_version_test +--TEST-- +"cycle" function +--TEMPLATE-- +{% for i in 0..6 %} +{{ cycle(array1, i) }}-{{ cycle(array2, i) }} +{% endfor %} +--DATA-- +return array('array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus')) +--EXPECT-- +odd-apple +even-orange +odd-citrus +even-apple +odd-orange +even-citrus +odd-apple diff --git a/core/misc/message-16-help.png b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test similarity index 8% copy from core/misc/message-16-help.png copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test index fc44326..caeee7a 100644 Binary files a/core/misc/message-16-help.png and b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test differ diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test new file mode 100644 index 0000000..371a587 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test @@ -0,0 +1,14 @@ +--TEST-- +"dump" function +--TEMPLATE-- +{{ dump('foo') }} +{{ dump('foo', 'bar') }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--CONFIG-- +return array('debug' => true, 'autoescape' => false); +--EXPECT-- +string(3) "foo" + +string(3) "foo" +string(3) "bar" diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test new file mode 100644 index 0000000..889b7a9 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test @@ -0,0 +1,19 @@ +--TEST-- +"dump" function, xdebug is not loaded or xdebug <2.2-dev is loaded +--CONDITION-- +!extension_loaded('xdebug') || (($r = new ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) +--TEMPLATE-- +{{ dump() }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--CONFIG-- +return array('debug' => true, 'autoescape' => false); +--EXPECT-- +array(3) { + ["foo"]=> + string(3) "foo" + ["bar"]=> + string(3) "bar" + ["global"]=> + string(6) "global" +} diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test new file mode 100644 index 0000000..913fbc9 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test @@ -0,0 +1,10 @@ +--TEST-- +dynamic function +--TEMPLATE-- +{{ foo_path('bar') }} +{{ a_foo_b_bar('bar') }} +--DATA-- +return array() +--EXPECT-- +foo/bar +a/b/bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test new file mode 100644 index 0000000..f602b0d --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"☃" custom function +--TEMPLATE-- +{{ ☃('foo') }} +--DATA-- +return array() +--EXPECT-- +☃foo☃ diff --git a/core/modules/poll/poll.admin.css b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test similarity index 5% copy from core/modules/poll/poll.admin.css copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test index f118de3..6a366cd 100644 --- a/core/modules/poll/poll.admin.css +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test @@ -1,17 +1,22 @@ +--TEST-- +macro +--TEMPLATE-- +{% import _self as test %} +{% from _self import test %} -/** - * @file - * Admin stylesheet for the Poll module. - */ +{% macro test(a, b) -%} + {{ a|default('a') }}
    + {{- b|default('b') }}
    +{%- endmacro %} -.node-form #edit-poll-more { - margin: 0; -} -.node-form #poll-choice-table .form-text { - display: inline; - width: auto; -} -.node-form #poll-choice-table td.choice-flag { - white-space: nowrap; - width: 4em; -} +{{ test.test() }} +{{ test() }} +{{ test.test(1, "c") }} +{{ test(1, "c") }} +--DATA-- +return array(); +--EXPECT-- +a
    b
    +a
    b
    +1
    c
    +1
    c
    diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test new file mode 100644 index 0000000..685626f --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test @@ -0,0 +1,14 @@ +--TEST-- +macro with a filter +--TEMPLATE-- +{% import _self as test %} + +{% macro test() %} + {% filter escape %}foo
    {% endfilter %} +{% endmacro %} + +{{ test.test() }} +--DATA-- +return array(); +--EXPECT-- +foo<br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test new file mode 100644 index 0000000..65f6cd2 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test @@ -0,0 +1,8 @@ +--TEST-- +Twig outputs 0 nodes correctly +--TEMPLATE-- +{{ foo }}0{{ foo }} +--DATA-- +return array('foo' => 'foo') +--EXPECT-- +foo0foo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test new file mode 100644 index 0000000..110aef8 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test @@ -0,0 +1,17 @@ +--TEST-- +Twig is able to deal with SimpleXMLElement instances as variables +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +Hello '{{ images.image.0.group }}'! +{{ images.children().count() }} +{% for image in images %} + - {{ image.group }} +{% endfor %} +--DATA-- +return array('images' => new SimpleXMLElement('foobar')) +--EXPECT-- +Hello 'foo'! +2 + - foo + - bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test new file mode 100644 index 0000000..e18e110 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test @@ -0,0 +1,8 @@ +--TEST-- +Twig does not confuse strings with integers in getAttribute() +--TEMPLATE-- +{{ hash['2e2'] }} +--DATA-- +return array('hash' => array('2e2' => 'works')) +--EXPECT-- +works diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test new file mode 100644 index 0000000..2f6a3e1 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping on its children +--TEMPLATE-- +{% autoescape %} +{{ var }}
    +{% endautoescape %} +{% autoescape 'html' %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +{% autoescape true %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br />
    +<br />
    +

    +<br />
    +

    diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test new file mode 100644 index 0000000..05ab83c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test @@ -0,0 +1,12 @@ +--TEST-- +"autoescape" tag applies escaping on embedded blocks +--TEMPLATE-- +{% autoescape 'html' %} + {% block foo %} + {{ var }} + {% endblock %} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test new file mode 100644 index 0000000..9c09724 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not double-escape +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|escape }} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test new file mode 100644 index 0000000..864655c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test @@ -0,0 +1,83 @@ +--TEST-- +"autoescape" tag applies escaping after calling functions +--TEMPLATE-- + +autoescape false +{% autoescape false %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +{% endautoescape %} + +autoescape 'html' +{% autoescape 'html' %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +unsafe_br()|raw +{{ (unsafe_br())|raw }} + +safe_br()|escape +{{ (safe_br())|escape }} + +safe_br()|raw +{{ (safe_br())|raw }} + +unsafe_br()|escape +{{ (unsafe_br())|escape }} + +{% endautoescape %} + +autoescape js +{% autoescape 'js' %} + +safe_br +{{ safe_br() }} + +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + +autoescape false + +safe_br +
    + +unsafe_br +
    + + +autoescape 'html' + +safe_br +
    + +unsafe_br +<br /> + +unsafe_br()|raw +
    + +safe_br()|escape +<br /> + +safe_br()|raw +
    + +unsafe_br()|escape +<br /> + + +autoescape js + +safe_br +\x3cbr \x2f\x3e diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test new file mode 100644 index 0000000..775bfd0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test @@ -0,0 +1,45 @@ +--TEST-- +"autoescape" tag does not apply escaping on literals +--TEMPLATE-- +{% autoescape 'html' %} + +1. Simple literal +{{ "
    " }} + +2. Conditional expression with only literals +{{ true ? "
    " : "
    " }} + +3. Conditonal expression with a variable +{{ true ? "
    " : someVar }} + +4. Nested conditionals with only literals +{{ true ? (true ? "
    " : "
    ") : "\n" }} + +5. Nested conditionals with a variable +{{ true ? (true ? "
    " : someVar) : "\n" }} + +6. Nested conditionals with a variable marked safe +{{ true ? (true ? "
    " : someVar|raw) : "\n" }} + +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + +1. Simple literal +
    + +2. Conditional expression with only literals +
    + +3. Conditonal expression with a variable +<br /> + +4. Nested conditionals with only literals +
    + +5. Nested conditionals with a variable +<br /> + +6. Nested conditionals with a variable marked safe +
    diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test new file mode 100644 index 0000000..798e6fe --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tags can be nested at will +--TEMPLATE-- +{{ var }} +{% autoescape 'html' %} + {{ var }} + {% autoescape false %} + {{ var }} + {% autoescape 'html' %} + {{ var }} + {% endautoescape %} + {{ var }} + {% endautoescape %} + {{ var }} +{% endautoescape %} +{{ var }} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> + <br /> +
    + <br /> +
    + <br /> +<br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test new file mode 100644 index 0000000..e896aa4 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping to object method calls +--TEMPLATE-- +{% autoescape 'html' %} +{{ user.name }} +{{ user.name|lower }} +{{ user }} +{% endautoescape %} +--DATA-- +class UserForAutoEscapeTest +{ + public function getName() + { + return 'Fabien
    '; + } + + public function __toString() + { + return 'Fabien
    '; + } +} +return array('user' => new UserForAutoEscapeTest()) +--EXPECT-- +Fabien<br /> +fabien<br /> +Fabien<br /> diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test new file mode 100644 index 0000000..9f1cedd --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not escape when raw is used as a filter +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|raw }} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +
    diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test new file mode 100644 index 0000000..101d5af --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test @@ -0,0 +1,17 @@ +--TEST-- +"autoescape" tag accepts an escaping strategy +--TEMPLATE-- +{% autoescape true js %}{{ var }}{% endautoescape %} + +{% autoescape true html %}{{ var }}{% endautoescape %} + +{% autoescape 'js' %}{{ var }}{% endautoescape %} + +{% autoescape 'html' %}{{ var }}{% endautoescape %} +--DATA-- +return array('var' => '
    "') +--EXPECT-- +\x3cbr \x2f\x3e\x22 +<br />" +\x3cbr \x2f\x3e\x22 +<br />" diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test new file mode 100644 index 0000000..10fd63f --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test @@ -0,0 +1,69 @@ +--TEST-- +escape types +--TEMPLATE-- + +1. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +2. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +3. autoescape 'js' |escape('js') + +{% autoescape 'js' %} + +{% endautoescape %} + +4. no escape + +{% autoescape false %} + +{% endautoescape %} + +5. |escape('js')|escape('html') + +{% autoescape false %} + +{% endautoescape %} + +6. autoescape 'html' |escape('js')|escape('html') + +{% autoescape 'html' %} + +{% endautoescape %} + +--DATA-- +return array('msg' => "<>\n'\"") +--EXPECT-- + +1. autoescape 'html' |escape('js') + + + +2. autoescape 'html' |escape('js') + + + +3. autoescape 'js' |escape('js') + + + +4. no escape + + + +5. |escape('js')|escape('html') + + + +6. autoescape 'html' |escape('js')|escape('html') + + + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test new file mode 100644 index 0000000..7821a9a --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test @@ -0,0 +1,131 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters +--TEMPLATE-- +{% autoescape 'html' %} + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +{{ var|escape_and_nl2br }} + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +{{ var|escape_and_nl2br|raw }} + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +{{ var|escape_and_nl2br|escape }} + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +{{ var|upper }} + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +{{ var|escape_and_nl2br|upper }} + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +{{ var|upper|escape_and_nl2br }} + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +{{ "%s"|format(var) }} + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +{{ "%s"|raw|format(var) }} + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) +{{ "%s"|format(var)|raw }} + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) +{{ "%s"|format(var|raw)|raw }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +<Fabien>
    +Twig + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +<Fabien>
    +Twig + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +&lt;Fabien&gt;<br /> +Twig + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +<FABIEN> +TWIG + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +&LT;FABIEN&GT;<BR /> +TWIG + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +<FABIEN>
    +TWIG + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) + +Twig + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) + +Twig diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test new file mode 100644 index 0000000..f58a1e0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test @@ -0,0 +1,23 @@ +--TEST-- +"autoescape" tag do not applies escaping on filter arguments +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|nl2br("
    ") }} +{{ var|nl2br("
    "|escape) }} +{{ var|nl2br(sep) }} +{{ var|nl2br(sep|raw) }} +{{ var|nl2br(sep|escape) }} +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig", 'sep' => '
    ') +--EXPECT-- +<Fabien>
    +Twig +<Fabien><br /> +Twig +<Fabien>
    +Twig +<Fabien>
    +Twig +<Fabien><br /> +Twig diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test new file mode 100644 index 0000000..134c77e --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test @@ -0,0 +1,68 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters, and before calling pre_escape filters +--TEMPLATE-- +{% autoescape 'html' %} + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +{{ var|nl2br }} + +2. Don't double-pre-escape +( var|escape|nl2br ) +{{ var|escape|nl2br }} + +3. Don't escape safe values +( var|raw|nl2br ) +{{ var|raw|nl2br }} + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +{{ var|nl2br|nl2br }} + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +{{ var|escape_something|nl2br }} + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +{{ var|nl2br|upper }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +2. Don't double-pre-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +3. Don't escape safe values +( var|raw|nl2br ) +
    +Twig + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +<Fabien>

    +Twig + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +<FABIEN>
    +TWIG + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +&LT;FABIEN&GT;<BR /> +TWIG + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test new file mode 100644 index 0000000..32d3943 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test @@ -0,0 +1,50 @@ +--TEST-- +"autoescape" tag handles filters preserving the safety +--TEMPLATE-- +{% autoescape 'html' %} + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +{{ var|preserves_safety }} + +2. Safe values are still safe +( var|escape|preserves_safety ) +{{ var|escape|preserves_safety }} + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +{{ var|escape_something|preserves_safety }} + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +{{ var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'}) }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +<FABIEN> +TWIG + +2. Safe values are still safe +( var|escape|preserves_safety ) +<FABIEN> +TWIG + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +<FABIEN> +TWIG + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +&LT;FABPOT&GT; +TWIG + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test new file mode 100644 index 0000000..360dcf0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block title1 %}FOO{% endblock %} +{% block title2 foo|lower %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array('foo' => 'bar') +--EXPECT-- +FOObar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test new file mode 100644 index 0000000..5c205c0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + {% block content %} + {% endblock %} +{% endblock %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: The block 'content' has already been defined line 2 in "index.twig" at line 3 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test new file mode 100644 index 0000000..441570c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test @@ -0,0 +1,10 @@ +--TEST-- +"☃" special chars in a block name +--TEMPLATE-- +{% block ☃ %} +☃ +{% endblock ☃ %} +--DATA-- +return array() +--EXPECT-- +☃ diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test new file mode 100644 index 0000000..f44296e --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test @@ -0,0 +1,35 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test new file mode 100644 index 0000000..da161e6 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test @@ -0,0 +1,50 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test new file mode 100644 index 0000000..cf7953d --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test @@ -0,0 +1,57 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +{% extends "base.twig" %} + +{% block c1 %} + {{ parent() }} + blockc1baseextended +{% endblock %} + +{% block c2 %} + {{ parent() }} + + {% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} + {% endembed %} +{% endblock %} +--TEMPLATE(base.twig)-- +A +{% block c1 %} + blockc1base +{% endblock %} +{% block c2 %} + blockc2base +{% endblock %} +B +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +A + blockc1base + + blockc1baseextended + blockc2base + + + +A + block1 + + block1extended + B + block2 +CB \ No newline at end of file diff --git a/core/lib/Drupal/Core/Database/Query/FieldsOverlapException.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test similarity index 5% copy from core/lib/Drupal/Core/Database/Query/FieldsOverlapException.php copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test index f9d9372..82094f2 100644 --- a/core/lib/Drupal/Core/Database/Query/FieldsOverlapException.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test @@ -1,20 +1,10 @@ - 'var') +--EXPECT-- +SOME TEXT WITH A VAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test new file mode 100644 index 0000000..3e7148b --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test @@ -0,0 +1,8 @@ +--TEST-- +"filter" tag applies a filter on its children +--TEMPLATE-- +{% filter json_encode|raw %}test{% endfilter %} +--DATA-- +return array() +--EXPECT-- +"test" diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test new file mode 100644 index 0000000..75512ef --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test @@ -0,0 +1,10 @@ +--TEST-- +"filter" tags accept multiple chained filters +--TEMPLATE-- +{% filter lower|title %} + {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'VAR') +--EXPECT-- + Var diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test new file mode 100644 index 0000000..7e4e4eb --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test @@ -0,0 +1,16 @@ +--TEST-- +"filter" tags can be nested at will +--TEMPLATE-- +{% filter lower|title %} + {{ var }} + {% filter upper %} + {{ var }} + {% endfilter %} + {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'var') +--EXPECT-- + Var + Var + Var diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test new file mode 100644 index 0000000..22745ea --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test @@ -0,0 +1,13 @@ +--TEST-- +"filter" tag applies the filter on "for" tags +--TEMPLATE-- +{% filter upper %} +{% for item in items %} +{{ item }} +{% endfor %} +{% endfilter %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- +A +B diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test new file mode 100644 index 0000000..afd95b2 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test @@ -0,0 +1,29 @@ +--TEST-- +"filter" tag applies the filter on "if" tags +--TEMPLATE-- +{% filter upper %} +{% if items %} +{{ items|join(', ') }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% else %} +{{ items.1 }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% elseif items.1 %} +{{ items.0 }} +{% endif %} + +{% endfilter %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- +A, B + +B + +A diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test new file mode 100644 index 0000000..9e4eb9b --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test @@ -0,0 +1,14 @@ +--TEST-- +"for" tag takes a condition +--TEMPLATE-- +{% for i in 1..5 if i is odd -%} + {{ loop.index }}.{{ i }} +{% endfor %} +--DATA-- +return array() +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +1.1 +2.3 +3.5 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test new file mode 100644 index 0000000..ddc6930 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tag keeps the context safe +--TEMPLATE-- +{% for item in items %} + {% for item in items %} + * {{ item }} + {% endfor %} + * {{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b + * a + * a + * b + * b diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test new file mode 100644 index 0000000..20ccc88 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test @@ -0,0 +1,23 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% else %} + no item +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b +--DATA-- +return array('items' => array()) +--EXPECT-- + no item +--DATA-- +return array() +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- + no item diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test new file mode 100644 index 0000000..49fb9ca --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag does not reset inner variables +--TEMPLATE-- +{% for i in 1..2 %} + {% for j in 0..2 %} + {{k}}{% set k = k+1 %} {{ loop.parent.loop.index }} + {% endfor %} +{% endfor %} +--DATA-- +return array('k' => 0) +--EXPECT-- + 0 1 + 1 1 + 2 1 + 3 2 + 4 2 + 5 2 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test new file mode 100644 index 0000000..4e22cb4 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys +--TEMPLATE-- +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 0 + * 1 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test new file mode 100644 index 0000000..4c21168 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys and values +--TEMPLATE-- +{% for key, item in items %} + * {{ key }}/{{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 0/a + * 1/b diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test new file mode 100644 index 0000000..93bc76a --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test @@ -0,0 +1,19 @@ +--TEST-- +"for" tag adds a loop variable to the context +--TEMPLATE-- +{% for item in items %} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 1/0 + * 2/1 + * 1//2 + + * 2/1 + * 1/0 + * /1/2 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test new file mode 100644 index 0000000..58af2c3 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test @@ -0,0 +1,10 @@ +--TEST-- +"for" tag adds a loop variable to the context locally +--TEMPLATE-- +{% for item in items %} +{% endfor %} +{% if loop is not defined %}WORKS{% endif %} +--DATA-- +return array('items' => array()) +--EXPECT-- +WORKS diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test new file mode 100644 index 0000000..f8b9f6b --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + {% for item in items1 %} + * {{ item }} + {% else %} + no {{ item }} + {% endfor %} +{% else %} + no item1 +{% endfor %} +--DATA-- +return array('items' => array('a', 'b'), 'items1' => array()) +--EXPECT-- +no a + no b diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test new file mode 100644 index 0000000..5034437 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test @@ -0,0 +1,43 @@ +--TEST-- +"for" tag iterates over iterable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.first }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIterator implements Iterator +{ + protected $values = array('foo' => 'bar', 'bar' => 'foo'); + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } +} +return array('items' => new ItemsIterator()) +--EXPECT-- + * bar + * 1/0 + * 1 + + * foo + * 2/1 + * + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test new file mode 100644 index 0000000..4a1ff61 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test @@ -0,0 +1,47 @@ +--TEST-- +"for" tag iterates over iterable and countable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIteratorCountable implements Iterator, Countable +{ + protected $values = array('foo' => 'bar', 'bar' => 'foo'); + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } + public function count() { return count($this->values); } +} +return array('items' => new ItemsIteratorCountable()) +--EXPECT-- + * bar + * 1/0 + * 2/1 + * 1//2 + + * foo + * 2/1 + * 1/0 + * /1/2 + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test new file mode 100644 index 0000000..17b2e22 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tags can be nested +--TEMPLATE-- +{% for key, item in items %} +* {{ key }} ({{ loop.length }}): +{% for value in item %} + * {{ value }} ({{ loop.length }}) +{% endfor %} +{% endfor %} +--DATA-- +return array('items' => array('a' => array('a1', 'a2', 'a3'), 'b' => array('b1'))) +--EXPECT-- +* a (2): + * a1 (3) + * a2 (3) + * a3 (3) +* b (2): + * b1 (1) diff --git a/core/vendor/Twig/Test/Function.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test similarity index 6% rename from core/vendor/Twig/Test/Function.php rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test index 1240a0f..82f2ae8 100644 --- a/core/vendor/Twig/Test/Function.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test @@ -1,31 +1,11 @@ - - */ -class Twig_Test_Function implements Twig_TestInterface -{ - protected $function; - - public function __construct($function) - { - $this->function = $function; - } - - public function compile() - { - return $this->function; - } -} +--TEST-- +"for" tag iterates over item values +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test new file mode 100644 index 0000000..5f5da0e --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test @@ -0,0 +1,14 @@ +--TEST-- +global variables +--TEMPLATE-- +{% include "included.twig" %} +{% from "included.twig" import foobar %} +{{ foobar() }} +--TEMPLATE(included.twig)-- +{% macro foobar() %} +called foobar +{% endmacro %} +--DATA-- +return array(); +--EXPECT-- +called foobar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test new file mode 100644 index 0000000..c1c3d27 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test @@ -0,0 +1,22 @@ +--TEST-- +"if" creates a condition +--TEMPLATE-- +{% if a is defined %} + {{ a }} +{% elseif b is defined %} + {{ b }} +{% else %} + NOTHING +{% endif %} +--DATA-- +return array('a' => 'a') +--EXPECT-- + a +--DATA-- +return array('b' => 'b') +--EXPECT-- + b +--DATA-- +return array() +--EXPECT-- + NOTHING diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test new file mode 100644 index 0000000..edfb73d --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test @@ -0,0 +1,22 @@ +--TEST-- +"if" takes an expression as a test +--TEMPLATE-- +{% if a < 2 %} + A1 +{% elseif a > 10 %} + A2 +{% else %} + A3 +{% endif %} +--DATA-- +return array('a' => 1) +--EXPECT-- + A1 +--DATA-- +return array('a' => 12) +--EXPECT-- + A2 +--DATA-- +return array('a' => 7) +--EXPECT-- + A3 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test new file mode 100644 index 0000000..8fe1a6c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag +--TEMPLATE-- +FOO +{% include "foo.twig" %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array() +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test new file mode 100644 index 0000000..eaeeb11 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag allows expressions for the template to include +--TEMPLATE-- +FOO +{% include foo %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array('foo' => 'foo.twig') +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test new file mode 100644 index 0000000..24aed06 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test @@ -0,0 +1,10 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] ignore missing %} +{% include "foo.twig" ignore missing %} +{% include "foo.twig" ignore missing with {} %} +{% include "foo.twig" ignore missing with {} only %} +--DATA-- +return array() +--EXPECT-- diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test new file mode 100644 index 0000000..77760a0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag accept variables and only +--TEMPLATE-- +{% include "foo.twig" %} +{% include "foo.twig" only %} +{% include "foo.twig" with {'foo1': 'bar'} %} +{% include "foo.twig" with {'foo1': 'bar'} only %} +--TEMPLATE(foo.twig)-- +{% for k, v in _context %}{{ k }},{% endfor %} +--DATA-- +return array('foo' => 'bar') +--EXPECT-- +foo,global,_parent, +global,_parent, +foo,global,foo1,_parent, +foo1,global,_parent, diff --git a/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test similarity index 12% copy from core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test index 94a2b2c..6ba064a 100644 --- a/core/modules/system/tests/modules/common_test_cron_helper/common_test_cron_helper.module +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test @@ -1,17 +1,10 @@ - $twig->loadTemplate('foo.twig')) +--EXPECT-- +BAR FOO diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test new file mode 100644 index 0000000..ab670ee --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] %} +{% include ["bar.twig", "foo.twig"] %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return array() +--EXPECT-- +foo +foo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test new file mode 100644 index 0000000..41384ac --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test @@ -0,0 +1,12 @@ +--TEST-- +"include" tag accept variables +--TEMPLATE-- +{% include "foo.twig" with {'foo': 'bar'} %} +{% include "foo.twig" with vars %} +--TEMPLATE(foo.twig)-- +{{ foo }} +--DATA-- +return array('vars' => array('foo' => 'bar')) +--EXPECT-- +bar +bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test new file mode 100644 index 0000000..0778a4b --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array() +--EXPECT-- +FOO diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test new file mode 100644 index 0000000..8576e77 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends standalone ? foo : 'bar.twig' %} + +{% block content %}{{ parent() }}FOO{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--TEMPLATE(bar.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array('foo' => 'foo.twig', 'standalone' => true) +--EXPECT-- +FOOFOO diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test new file mode 100644 index 0000000..ee06ddc --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array('foo' => 'foo.twig') +--EXPECT-- +FOO diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test new file mode 100644 index 0000000..784f357 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test @@ -0,0 +1,10 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--DATA-- +return array() +--EXPECT-- +FOO diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test new file mode 100644 index 0000000..a1cb1ce --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends ["foo.twig", "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test new file mode 100644 index 0000000..dfc2b6c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %}{% block content %}{{ parent() }}index {% endblock %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %}{% block content %}{{ parent() }}layout {% endblock %} +--TEMPLATE(base.twig)-- +{% block content %}base {% endblock %} +--DATA-- +return array() +--EXPECT-- +base layout index diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test new file mode 100644 index 0000000..faca925 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test @@ -0,0 +1,22 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} + {% block subcontent %} + {% block subsubcontent %} + SUBSUBCONTENT + {% endblock %} + {% endblock %} +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %} + {% block subcontent %} + SUBCONTENT + {% endblock %} +{% endblock %} +--DATA-- +return array() +--EXPECT-- +SUBSUBCONTENT diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test new file mode 100644 index 0000000..0ad11d0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test @@ -0,0 +1,15 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + CONTENT + {%- block subcontent -%} + SUBCONTENT + {%- endblock -%} + ENDCONTENT +{% endblock %} +--TEMPLATE(foo.twig)-- +--DATA-- +return array() +--EXPECT-- +CONTENTSUBCONTENTENDCONTENT diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test new file mode 100644 index 0000000..71e3cdf --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %} +{% block inside %}INSIDE{% endblock inside %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %} +{% block body %} + {% block inside '' %} +{% endblock body %} +--TEMPLATE(base.twig)-- +{% block body '' %} +--DATA-- +return array() +--EXPECT-- +INSIDE diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test new file mode 100644 index 0000000..4f975db --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %}{{ parent() }}FOO{{ parent() }}{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array() +--EXPECT-- +BARFOOBAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test new file mode 100644 index 0000000..a8bc90c --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo ? 'foo.twig' : 'bar.twig' %} +--TEMPLATE(foo.twig)-- +FOO +--TEMPLATE(bar.twig)-- +BAR +--DATA-- +return array('foo' => true) +--EXPECT-- +FOO +--DATA-- +return array('foo' => false) +--EXPECT-- +BAR diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test new file mode 100644 index 0000000..c9e86b1 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test @@ -0,0 +1,8 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% block content %} + {% extends "foo.twig" %} +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Cannot extend from a block in "index.twig" at line 3 diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Bar.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test similarity index 6% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Bar.php rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test index f313438..6281671 100644 --- a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/beta/PrefixCollision/C/B/Bar.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test @@ -1,6 +1,20 @@ - $twig->loadTemplate('foo.twig')) +--EXPECT-- +BARFOO diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test new file mode 100644 index 0000000..8f9ece7 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test @@ -0,0 +1,44 @@ +--TEST-- +"parent" function +--TEMPLATE-- +{% extends "parent.twig" %} + +{% use "use1.twig" %} +{% use "use2.twig" %} + +{% block content_parent %} + {{ parent() }} +{% endblock %} + +{% block content_use1 %} + {{ parent() }} +{% endblock %} + +{% block content_use2 %} + {{ parent() }} +{% endblock %} + +{% block content %} + {{ block('content_use1_only') }} + {{ block('content_use2_only') }} +{% endblock %} +--TEMPLATE(parent.twig)-- +{% block content_parent 'content_parent' %} +{% block content_use1 'content_parent' %} +{% block content_use2 'content_parent' %} +{% block content '' %} +--TEMPLATE(use1.twig)-- +{% block content_use1 'content_use1' %} +{% block content_use2 'content_use1' %} +{% block content_use1_only 'content_use1_only' %} +--TEMPLATE(use2.twig)-- +{% block content_use2 'content_use2' %} +{% block content_use2_only 'content_use2_only' %} +--DATA-- +return array() +--EXPECT-- + content_parent + content_use1 + content_use2 + content_use1_only + content_use2_only diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test new file mode 100644 index 0000000..ef59a57 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test @@ -0,0 +1,15 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{{ _self.input('username') }} +{{ _self.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test new file mode 100644 index 0000000..fa81189 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test @@ -0,0 +1,14 @@ +--TEST-- +"macro" tag supports name for endmacro +--TEMPLATE-- +{{ _self.foo() }} +{{ _self.bar() }} + +{% macro foo() %}foo{% endmacro %} +{% macro bar() %}bar{% endmacro bar %} +--DATA-- +return array() +--EXPECT-- +foo +bar + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test new file mode 100644 index 0000000..5cd3dae --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import 'forms.twig' as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} +--TEMPLATE(forms.twig)-- +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test new file mode 100644 index 0000000..205f591 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test @@ -0,0 +1,18 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} +{% from 'forms.twig' import foo as foobar, bar %} + +{{ foo('foo') }} +{{ foobar('foo') }} +{{ bar('foo') }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}foo{{ name }}{% endmacro %} +{% macro bar(name) %}bar{{ name }}{% endmacro %} +--DATA-- +return array() +--EXPECT-- +foofoo +foofoo +barfoo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test new file mode 100644 index 0000000..6b37176 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test @@ -0,0 +1,14 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} + +{{ foo('foo') }} +{{ foo() }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}{{ name|default('foo') }}{{ global }}{% endmacro %} +--DATA-- +return array() +--EXPECT-- +fooglobal +fooglobal diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test new file mode 100644 index 0000000..17756cb --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import _self as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test new file mode 100644 index 0000000..e61716e --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test @@ -0,0 +1,12 @@ +--TEST-- +"☃" as a macro name +--TEMPLATE-- +{{ _self.☃('foo') }} + +{% macro ☃(foo) %} + ☃{{ foo }}☃ +{% endmacro %} +--DATA-- +return array() +--EXPECT-- +☃foo☃ diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.test new file mode 100644 index 0000000..0445e85 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +{% raw %} +{{ foo }} +{% endraw %} +--DATA-- +return array() +--EXPECT-- +{{ foo }} diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.test similarity index 12% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.test index 1bb7c30..352bb18 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Fixtures/graphviz/services1.dot +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.test @@ -1,7 +1,56 @@ -digraph sc { - ratio="compress" - node [fontsize="11" fontname="Arial" shape="record"]; - edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; +--TEST-- +"raw" tag +--TEMPLATE-- +1*** - node_service_container [label="service_container\nSymfony\\Component\\DependencyInjection\\ContainerBuilder\n", shape=record, fillcolor="#9999ff", style="filled"]; -} +{%- raw %} + {{ 'bla' }} +{% endraw %} + +1*** +2*** + +{%- raw -%} + {{ 'bla' }} +{% endraw %} + +2*** +3*** + +{%- raw -%} + {{ 'bla' }} +{% endraw -%} + +3*** +4*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw %} + +4*** +5*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw -%} + +5*** +--DATA-- +return array() +--EXPECT-- +1*** + {{ 'bla' }} + + +1*** +2***{{ 'bla' }} + + +2*** +3***{{ 'bla' }} +3*** +4***{{ 'bla' }} + +4*** +5***{{ 'bla' }}5*** diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test new file mode 100644 index 0000000..683c59a --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test @@ -0,0 +1,11 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} + a +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4 diff --git a/core/vendor/Symfony/Component/Routing/RouteCompilerInterface.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test similarity index 5% rename from core/vendor/Symfony/Component/Routing/RouteCompilerInterface.php rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test index 5193665..3dcfa88 100644 --- a/core/vendor/Symfony/Component/Routing/RouteCompilerInterface.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test @@ -1,29 +1,14 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Routing; - -/** - * RouteCompilerInterface is the interface that all RouteCompiler classes must implement. - * - * @author Fabien Potencier - */ -interface RouteCompilerInterface -{ - /** - * Compiles the current route instance. - * - * @param Route $route A Route instance - * - * @return CompiledRoute A CompiledRoute instance - */ - function compile(Route $route); -} + {% if 1 %} + {%- include "foo.twig" %} + {% endif %} +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test new file mode 100644 index 0000000..de20f3d --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test @@ -0,0 +1,22 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %} + {%- include "foo.twig" %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %}{% include "foo.twig" %}{% endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return array() +--EXPECT-- +foo +foo +foo +foo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test new file mode 100644 index 0000000..a5a9f83 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test @@ -0,0 +1,20 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo = 'foo' %} +{% set bar = 'foo
    ' %} + +{{ foo }} +{{ bar }} + +{% set foo, bar = 'foo', 'bar' %} + +{{ foo }}{{ bar }} +--DATA-- +return array() +--EXPECT-- +foo +foo<br /> + + +foobar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test new file mode 100644 index 0000000..ec657f0 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test @@ -0,0 +1,9 @@ +--TEST-- +"set" tag block empty capture +--TEMPLATE-- +{% set foo %}{% endset %} + +{% if foo %}FAIL{% endif %} +--DATA-- +return array() +--EXPECT-- diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test new file mode 100644 index 0000000..f156a1a --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test @@ -0,0 +1,10 @@ +--TEST-- +"set" tag block capture +--TEMPLATE-- +{% set foo %}f
    o
    o{% endset %} + +{{ foo }} +--DATA-- +return array() +--EXPECT-- +f
    o
    o diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test new file mode 100644 index 0000000..8ff434a --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test @@ -0,0 +1,12 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo, bar = 'foo' ~ 'bar', 'bar' ~ 'foo' %} + +{{ foo }} +{{ bar }} +--DATA-- +return array() +--EXPECT-- +foobar +barfoo diff --git a/sites/all/README.txt b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test similarity index 5% copy from sites/all/README.txt copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test index c897088..dd06dec 100644 --- a/sites/all/README.txt +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test @@ -1,7 +1,12 @@ +--TEST-- +"spaceless" tag removes whites between HTML tags +--TEMPLATE-- +{% spaceless %} -This directory should be used to place downloaded and custom modules -and themes which are common to all sites. Keeping contributed and -custom modules and themes in the sites directory will aid in upgrading -Drupal core files. Place contributed and custom modules and themes in -the sites/all/modules and sites/all/themes directories respectively. +
    foo
    +{% endspaceless %} +--DATA-- +return array() +--EXPECT-- +
    foo
    diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test new file mode 100644 index 0000000..d584d9e --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"☃" custom tag +--TEMPLATE-- +{% ☃ %} +--DATA-- +return array() +--EXPECT-- +☃ diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test similarity index 5% rename from core/vendor/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test index 50c2d4b..1d2273f 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test @@ -1,48 +1,74 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session; - -/** - * Session Bag store. - * - * @author Drak - */ -interface SessionBagInterface -{ - /** - * Gets this bag's name - * - * @return string - */ - function getName(); - - /** - * Initializes the Bag - * - * @param array $array - */ - function initialize(array &$array); - - /** - * Gets the storage key for this bag. - * - * @return string - */ - function getStorageKey(); - - /** - * Clears out data from bag. - * - * @return mixed Whatever data was contained. - */ - function clear(); -} +--TEST-- +Whitespace trimming on tags. +--TEMPLATE-- +{{ 5 * '{#-'|length }} +{{ '{{-'|length * 5 + '{%-'|length }} + +Trim on control tag: +{% for i in range(1, 9) -%} + {{ i }} +{%- endfor %} + + +Trim on output tag: +{% for i in range(1, 9) %} + {{- i -}} +{% endfor %} + + +Trim comments: + +{#- Invisible -#} + +After the comment. + +Trim leading space: +{% if leading %} + + {{- leading }} +{% endif %} + +{%- if leading %} + {{- leading }} + +{%- endif %} + + +Trim trailing space: +{% if trailing -%} + {{ trailing -}} + +{% endif -%} + +Combined: + +{%- if both -%} +
      +
    • {{- both -}}
    • +
    + +{%- endif -%} + +end +--DATA-- +return array('leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both') +--EXPECT-- +15 +18 + +Trim on control tag: +123456789 + +Trim on output tag: +123456789 + +Trim comments:After the comment. + +Trim leading space: +leading space +leading space + +Trim trailing space: +trailing spaceCombined:
      +
    • both
    • +
    end diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test new file mode 100644 index 0000000..f887006 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" with content as foo %} + +{{ block('foo') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test new file mode 100644 index 0000000..7364d76 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" %} + +{{ block('content') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/core/vendor/Twig/Node/Expression/Binary/Concat.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test similarity index 5% copy from core/vendor/Twig/Node/Expression/Binary/Concat.php copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test index f9a6462..b551a1e 100644 --- a/core/vendor/Twig/Node/Expression/Binary/Concat.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test @@ -1,18 +1,22 @@ -raw('.'); - } -} +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} + +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +foo +foo +bar diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test new file mode 100644 index 0000000..05cca68 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test @@ -0,0 +1,10 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} +--TEMPLATE(bar.twig)-- +--DATA-- +return array() +--EXPECT-- diff --git a/core/vendor/Twig/Node/Expression/Binary/Concat.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test similarity index 5% copy from core/vendor/Twig/Node/Expression/Binary/Concat.php copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test index f9a6462..198be0c 100644 --- a/core/vendor/Twig/Node/Expression/Binary/Concat.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test @@ -1,18 +1,21 @@ -raw('.'); - } -} +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +bar +foo +bar diff --git a/core/vendor/Twig/Node/Expression/Binary/Concat.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test similarity index 5% rename from core/vendor/Twig/Node/Expression/Binary/Concat.php rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test index f9a6462..8de871a 100644 --- a/core/vendor/Twig/Node/Expression/Binary/Concat.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test @@ -1,18 +1,23 @@ -raw('.'); - } -} +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +{{ block('foo_content') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +bar +foo +bar +foo diff --git a/core/modules/entity/tests/modules/entity_test/entity_test.info b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test similarity index 8% copy from core/modules/entity/tests/modules/entity_test/entity_test.info copy to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test index ae6006b..1429d37 100644 --- a/core/modules/entity/tests/modules/entity_test/entity_test.info +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test @@ -1,7 +1,24 @@ -name = Entity CRUD test module -description = Provides entity types based upon the CRUD API. -package = Testing -version = VERSION -core = 8.x -dependencies[] = entity -hidden = TRUE +--TEST-- +array index test +--TEMPLATE-- +{% for key, value in days %} +{{ key }} +{% endfor %} +--DATA-- +return array('days' => array( + 1 => array('money' => 9), + 2 => array('money' => 21), + 3 => array('money' => 38), + 4 => array('money' => 6), + 18 => array('money' => 6), + 19 => array('money' => 3), + 31 => array('money' => 11), +)); +--EXPECT-- +1 +2 +3 +4 +18 +19 +31 diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test new file mode 100644 index 0000000..fb3d288 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test @@ -0,0 +1,12 @@ +--TEST-- +"const" test +--TEMPLATE-- +{{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }} +{{ 'bar' is constant('Foo::BAR_NAME') ? 'ok' : 'no' }} +{{ value is constant('Foo::BAR_NAME') ? 'ok' : 'no' }} +--DATA-- +return array('value' => 'bar'); +--EXPECT-- +ok +ok +ok \ No newline at end of file diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test new file mode 100644 index 0000000..2fbaa86 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test @@ -0,0 +1,108 @@ +--TEST-- +"defined" test +--TEMPLATE-- +{{ definedVar is defined ? 'ok' : 'ko' }} +{{ definedVar is not defined ? 'ko' : 'ok' }} +{{ undefinedVar is defined ? 'ko' : 'ok' }} +{{ undefinedVar is not defined ? 'ok' : 'ko' }} +{{ zeroVar is defined ? 'ok' : 'ko' }} +{{ nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is defined ? 'ok' : 'ko' }} +{{ nested['definedVar'] is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is not defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is defined ? 'ko' : 'ok' }} +{{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is not defined ? 'ok' : 'ko' }} +{{ nested.zeroVar is defined ? 'ok' : 'ko' }} +{{ nested.nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedArray.0 is defined ? 'ok' : 'ko' }} +{{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }} +{{ object.foo is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.getFoo() is defined ? 'ok' : 'ko' }} +{{ object.getFoo('a') is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod() is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }} +{{ object.self.foo is defined ? 'ok' : 'ko' }} +{{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }} +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +); +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +); +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok diff --git a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test similarity index 5% rename from core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php rename to core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test index ca089a5..a776d03 100644 --- a/core/vendor/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test @@ -1,56 +1,45 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\DependencyInjection\Tests\Compiler; - -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; - -class ResolveReferencesToAliasesPassTest extends \PHPUnit_Framework_TestCase +--TEST-- +"empty" test +--TEMPLATE-- +{{ foo is empty ? 'ok' : 'ko' }} +{{ bar is empty ? 'ok' : 'ko' }} +{{ foobar is empty ? 'ok' : 'ko' }} +{{ array is empty ? 'ok' : 'ko' }} +{{ zero is empty ? 'ok' : 'ko' }} +{{ string is empty ? 'ok' : 'ko' }} +{{ countable_empty is empty ? 'ok' : 'ko' }} +{{ countable_not_empty is empty ? 'ok' : 'ko' }} +{{ markup_empty is empty ? 'ok' : 'ko' }} +{{ markup_not_empty is empty ? 'ok' : 'ko' }} +--DATA-- + +class CountableStub implements Countable { - public function testProcess() - { - $container = new ContainerBuilder(); - $container->setAlias('bar', 'foo'); - $def = $container - ->register('moo') - ->setArguments(array(new Reference('bar'))) - ; + private $items; - $this->process($container); - - $arguments = $def->getArguments(); - $this->assertEquals('foo', (string) $arguments[0]); - } - - public function testProcessRecursively() + public function __construct(array $items) { - $container = new ContainerBuilder(); - $container->setAlias('bar', 'foo'); - $container->setAlias('moo', 'bar'); - $def = $container - ->register('foobar') - ->setArguments(array(new Reference('moo'))) - ; - - $this->process($container); - - $arguments = $def->getArguments(); - $this->assertEquals('foo', (string) $arguments[0]); + $this->items = $items; } - protected function process(ContainerBuilder $container) + public function count() { - $pass = new ResolveReferencesToAliasesPass(); - $pass->process($container); + return count($this->items); } } +return array( + 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0', + 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)), + 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'), +); +--EXPECT-- +ok +ok +ok +ok +ko +ko +ok +ko +ok +ko diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test new file mode 100644 index 0000000..695b4c2 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test @@ -0,0 +1,14 @@ +--TEST-- +"even" test +--TEMPLATE-- +{{ 1 is even ? 'ko' : 'ok' }} +{{ 2 is even ? 'ok' : 'ko' }} +{{ 1 is not even ? 'ok' : 'ko' }} +{{ 2 is not even ? 'ko' : 'ok' }} +--DATA-- +return array() +--EXPECT-- +ok +ok +ok +ok diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test new file mode 100644 index 0000000..45c72fd --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test @@ -0,0 +1,48 @@ +--TEST-- +Twig supports the in operator +--TEMPLATE-- +{% if bar in foo %} +TRUE +{% endif %} +{% if not (bar in foo) %} +{% else %} +TRUE +{% endif %} +{% if bar not in foo %} +{% else %} +TRUE +{% endif %} +{% if 'a' in bar %} +TRUE +{% endif %} +{% if 'c' not in bar %} +TRUE +{% endif %} +{% if '' not in bar %} +TRUE +{% endif %} +{% if '' in '' %} +TRUE +{% endif %} +{% if '0' not in '' %} +TRUE +{% endif %} +{% if 'a' not in '0' %} +TRUE +{% endif %} +{% if '0' in '0' %} +TRUE +{% endif %} +--DATA-- +return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) +--EXPECT-- +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test new file mode 100644 index 0000000..ec52550 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test @@ -0,0 +1,19 @@ +--TEST-- +"iterable" test +--TEMPLATE-- +{{ foo is iterable ? 'ok' : 'ko' }} +{{ traversable is iterable ? 'ok' : 'ko' }} +{{ obj is iterable ? 'ok' : 'ko' }} +{{ val is iterable ? 'ok' : 'ko' }} +--DATA-- +return array( + 'foo' => array(), + 'traversable' => new ArrayIterator(array()), + 'obj' => new stdClass(), + 'val' => 'test', +); +--EXPECT-- +ok +ok +ko +ko \ No newline at end of file diff --git a/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test new file mode 100644 index 0000000..1b8311e --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test @@ -0,0 +1,10 @@ +--TEST-- +"odd" test +--TEMPLATE-- +{{ 1 is odd ? 'ok' : 'ko' }} +{{ 2 is odd ? 'ko' : 'ok' }} +--DATA-- +return array() +--EXPECT-- +ok +ok \ No newline at end of file diff --git a/core/vendor/Symfony/Component/Routing/Route.php b/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php similarity index 5% rename from core/vendor/Symfony/Component/Routing/Route.php rename to core/vendor/twig/twig/test/Twig/Tests/LexerTest.php index 05d8a74..ce87898 100644 --- a/core/vendor/Symfony/Component/Routing/Route.php +++ b/core/vendor/twig/twig/test/Twig/Tests/LexerTest.php @@ -1,372 +1,249 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -namespace Symfony\Component\Routing; - -/** - * A Route describes a route and its parameters. - * - * @author Fabien Potencier - * - * @api - */ -class Route +class Twig_Tests_LexerTest extends PHPUnit_Framework_TestCase { - private $pattern; - private $defaults; - private $requirements; - private $options; - private $compiled; + public function testNameLabelForTag() + { + $template = '{% ☃ %}'; - static private $compilers = array(); + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); - /** - * Constructor. - * - * Available options: - * - * * compiler_class: A class name able to compile this route instance (RouteCompiler by default) - * - * @param string $pattern The pattern to match - * @param array $defaults An array of default parameter values - * @param array $requirements An array of requirements for parameters (regexes) - * @param array $options An array of options - * - * @api - */ - public function __construct($pattern, array $defaults = array(), array $requirements = array(), array $options = array()) - { - $this->setPattern($pattern); - $this->setDefaults($defaults); - $this->setRequirements($requirements); - $this->setOptions($options); + $stream->expect(Twig_Token::BLOCK_START_TYPE); + $this->assertSame('☃', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); } - public function __clone() + public function testNameLabelForFunction() { - $this->compiled = null; + $template = '{{ ☃() }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + $stream->expect(Twig_Token::VAR_START_TYPE); + $this->assertSame('☃', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); } - /** - * Returns the pattern. - * - * @return string The pattern - */ - public function getPattern() + public function testBracketsNesting() { - return $this->pattern; + $template = '{{ {"a":{"b":"c"}} }}'; + + $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '{')); + $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '}')); } - /** - * Sets the pattern. - * - * This method implements a fluent interface. - * - * @param string $pattern The pattern - * - * @return Route The current Route instance - */ - public function setPattern($pattern) + protected function countToken($template, $type, $value = null) { - $this->pattern = trim($pattern); + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); - // a route must start with a slash - if ('' === $this->pattern || '/' !== $this->pattern[0]) { - $this->pattern = '/'.$this->pattern; + $count = 0; + $tokens = array(); + while (!$stream->isEOF()) { + $token = $stream->next(); + if ($type === $token->getType()) { + if (null === $value || $value === $token->getValue()) { + ++$count; + } + } } - $this->compiled = null; - - return $this; + return $count; } - /** - * Returns the options. - * - * @return array The options - */ - public function getOptions() + public function testLineDirective() { - return $this->options; - } + $template = "foo\n" + . "bar\n" + . "{% line 10 %}\n" + . "{{\n" + . "baz\n" + . "}}\n"; - /** - * Sets the options. - * - * This method implements a fluent interface. - * - * @param array $options The options - * - * @return Route The current Route instance - */ - public function setOptions(array $options) - { - $this->options = array( - 'compiler_class' => 'Symfony\\Component\\Routing\\RouteCompiler', - ); + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); - return $this->addOptions($options); + // foo\nbar\n + $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // \n (after {% line %}) + $this->assertSame(10, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(11, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(12, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); } - /** - * Adds options. - * - * This method implements a fluent interface. - * - * @param array $options The options - * - * @return Route The current Route instance - */ - public function addOptions(array $options) + public function testLineDirectiveInline() { - foreach ($options as $name => $option) { - $this->options[(string) $name] = $option; - } - $this->compiled = null; + $template = "foo\n" + . "bar{% line 10 %}{{\n" + . "baz\n" + . "}}\n"; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); - return $this; + // foo\nbar + $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(10, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(11, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); } - /** - * Sets an option value. - * - * This method implements a fluent interface. - * - * @param string $name An option name - * @param mixed $value The option value - * - * @return Route The current Route instance - * - * @api - */ - public function setOption($name, $value) + public function testLongComments() { - $this->options[$name] = $value; - $this->compiled = null; + $template = '{# '.str_repeat('*', 100000).' #}'; - return $this; - } + $lexer = new Twig_Lexer(new Twig_Environment()); + $lexer->tokenize($template); - /** - * Get an option value. - * - * @param string $name An option name - * - * @return mixed The option value - */ - public function getOption($name) - { - return isset($this->options[$name]) ? $this->options[$name] : null; + // should not throw an exception } - /** - * Returns the defaults. - * - * @return array The defaults - */ - public function getDefaults() + public function testLongRaw() { - return $this->defaults; - } + $template = '{% raw %}'.str_repeat('*', 100000).'{% endraw %}'; - /** - * Sets the defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return Route The current Route instance - */ - public function setDefaults(array $defaults) - { - $this->defaults = array(); + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); - return $this->addDefaults($defaults); + // should not throw an exception } - /** - * Adds defaults. - * - * This method implements a fluent interface. - * - * @param array $defaults The defaults - * - * @return Route The current Route instance - */ - public function addDefaults(array $defaults) + public function testLongVar() { - foreach ($defaults as $name => $default) { - $this->defaults[(string) $name] = $default; - } - $this->compiled = null; + $template = '{{ '.str_repeat('x', 100000).' }}'; - return $this; - } + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); - /** - * Gets a default value. - * - * @param string $name A variable name - * - * @return mixed The default value - */ - public function getDefault($name) - { - return isset($this->defaults[$name]) ? $this->defaults[$name] : null; + // should not throw an exception } - /** - * Checks if a default value is set for the given variable. - * - * @param string $name A variable name - * - * @return Boolean true if the default value is set, false otherwise - */ - public function hasDefault($name) + public function testLongBlock() { - return array_key_exists($name, $this->defaults); - } + $template = '{% '.str_repeat('x', 100000).' %}'; - /** - * Sets a default value. - * - * @param string $name A variable name - * @param mixed $default The default value - * - * @return Route The current Route instance - * - * @api - */ - public function setDefault($name, $default) - { - $this->defaults[(string) $name] = $default; - $this->compiled = null; + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); - return $this; + // should not throw an exception } - /** - * Returns the requirements. - * - * @return array The requirements - */ - public function getRequirements() + public function testBigNumbers() { - return $this->requirements; + $template = '{{ 922337203685477580700 }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $node = $stream->next(); + $node = $stream->next(); + $this->assertEquals(922337203685477580700, $node->getValue()); } - /** - * Sets the requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return Route The current Route instance - */ - public function setRequirements(array $requirements) + public function testString() { - $this->requirements = array(); + $template = 'foo {{ "bar #{ baz + 1 }" }}'; - return $this->addRequirements($requirements); + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::TEXT_TYPE, 'foo '); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'baz'); + $stream->expect(Twig_Token::OPERATOR_TYPE, '+'); + $stream->expect(Twig_Token::NUMBER_TYPE, '1'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::VAR_END_TYPE); } - /** - * Adds requirements. - * - * This method implements a fluent interface. - * - * @param array $requirements The requirements - * - * @return Route The current Route instance - */ - public function addRequirements(array $requirements) + public function testStringWithEscapedInterpolation() { - foreach ($requirements as $key => $regex) { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - } - $this->compiled = null; + $template = '{{ "bar \#{baz+1}" }}'; - return $this; + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}'); + $stream->expect(Twig_Token::VAR_END_TYPE); } - /** - * Returns the requirement for the given key. - * - * @param string $key The key - * - * @return string The regex - */ - public function getRequirement($key) + public function testStringWithHash() { - return isset($this->requirements[$key]) ? $this->requirements[$key] : null; + $template = '{{ "bar # baz" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz'); + $stream->expect(Twig_Token::VAR_END_TYPE); } /** - * Sets a requirement for the given key. - * - * @param string $key The key - * @param string $regex The regex - * - * @return Route The current Route instance - * - * @api + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unclosed """ */ - public function setRequirement($key, $regex) + public function testStringWithUnterminatedInterpolation() { - $this->requirements[$key] = $this->sanitizeRequirement($key, $regex); - $this->compiled = null; + $template = '{{ "bar #{x" }}'; - return $this; + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); } - /** - * Compiles the route. - * - * @return CompiledRoute A CompiledRoute instance - */ - public function compile() + public function testStringWithNestedInterpolations() { - if (null !== $this->compiled) { - return $this->compiled; - } - - $class = $this->getOption('compiler_class'); + $template = '{{ "bar #{ "foo#{bar}" }" }}'; - if (!isset(self::$compilers[$class])) { - self::$compilers[$class] = new $class; - } - - return $this->compiled = self::$compilers[$class]->compile($this); + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'foo'); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'bar'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::VAR_END_TYPE); } - private function sanitizeRequirement($key, $regex) + public function testStringWithNestedInterpolationsInBlock() { - if (!is_string($regex)) { - throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string', $key)); - } - - if ('' === $regex) { - throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" cannot be empty', $key)); - } + $template = '{% foo "bar #{ "foo#{bar}" }" %}'; - if ('^' === $regex[0]) { - $regex = substr($regex, 1); - } + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::BLOCK_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'foo'); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'foo'); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'bar'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + } - if ('$' === substr($regex, -1)) { - $regex = substr($regex, 0, -1); - } + public function testOperatorEndingWithALetterAtTheEndOfALine() + { + $template = "{{ 1 and\n0}}"; - return $regex; + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::NUMBER_TYPE, 1); + $stream->expect(Twig_Token::OPERATOR_TYPE, 'and'); } } diff --git a/core/vendor/Symfony/Component/Routing/Annotation/Route.php b/core/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php similarity index 16% rename from core/vendor/Symfony/Component/Routing/Annotation/Route.php rename to core/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php index f60af46..1369a6b 100644 --- a/core/vendor/Symfony/Component/Routing/Annotation/Route.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php @@ -1,103 +1,97 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Annotation; - -/** - * Annotation class for @Route(). - * - * @Annotation - * - * @author Fabien Potencier - */ -class Route +class Twig_Tests_Loader_ArrayTest extends PHPUnit_Framework_TestCase { - private $pattern; - private $name; - private $requirements; - private $options; - private $defaults; + public function testGetSource() + { + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + + $this->assertEquals('bar', $loader->getSource('foo')); + } /** - * Constructor. - * - * @param array $data An array of key/value parameters. + * @expectedException Twig_Error_Loader */ - public function __construct(array $data) + public function testGetSourceWhenTemplateDoesNotExist() { - $this->requirements = array(); - $this->options = array(); - $this->defaults = array(); - - if (isset($data['value'])) { - $data['pattern'] = $data['value']; - unset($data['value']); - } - - foreach ($data as $key => $value) { - $method = 'set'.$key; - if (!method_exists($this, $method)) { - throw new \BadMethodCallException(sprintf("Unknown property '%s' on annotation '%s'.", $key, get_class($this))); - } - $this->$method($value); - } - } + $loader = new Twig_Loader_Array(array()); - public function setPattern($pattern) - { - $this->pattern = $pattern; + $loader->getSource('foo'); } - public function getPattern() + public function testGetCacheKey() { - return $this->pattern; - } + $loader = new Twig_Loader_Array(array('foo' => 'bar')); - public function setName($name) - { - $this->name = $name; + $this->assertEquals('bar', $loader->getCacheKey('foo')); } - public function getName() + /** + * @expectedException Twig_Error_Loader + */ + public function testGetCacheKeyWhenTemplateDoesNotExist() { - return $this->name; + $loader = new Twig_Loader_Array(array()); + + $loader->getCacheKey('foo'); } - public function setRequirements($requirements) + public function testSetTemplate() { - $this->requirements = $requirements; + $loader = new Twig_Loader_Array(array()); + $loader->setTemplate('foo', 'bar'); + + $this->assertEquals('bar', $loader->getSource('foo')); } - public function getRequirements() + public function testIsFresh() { - return $this->requirements; + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + $this->assertTrue($loader->isFresh('foo', time())); } - public function setOptions($options) + /** + * @expectedException Twig_Error_Loader + */ + public function testIsFreshWhenTemplateDoesNotExist() { - $this->options = $options; + $loader = new Twig_Loader_Array(array()); + + $loader->isFresh('foo', time()); } - public function getOptions() + public function testTemplateReference() { - return $this->options; + $name = new Twig_Test_Loader_TemplateReference('foo'); + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + + $loader->getCacheKey($name); + $loader->getSource($name); + $loader->isFresh($name, time()); + $loader->setTemplate($name, 'foobar'); } +} - public function setDefaults($defaults) +class Twig_Test_Loader_TemplateReference +{ + private $name; + + public function __construct($name) { - $this->defaults = $defaults; + $this->name = $name; } - public function getDefaults() + public function __toString() { - return $this->defaults; + return $this->name; } } diff --git a/core/vendor/Twig/TokenParser/Filter.php b/core/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php similarity index 15% rename from core/vendor/Twig/TokenParser/Filter.php rename to core/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php index 2b97475..580ae10 100644 --- a/core/vendor/Twig/TokenParser/Filter.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php @@ -3,59 +3,61 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Filters a section of a template by applying filters. - * - *
    - * {% filter upper %}
    - *  This text becomes uppercase
    - * {% endfilter %}
    - * 
    - */ -class Twig_TokenParser_Filter extends Twig_TokenParser +class Twig_Tests_Loader_ChainTest extends PHPUnit_Framework_TestCase { - /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance - */ - public function parse(Twig_Token $token) + public function testGetSource() { - $name = $this->parser->getVarName(); - $ref = new Twig_Node_Expression_BlockReference(new Twig_Node_Expression_Constant($name, $token->getLine()), true, $token->getLine(), $this->getTag()); + $loader = new Twig_Loader_Chain(array( + new Twig_Loader_Array(array('foo' => 'bar')), + new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), + )); - $filter = $this->parser->getExpressionParser()->parseFilterExpressionRaw($ref, $this->getTag()); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $this->assertEquals('bar', $loader->getSource('foo')); + $this->assertEquals('foo', $loader->getSource('bar')); + } - $block = new Twig_Node_Block($name, $body, $token->getLine()); - $this->parser->setBlock($name, $block); + /** + * @expectedException Twig_Error_Loader + */ + public function testGetSourceWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Chain(array()); - return new Twig_Node_Print($filter, $token->getLine(), $this->getTag()); + $loader->getSource('foo'); } - public function decideBlockEnd(Twig_Token $token) + public function testGetCacheKey() { - return $token->test('endfilter'); + $loader = new Twig_Loader_Chain(array( + new Twig_Loader_Array(array('foo' => 'bar')), + new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), + )); + + $this->assertEquals('bar', $loader->getCacheKey('foo')); + $this->assertEquals('foo', $loader->getCacheKey('bar')); } /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name + * @expectedException Twig_Error_Loader */ - public function getTag() + public function testGetCacheKeyWhenTemplateDoesNotExist() { - return 'filter'; + $loader = new Twig_Loader_Chain(array()); + + $loader->getCacheKey('foo'); + } + + public function testAddLoader() + { + $loader = new Twig_Loader_Chain(); + $loader->addLoader(new Twig_Loader_Array(array('foo' => 'bar'))); + + $this->assertEquals('bar', $loader->getSource('foo')); } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php b/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php similarity index 14% rename from core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php rename to core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php index ca8f8ee..22ae5aa 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/ApacheRequest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php @@ -1,51 +1,52 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation; - -/** - * Request represents an HTTP request from an Apache server. - * - * @author Fabien Potencier - */ -class ApacheRequest extends Request +class Twig_Tests_Loader_FilesystemTest extends PHPUnit_Framework_TestCase { /** - * {@inheritdoc} + * @dataProvider getSecurityTests */ - protected function prepareRequestUri() + public function testSecurity($template) { - return $this->server->get('REQUEST_URI'); - } + $loader = new Twig_Loader_Filesystem(array(dirname(__FILE__).'/../Fixtures')); - /** - * {@inheritdoc} - */ - protected function prepareBaseUrl() - { - $baseUrl = $this->server->get('SCRIPT_NAME'); - - if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) { - // assume mod_rewrite - return rtrim(dirname($baseUrl), '/\\'); + try { + $loader->getCacheKey($template); + $this->fail(); + } catch (Twig_Error_Loader $e) { + $this->assertNotContains('Unable to find template', $e->getMessage()); } - - return $baseUrl; } - /** - * {@inheritdoc} - */ - protected function preparePathInfo() + public function getSecurityTests() { - return $this->server->get('PATH_INFO') ?: substr($this->prepareRequestUri(), strlen($this->prepareBaseUrl())) ?: '/'; + return array( + array("AutoloaderTest\0.php"), + array('..\\AutoloaderTest.php'), + array('..\\\\\\AutoloaderTest.php'), + array('../AutoloaderTest.php'), + array('..////AutoloaderTest.php'), + array('./../AutoloaderTest.php'), + array('.\\..\\AutoloaderTest.php'), + array('././././././../AutoloaderTest.php'), + array('.\\./.\\./.\\./../AutoloaderTest.php'), + array('foo/../../AutoloaderTest.php'), + array('foo\\..\\..\\AutoloaderTest.php'), + array('foo/../bar/../../AutoloaderTest.php'), + array('foo/bar/../../../AutoloaderTest.php'), + array('filters/../../AutoloaderTest.php'), + array('filters//..//..//AutoloaderTest.php'), + array('filters\\..\\..\\AutoloaderTest.php'), + array('filters\\\\..\\\\..\\\\AutoloaderTest.php'), + array('filters\\//../\\/\\..\\AutoloaderTest.php'), + ); } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php similarity index 21% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php index 013fcb6..ebfcb48 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php @@ -3,33 +3,44 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_AutoEscapeTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_AutoEscape::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $body = new Twig_Node(array(new Twig_Node_Text('foo', 0))); + $node = new Twig_Node_AutoEscape(true, $body, 0); + + $this->assertEquals($body, $node->getNode('body')); + $this->assertEquals(true, $node->getAttribute('value')); } /** - * {@inheritdoc} + * @covers Twig_Node_AutoEscape::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $body = new Twig_Node(array(new Twig_Node_Text('foo', 0))); + $node = new Twig_Node_AutoEscape(true, $body, 0); + + return array( + array($node, 'echo "foo";'), + ); } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php similarity index 25% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php index 013fcb6..f1c5ab1 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php @@ -3,33 +3,39 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_BlockReferenceTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_BlockReference::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $node = new Twig_Node_BlockReference('foo', 0); + + $this->assertEquals('foo', $node->getAttribute('name')); } /** - * {@inheritdoc} + * @covers Twig_Node_BlockReference::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() { - return 'optimizer'; + return array( + array(new Twig_Node_BlockReference('foo', 0), '$this->displayBlock(\'foo\', $context, $blocks);'), + ); } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php similarity index 21% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php index 013fcb6..6bc5e79 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php @@ -3,33 +3,50 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_BlockTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Block::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $body = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Block('foo', $body, 0); + + $this->assertEquals($body, $node->getNode('body')); + $this->assertEquals('foo', $node->getAttribute('name')); } /** - * {@inheritdoc} + * @covers Twig_Node_Block::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $body = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Block('foo', $body, 0); + + return array( + array($node, <<optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_DoTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Do::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = new Twig_Node_Do($expr, 0); + + $this->assertEquals($expr, $node->getNode('expr')); } /** - * {@inheritdoc} + * @covers Twig_Node_Do::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = new Twig_Node_Do($expr, 0); + $tests[] = array($node, '"foo";'); + + return $tests; } } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php index dc080db..06b30e9 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php @@ -1,46 +1,51 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_ArrayTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Array::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $elements = array(new Twig_Node_Expression_Constant('foo', 0), $foo = new Twig_Node_Expression_Constant('bar', 0)); + $node = new Twig_Node_Expression_Array($elements, 0); + + $this->assertEquals($foo, $node->getNode(1)); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Array::compile + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $elements = array( + new Twig_Node_Expression_Constant('foo', 0), + new Twig_Node_Expression_Constant('bar', 0), + + new Twig_Node_Expression_Constant('bar', 0), + new Twig_Node_Expression_Constant('foo', 0), + ); + $node = new Twig_Node_Expression_Array($elements, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, 'array("foo" => "bar", "bar" => "foo")'), ); } } - diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php similarity index 24% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php index 013fcb6..fc92b0d 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php @@ -3,33 +3,41 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/../TestCase.php'; +class Twig_Tests_Node_Expression_AssignNameTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Expression_AssignName::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $node = new Twig_Node_Expression_AssignName('foo', 0); + + $this->assertEquals('foo', $node->getAttribute('name')); } /** - * {@inheritdoc} + * @covers Twig_Node_Expression_AssignName::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_AssignName('foo', 0); + + return array( + array($node, '$context["foo"]'), + ); } } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php index dc080db..80d318f 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_AddTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_Add::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Add($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_Add::compile + * @covers Twig_Node_Expression_Binary_Add::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Add($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 + 2)'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php index dc080db..a6ed4f2 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_AndTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_And::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_And($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_And::compile + * @covers Twig_Node_Expression_Binary_And::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_And($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 && 2)'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php index dc080db..a04edc9 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_ConcatTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_Concat::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Concat($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_Concat::compile + * @covers Twig_Node_Expression_Binary_Concat::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Concat($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 . 2)'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php index dc080db..42002fc 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_DivTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_Div::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Div($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_Div::compile + * @covers Twig_Node_Expression_Binary_Div::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Div($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 / 2)'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php index dc080db..94ff2f6 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_FloorDivTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_FloorDiv::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_FloorDiv::compile + * @covers Twig_Node_Expression_Binary_FloorDiv::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, 'intval(floor((1 / 2)))'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php index dc080db..67612a5 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_ModTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_Mod::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Mod($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_Mod::compile + * @covers Twig_Node_Expression_Binary_Mod::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Mod($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 % 2)'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php index dc080db..c817d02 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_MulTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_Mul::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Mul($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_Mul::compile + * @covers Twig_Node_Expression_Binary_Mul::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Mul($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 * 2)'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php index dc080db..d8e2f8d 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_OrTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_Or::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Or($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_Or::compile + * @covers Twig_Node_Expression_Binary_Or::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Or($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 || 2)'), ); } } - diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php similarity index 18% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php index dc080db..6583d09 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php @@ -1,46 +1,49 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_Binary_SubTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Binary_Sub::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Sub($left, $right, 0); + + $this->assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Binary_Sub::compile + * @covers Twig_Node_Expression_Binary_Sub::operator + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Sub($left, $right, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '(1 - 2)'), ); } } - diff --git a/core/vendor/Twig/TokenParser/Spaceless.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php similarity index 16% rename from core/vendor/Twig/TokenParser/Spaceless.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php index 1e3fa8f..4a05e4e 100644 --- a/core/vendor/Twig/TokenParser/Spaceless.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php @@ -3,57 +3,50 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Remove whitespaces between HTML tags. - * - *
    - * {% spaceless %}
    - *      
    - * foo - *
    - * {% endspaceless %} - * - * {# output will be
    foo
    #} - *
    - */ -class Twig_TokenParser_Spaceless extends Twig_TokenParser +require_once dirname(__FILE__).'/../TestCase.php'; + +class Twig_Tests_Node_Expression_ConditionalTest extends Twig_Tests_Node_TestCase { /** - * Parses a token and returns a node. - * - * @param Twig_Token $token A Twig_Token instance - * - * @return Twig_NodeInterface A Twig_NodeInterface instance + * @covers Twig_Node_Expression_Conditional::__construct */ - public function parse(Twig_Token $token) + public function testConstructor() { - $lineno = $token->getLine(); - - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - $body = $this->parser->subparse(array($this, 'decideSpacelessEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $expr1 = new Twig_Node_Expression_Constant(1, 0); + $expr2 = new Twig_Node_Expression_Constant(2, 0); + $expr3 = new Twig_Node_Expression_Constant(3, 0); + $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 0); - return new Twig_Node_Spaceless($body, $lineno, $this->getTag()); + $this->assertEquals($expr1, $node->getNode('expr1')); + $this->assertEquals($expr2, $node->getNode('expr2')); + $this->assertEquals($expr3, $node->getNode('expr3')); } - public function decideSpacelessEnd(Twig_Token $token) + /** + * @covers Twig_Node_Expression_Conditional::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) { - return $token->test('endspaceless'); + parent::testCompile($node, $source, $environment); } - /** - * Gets the tag name associated with this token parser. - * - * @return string The tag name - */ - public function getTag() + public function getTests() { - return 'spaceless'; + $tests = array(); + + $expr1 = new Twig_Node_Expression_Constant(1, 0); + $expr2 = new Twig_Node_Expression_Constant(2, 0); + $expr3 = new Twig_Node_Expression_Constant(3, 0); + $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 0); + $tests[] = array($node, '((1) ? (2) : (3))'); + + return $tests; } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php similarity index 24% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php index 013fcb6..0cf3867 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php @@ -3,33 +3,42 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/../TestCase.php'; +class Twig_Tests_Node_Expression_ConstantTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Constant::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $node = new Twig_Node_Expression_Constant('foo', 0); + + $this->assertEquals('foo', $node->getAttribute('value')); } /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Constant::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $node = new Twig_Node_Expression_Constant('foo', 0); + $tests[] = array($node, '"foo"'); + + return $tests; } } diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php similarity index 11% copy from core/vendor/Twig/Extension.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php index 931fc03..2c52482 100644 --- a/core/vendor/Twig/Extension.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php @@ -3,91 +3,83 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -abstract class Twig_Extension implements Twig_ExtensionInterface + +require_once dirname(__FILE__).'/../TestCase.php'; + +class Twig_Tests_Node_Expression_FilterTest extends Twig_Tests_Node_TestCase { /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance + * @covers Twig_Node_Expression_Filter::__construct */ - public function initRuntime(Twig_Environment $environment) + public function testConstructor() { - } + $expr = new Twig_Node_Expression_Constant('foo', 0); + $name = new Twig_Node_Expression_Constant('upper', 0); + $args = new Twig_Node(); + $node = new Twig_Node_Expression_Filter($expr, $name, $args, 0); - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(); + $this->assertEquals($expr, $node->getNode('node')); + $this->assertEquals($name, $node->getNode('filter')); + $this->assertEquals($args, $node->getNode('arguments')); } /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances + * @covers Twig_Node_Expression_Filter::compile + * @dataProvider getTests */ - public function getNodeVisitors() + public function testCompile($node, $source, $environment = null) { - return array(); - } + parent::testCompile($node, $source, $environment); - /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters - */ - public function getFilters() - { - return array(); + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = $this->createFilter($expr, 'foobar', array(new Twig_Node_Expression_Constant('bar', 0), new Twig_Node_Expression_Constant('foobar', 0))); + + try { + $node->compile($this->getCompiler()); + $this->fail(); + } catch (Exception $e) { + $this->assertEquals('Twig_Error_Syntax', get_class($e)); + } } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { - return array(); - } + $tests = array(); - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array(); + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = $this->createFilter($expr, 'upper'); + $node = $this->createFilter($node, 'lower', array(new Twig_Node_Expression_Constant('bar', 0), new Twig_Node_Expression_Constant('foobar', 0))); + + if (function_exists('mb_get_info')) { + $tests[] = array($node, 'twig_lower_filter($this->env, twig_upper_filter($this->env, "foo"), "bar", "foobar")'); + } else { + $tests[] = array($node, 'strtolower(strtoupper("foo"), "bar", "foobar")'); + } + + return $tests; } /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators + * @covers Twig_Node_Expression_Filter::compile + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage The filter "uppe" does not exist. Did you mean "upper" at line 0 */ - public function getOperators() + public function testUnknownFilter() { - return array(); + $node = $this->createFilter(new Twig_Node_Expression_Constant('foo', 0), 'uppe'); + $node->compile($this->getCompiler()); } - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals() + protected function createFilter($node, $name, array $arguments = array()) { - return array(); + $name = new Twig_Node_Expression_Constant($name, 0); + $arguments = new Twig_Node($arguments); + + return new Twig_Node_Expression_Filter($node, $name, $arguments, 0); } } diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php similarity index 9% copy from core/vendor/Twig/Extension.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php index 931fc03..68c5c61 100644 --- a/core/vendor/Twig/Extension.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php @@ -3,91 +3,88 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -abstract class Twig_Extension implements Twig_ExtensionInterface + +require_once dirname(__FILE__).'/../TestCase.php'; + +class Twig_Tests_Node_Expression_FunctionTest extends Twig_Tests_Node_TestCase { /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance + * @covers Twig_Node_Expression_Function::__construct */ - public function initRuntime(Twig_Environment $environment) + public function testConstructor() { - } + $name = 'function'; + $args = new Twig_Node(); + $node = new Twig_Node_Expression_Function($name, $args, 0); - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(); + $this->assertEquals($name, $node->getAttribute('name')); + $this->assertEquals($args, $node->getNode('arguments')); } /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances + * @covers Twig_Node_Expression_Function::compile + * @dataProvider getTests */ - public function getNodeVisitors() + public function testCompile($node, $source, $environment = null) { - return array(); + parent::testCompile($node, $source, $environment); } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * @covers Twig_Node_Expression_Filter::compile + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage The function "cycl" does not exist. Did you mean "cycle" at line 0 */ - public function getFilters() + public function testUnknownFunction() { - return array(); + $node = $this->createFunction('cycl', array()); + $node->compile($this->getCompiler()); } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { - return array(); - } + $environment = new Twig_Environment(); + $environment->addFunction('foo', new Twig_Function_Function('foo', array())); + $environment->addFunction('bar', new Twig_Function_Function('bar', array('needs_environment' => true))); + $environment->addFunction('foofoo', new Twig_Function_Function('foofoo', array('needs_context' => true))); + $environment->addFunction('foobar', new Twig_Function_Function('foobar', array('needs_environment' => true, 'needs_context' => true))); - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array(); - } + $tests = array(); - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - public function getOperators() - { - return array(); + $node = $this->createFunction('foo'); + $tests[] = array($node, 'foo()', $environment); + + $node = $this->createFunction('foo', array(new Twig_Node_Expression_Constant('bar', 0), new Twig_Node_Expression_Constant('foobar', 0))); + $tests[] = array($node, 'foo("bar", "foobar")', $environment); + + $node = $this->createFunction('bar'); + $tests[] = array($node, 'bar($this->env)', $environment); + + $node = $this->createFunction('bar', array(new Twig_Node_Expression_Constant('bar', 0))); + $tests[] = array($node, 'bar($this->env, "bar")', $environment); + + $node = $this->createFunction('foofoo'); + $tests[] = array($node, 'foofoo($context)', $environment); + + $node = $this->createFunction('foofoo', array(new Twig_Node_Expression_Constant('bar', 0))); + $tests[] = array($node, 'foofoo($context, "bar")', $environment); + + $node = $this->createFunction('foobar'); + $tests[] = array($node, 'foobar($this->env, $context)', $environment); + + $node = $this->createFunction('foobar', array(new Twig_Node_Expression_Constant('bar', 0))); + $tests[] = array($node, 'foobar($this->env, $context, "bar")', $environment); + + return $tests; } - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals() + protected function createFunction($name, array $arguments = array()) { - return array(); + return new Twig_Node_Expression_Function($name, new Twig_Node($arguments), 0); } } diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php similarity index 10% copy from core/vendor/Twig/Extension.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php index 931fc03..6df143d 100644 --- a/core/vendor/Twig/Extension.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php @@ -3,91 +3,62 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -abstract class Twig_Extension implements Twig_ExtensionInterface -{ - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance - */ - public function initRuntime(Twig_Environment $environment) - { - } - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(); - } +require_once dirname(__FILE__).'/../TestCase.php'; +class Twig_Tests_Node_Expression_GetAttrTest extends Twig_Tests_Node_TestCase +{ /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances + * @covers Twig_Node_Expression_GetAttr::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(); + $expr = new Twig_Node_Expression_Name('foo', 0); + $attr = new Twig_Node_Expression_Constant('bar', 0); + $args = new Twig_Node_Expression_Array(array(), 0); + $args->addElement(new Twig_Node_Expression_Name('foo', 0)); + $args->addElement(new Twig_Node_Expression_Constant('bar', 0)); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::ARRAY_CALL, 0); + + $this->assertEquals($expr, $node->getNode('node')); + $this->assertEquals($attr, $node->getNode('attribute')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals(Twig_TemplateInterface::ARRAY_CALL, $node->getAttribute('type')); } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * @covers Twig_Node_Expression_GetAttr::compile + * @dataProvider getTests */ - public function getFilters() + public function testCompile($node, $source, $environment = null) { - return array(); + parent::testCompile($node, $source, $environment); } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { - return array(); - } + $tests = array(); - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array(); - } + $expr = new Twig_Node_Expression_Name('foo', 0); + $attr = new Twig_Node_Expression_Constant('bar', 0); + $args = new Twig_Node_Expression_Array(array(), 0); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::ANY_CALL, 0); + $tests[] = array($node, sprintf('%s%s, "bar")', $this->getAttributeGetter(), $this->getVariableGetter('foo'))); - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - public function getOperators() - { - return array(); - } + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::ARRAY_CALL, 0); + $tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo'))); - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals() - { - return array(); + $args = new Twig_Node_Expression_Array(array(), 0); + $args->addElement(new Twig_Node_Expression_Name('foo', 0)); + $args->addElement(new Twig_Node_Expression_Constant('bar', 0)); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::METHOD_CALL, 0); + $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo'), $this->getVariableGetter('foo'))); + + return $tests; } } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php similarity index 17% copy from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php index dc080db..e77b432 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php @@ -1,46 +1,51 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/../TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_Expression_NameTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Expression_Name::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $node = new Twig_Node_Expression_Name('foo', 0); + + $this->assertEquals('foo', $node->getAttribute('name')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Expression_Name::compile + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $node = new Twig_Node_Expression_Name('foo', 0); + $self = new Twig_Node_Expression_Name('_self', 0); + $context = new Twig_Node_Expression_Name('_context', 0); + + $env = new Twig_Environment(null, array('strict_variables' => true)); + $env1 = new Twig_Environment(null, array('strict_variables' => false)); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, '$this->getContext($context, "foo")', $env), + array($node, $this->getVariableGetter('foo'), $env1), + array($self, '$this'), + array($context, '$context'), ); } } - diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php similarity index 24% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php index 013fcb6..7efbe03 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php @@ -3,33 +3,40 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/../TestCase.php'; +class Twig_Tests_Node_Expression_ParentTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Parent::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $node = new Twig_Node_Expression_Parent('foo', 0); + + $this->assertEquals('foo', $node->getAttribute('name')); } /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Parent::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Expression_Parent('foo', 0), '$this->renderParentBlock("foo", $context, $blocks)'); + + return $tests; } } diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php similarity index 15% copy from core/vendor/Twig/Extension.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php index 931fc03..08668c0 100644 --- a/core/vendor/Twig/Extension.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php @@ -3,91 +3,65 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -abstract class Twig_Extension implements Twig_ExtensionInterface -{ - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance - */ - public function initRuntime(Twig_Environment $environment) - { - } - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(); - } +require_once dirname(__FILE__).'/../TestCase.php'; +class Twig_Tests_Node_Expression_TestTest extends Twig_Tests_Node_TestCase +{ /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances + * @covers Twig_Node_Expression_Test::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(); + $expr = new Twig_Node_Expression_Constant('foo', 0); + $name = new Twig_Node_Expression_Constant('null', 0); + $args = new Twig_Node(); + $node = new Twig_Node_Expression_Test($expr, $name, $args, 0); + + $this->assertEquals($expr, $node->getNode('node')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals($name, $node->getAttribute('name')); } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * @covers Twig_Node_Expression_Test::compile + * @dataProvider getTests */ - public function getFilters() + public function testCompile($node, $source, $environment = null) { - return array(); + parent::testCompile($node, $source, $environment); } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { - return array(); - } + $tests = array(); - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array(); + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = new Twig_Node_Expression_Test_Null($expr, 'null', new Twig_Node(array()), 0); + + $tests[] = array($node, '(null === "foo")'); + + return $tests; } /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators + * @covers Twig_Node_Expression_Filter::compile + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage The test "nul" does not exist. Did you mean "null" at line 0 */ - public function getOperators() + public function testUnknownTest() { - return array(); + $node = $this->createTest(new Twig_Node_Expression_Constant('foo', 0), 'nul'); + $node->compile($this->getCompiler()); } - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals() + protected function createTest($node, $name, array $arguments = array()) { - return array(); + return new Twig_Node_Expression_Test($node, $name, new Twig_Node($arguments), 0); } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php similarity index 21% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php index 013fcb6..218de6e 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php @@ -3,33 +3,44 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/../../TestCase.php'; +class Twig_Tests_Node_Expression_Unary_NegTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Unary_Neg::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $expr = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Neg($expr, 0); + + $this->assertEquals($expr, $node->getNode('node')); } /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Unary_Neg::compile + * @covers Twig_Node_Expression_Unary_Neg::operator + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Neg($node, 0); + + return array( + array($node, '(-1)'), + ); } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php similarity index 21% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php index 013fcb6..ed6349c 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php @@ -3,33 +3,44 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/../../TestCase.php'; +class Twig_Tests_Node_Expression_Unary_NotTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Unary_Not::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $expr = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Not($expr, 0); + + $this->assertEquals($expr, $node->getNode('node')); } /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Unary_Not::compile + * @covers Twig_Node_Expression_Unary_Not::operator + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Not($node, 0); + + return array( + array($node, '(!1)'), + ); } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php similarity index 21% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php index 013fcb6..6a414bc 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php @@ -3,33 +3,44 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/../../TestCase.php'; +class Twig_Tests_Node_Expression_Unary_PosTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Unary_Pos::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $expr = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Pos($expr, 0); + + $this->assertEquals($expr, $node->getNode('node')); } /** - * {@inheritdoc} + * @covers Twig_Node_Expression_Unary_Pos::compile + * @covers Twig_Node_Expression_Unary_Pos::operator + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Pos($node, 0); + + return array( + array($node, '(+1)'), + ); } } diff --git a/core/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php new file mode 100644 index 0000000..ef3be82 --- /dev/null +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php @@ -0,0 +1,201 @@ +setAttribute('with_loop', false); + + $this->assertEquals($keyTarget, $node->getNode('key_target')); + $this->assertEquals($valueTarget, $node->getNode('value_target')); + $this->assertEquals($seq, $node->getNode('seq')); + $this->assertTrue($node->getAttribute('ifexpr')); + $this->assertEquals('Twig_Node_If', get_class($node->getNode('body'))); + $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0)); + $this->assertEquals(null, $node->getNode('else')); + + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0); + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', false); + $this->assertEquals($else, $node->getNode('else')); + } + + /** + * @covers Twig_Node_For::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $keyTarget = new Twig_Node_Expression_AssignName('key', 0); + $valueTarget = new Twig_Node_Expression_AssignName('item', 0); + $seq = new Twig_Node_Expression_Name('items', 0); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', false); + + $tests[] = array($node, <<getVariableGetter('items')}); +foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 0); + $valueTarget = new Twig_Node_Expression_AssignName('v', 0); + $seq = new Twig_Node_Expression_Name('values', 0); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 0); + $valueTarget = new Twig_Node_Expression_AssignName('v', 0); + $seq = new Twig_Node_Expression_Name('values', 0); + $ifexpr = new Twig_Node_Expression_Constant(true, 0); + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + if (true) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 0); + $valueTarget = new Twig_Node_Expression_AssignName('v', 0); + $seq = new Twig_Node_Expression_Name('values', 0); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0); + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['_iterated'] = false; +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + \$context['_iterated'] = true; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +if (!\$context['_iterated']) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + return $tests; + } +} diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php similarity index 10% copy from core/vendor/Twig/Extension.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php index 931fc03..04b92e7 100644 --- a/core/vendor/Twig/Extension.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php @@ -3,91 +3,97 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -abstract class Twig_Extension implements Twig_ExtensionInterface + +require_once dirname(__FILE__).'/TestCase.php'; + +class Twig_Tests_Node_IfTest extends Twig_Tests_Node_TestCase { /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance + * @covers Twig_Node_If::__construct */ - public function initRuntime(Twig_Environment $environment) + public function testConstructor() { - } + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0), + ), array(), 0); + $else = null; + $node = new Twig_Node_If($t, $else, 0); - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(); - } + $this->assertEquals($t, $node->getNode('tests')); + $this->assertEquals(null, $node->getNode('else')); - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() - { - return array(); + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 0), 0); + $node = new Twig_Node_If($t, $else, 0); + $this->assertEquals($else, $node->getNode('else')); } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * @covers Twig_Node_If::compile + * @dataProvider getTests */ - public function getFilters() + public function testCompile($node, $source, $environment = null) { - return array(); + parent::testCompile($node, $source, $environment); } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { - return array(); - } + $tests = array(); - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array(); - } + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0), + ), array(), 0); + $else = null; + $node = new Twig_Node_If($t, $else, 0); - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - public function getOperators() - { - return array(); - } + $tests[] = array($node, <<getVariableGetter('foo')}; +} +EOF + ); - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals() - { - return array(); + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0), + new Twig_Node_Expression_Constant(false, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 0), 0), + ), array(), 0); + $else = null; + $node = new Twig_Node_If($t, $else, 0); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} elseif (false) { + echo {$this->getVariableGetter('bar')}; +} +EOF + ); + + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0), + ), array(), 0); + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 0), 0); + $node = new Twig_Node_If($t, $else, 0); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} else { + echo {$this->getVariableGetter('bar')}; +} +EOF + ); + + return $tests; } } diff --git a/core/vendor/Twig/CompilerInterface.php b/core/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php similarity index 20% rename from core/vendor/Twig/CompilerInterface.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php index f861381..6a89195 100644 --- a/core/vendor/Twig/CompilerInterface.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php @@ -3,33 +3,48 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Interface implemented by compiler classes. - * - * @package twig - * @author Fabien Potencier - */ -interface Twig_CompilerInterface +require_once dirname(__FILE__).'/TestCase.php'; + +class Twig_Tests_Node_ImportTest extends Twig_Tests_Node_TestCase { /** - * Compiles a node. - * - * @param Twig_NodeInterface $node The node to compile - * - * @return Twig_CompilerInterface The current compiler instance + * @covers Twig_Node_Import::__construct */ - function compile(Twig_NodeInterface $node); + public function testConstructor() + { + $macro = new Twig_Node_Expression_Constant('foo.twig', 0); + $var = new Twig_Node_Expression_AssignName('macro', 0); + $node = new Twig_Node_Import($macro, $var, 0); + + $this->assertEquals($macro, $node->getNode('expr')); + $this->assertEquals($var, $node->getNode('var')); + } /** - * Gets the current PHP code after compilation. - * - * @return string The PHP code + * @covers Twig_Node_Import::compile + * @dataProvider getTests */ - function getSource(); + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $macro = new Twig_Node_Expression_Constant('foo.twig', 0); + $var = new Twig_Node_Expression_AssignName('macro', 0); + $node = new Twig_Node_Import($macro, $var, 0); + + $tests[] = array($node, '$context["macro"] = $this->env->loadTemplate("foo.twig");'); + + return $tests; + } } diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php similarity index 9% copy from core/vendor/Twig/Extension.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php index 931fc03..d068392 100644 --- a/core/vendor/Twig/Extension.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php @@ -3,91 +3,82 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -abstract class Twig_Extension implements Twig_ExtensionInterface + +require_once dirname(__FILE__).'/TestCase.php'; + +class Twig_Tests_Node_IncludeTest extends Twig_Tests_Node_TestCase { /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance + * @covers Twig_Node_Include::__construct */ - public function initRuntime(Twig_Environment $environment) + public function testConstructor() { - } + $expr = new Twig_Node_Expression_Constant('foo.twig', 0); + $node = new Twig_Node_Include($expr, null, false, false, 0); - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(); - } + $this->assertEquals(null, $node->getNode('variables')); + $this->assertEquals($expr, $node->getNode('expr')); + $this->assertFalse($node->getAttribute('only')); - /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances - */ - public function getNodeVisitors() - { - return array(); + $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 0), new Twig_Node_Expression_Constant(true, 0)), 0); + $node = new Twig_Node_Include($expr, $vars, true, false, 0); + $this->assertEquals($vars, $node->getNode('variables')); + $this->assertTrue($node->getAttribute('only')); } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * @covers Twig_Node_Include::compile + * @dataProvider getTests */ - public function getFilters() + public function testCompile($node, $source, $environment = null) { - return array(); + parent::testCompile($node, $source, $environment); } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { - return array(); - } + $tests = array(); - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array(); - } + $expr = new Twig_Node_Expression_Constant('foo.twig', 0); + $node = new Twig_Node_Include($expr, null, false, false, 0); + $tests[] = array($node, '$this->env->loadTemplate("foo.twig")->display($context);'); - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - public function getOperators() - { - return array(); - } + $expr = new Twig_Node_Expression_Conditional( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Expression_Constant('foo', 0), + new Twig_Node_Expression_Constant('foo', 0), + 0 + ); + $node = new Twig_Node_Include($expr, null, false, false, 0); + $tests[] = array($node, <<env->resolveTemplate(((true) ? ("foo") : ("foo"))); +\$template->display(\$context); +EOF + ); - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals() - { - return array(); + $expr = new Twig_Node_Expression_Constant('foo.twig', 0); + $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 0), new Twig_Node_Expression_Constant(true, 0)), 0); + $node = new Twig_Node_Include($expr, $vars, false, false, 0); + $tests[] = array($node, '$this->env->loadTemplate("foo.twig")->display(array_merge($context, array("foo" => true)));'); + + $node = new Twig_Node_Include($expr, $vars, true, false, 0); + $tests[] = array($node, '$this->env->loadTemplate("foo.twig")->display(array("foo" => true));'); + + $node = new Twig_Node_Include($expr, $vars, true, true, 0); + $tests[] = array($node, <<env->loadTemplate("foo.twig")->display(array("foo" => true)); +} catch (Twig_Error_Loader \$e) { + // ignore missing template +} +EOF + ); + + return $tests; } } diff --git a/core/vendor/Twig/Extension/Debug.php b/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php similarity index 17% rename from core/vendor/Twig/Extension/Debug.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php index 8059df0..3dd57a6 100644 --- a/core/vendor/Twig/Extension/Debug.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php @@ -3,68 +3,68 @@ /* * This file is part of Twig. * - * (c) 2011 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Debug extends Twig_Extension + +require_once dirname(__FILE__).'/TestCase.php'; + +class Twig_Tests_Node_MacroTest extends Twig_Tests_Node_TestCase { /** - * Returns a list of global functions to add to the existing list. - * - * @return array An array of global functions + * @covers Twig_Node_Macro::__construct */ - public function getFunctions() + public function testConstructor() { - // dump is safe if var_dump is overriden by xdebug - $isDumpOutputHtmlSafe = extension_loaded('xdebug') - // false means that it was not set (and the default is on) or it explicitly enabled - && (false === ini_get('xdebug.overload_var_dump') || ini_get('xdebug.overload_var_dump')) - // false means that it was not set (and the default is on) or it explicitly enabled - // xdebug.overload_var_dump produces HTML only when html_errors is also enabled - && (false === ini_get('html_errors') || ini_get('html_errors')) - ; + $body = new Twig_Node_Text('foo', 0); + $arguments = new Twig_Node(array(new Twig_Node_Expression_Name('foo', 0)), array(), 0); + $node = new Twig_Node_Macro('foo', $body, $arguments, 0); - return array( - 'dump' => new Twig_Function_Function('twig_var_dump', array('is_safe' => $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)), - ); + $this->assertEquals($body, $node->getNode('body')); + $this->assertEquals($arguments, $node->getNode('arguments')); + $this->assertEquals('foo', $node->getAttribute('name')); } /** - * Returns the name of the extension. - * - * @return string The extension name + * @covers Twig_Node_Macro::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'debug'; + parent::testCompile($node, $source, $environment); } -} -function twig_var_dump(Twig_Environment $env, $context) + public function getTests() + { + $body = new Twig_Node_Text('foo', 0); + $arguments = new Twig_Node(array(new Twig_Node_Expression_Name('foo', 0)), array(), 0); + $node = new Twig_Node_Macro('foo', $body, $arguments, 0); + + return array( + array($node, <<isDebug()) { - return; - } + \$context = \$this->env->mergeGlobals(array( + "foo" => \$foo, + )); - ob_start(); + \$blocks = array(); - $count = func_num_args(); - if (2 === $count) { - $vars = array(); - foreach ($context as $key => $value) { - if (!$value instanceof Twig_Template) { - $vars[$key] = $value; - } - } + ob_start(); + try { + echo "foo"; + } catch(Exception \$e) { + ob_end_clean(); - var_dump($vars); - } else { - for ($i = 2; $i < $count; $i++) { - var_dump(func_get_arg($i)); - } + throw \$e; } return ob_get_clean(); } +EOF + ), + ); + } +} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php b/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php similarity index 8% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php index 5500a03..592949b 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Storage/MockArraySessionStorage.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php @@ -1,252 +1,196 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\Session\Storage; +require_once dirname(__FILE__).'/TestCase.php'; -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; - -/** - * MockArraySessionStorage mocks the session for unit tests. - * - * No PHP session is actually started since a session can be initialized - * and shutdown only once per PHP execution cycle. - * - * When doing functional testing, you should use MockFileSessionStorage instead. - * - * @author Fabien Potencier - * @author Bulat Shakirzyanov - * @author Drak - */ -class MockArraySessionStorage implements SessionStorageInterface +class Twig_Tests_Node_ModuleTest extends Twig_Tests_Node_TestCase { /** - * @var string - */ - protected $id = ''; - - /** - * @var string - */ - protected $name; - - /** - * @var boolean - */ - protected $started = false; - - /** - * @var boolean - */ - protected $closed = false; - - /** - * @var array - */ - protected $data = array(); - - /** - * @var MetadataBag + * @covers Twig_Node_Module::__construct */ - protected $metadataBag; - - /** - * Constructor. - * - * @param string $name Session name - * @param MetadataBag $metaBag MetadataBag instance. - */ - public function __construct($name = 'MOCKSESSID', MetadataBag $metaBag = null) + public function testConstructor() { - $this->name = $name; - $this->setMetadataBag($metaBag); + $body = new Twig_Node_Text('foo', 0); + $parent = new Twig_Node_Expression_Constant('layout.twig', 0); + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; + $node = new Twig_Node_Module($body, $parent, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + + $this->assertEquals($body, $node->getNode('body')); + $this->assertEquals($blocks, $node->getNode('blocks')); + $this->assertEquals($macros, $node->getNode('macros')); + $this->assertEquals($parent, $node->getNode('parent')); + $this->assertEquals($filename, $node->getAttribute('filename')); } /** - * Sets the session data. - * - * @param array $array + * @covers Twig_Node_Module::compile + * @covers Twig_Node_Module::compileTemplate + * @covers Twig_Node_Module::compileMacros + * @covers Twig_Node_Module::compileClassHeader + * @covers Twig_Node_Module::compileDisplayHeader + * @covers Twig_Node_Module::compileDisplayBody + * @covers Twig_Node_Module::compileDisplayFooter + * @covers Twig_Node_Module::compileClassFooter + * @dataProvider getTests */ - public function setSessionData(array $array) + public function testCompile($node, $source, $environment = null) { - $this->data = $array; + parent::testCompile($node, $source, $environment); } - /** - * {@inheritdoc} - */ - public function start() + public function getTests() { - if ($this->started && !$this->closed) { - return true; - } + $twig = new Twig_Environment(new Twig_Loader_String()); - if (empty($this->id)) { - $this->id = $this->generateId(); - } + $tests = array(); - $this->loadSession(); + $body = new Twig_Node_Text('foo', 0); + $extends = null; + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; - return true; - } + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<started) { - $this->start(); - } + parent::__construct(\$env); - $this->metadataBag->stampNew($lifetime); - $this->id = $this->generateId(); + \$this->parent = false; - return true; + \$this->blocks = array( + ); } - /** - * {@inheritdoc} - */ - public function getId() + protected function doDisplay(array \$context, array \$blocks = array()) { - return $this->id; + echo "foo"; } - /** - * {@inheritdoc} - */ - public function setId($id) + public function getTemplateName() { - if ($this->started) { - throw new \LogicException('Cannot set session ID after the session has started.'); - } - - $this->id = $id; + return "foo.twig"; } - /** - * {@inheritdoc} - */ - public function getName() + public function getDebugInfo() { - return $this->name; + return array (); } +} +EOF + , $twig); - /** - * {@inheritdoc} - */ - public function setName($name) - { - $this->name = $name; - } + $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 0), new Twig_Node_Expression_AssignName('macro', 0), 0); - /** - * {@inheritdoc} - */ - public function save() - { - // nothing to do since we don't persist the session data - $this->closed = false; - } + $body = new Twig_Node(array($import)); + $extends = new Twig_Node_Expression_Constant('layout.twig', 0); - /** - * {@inheritdoc} - */ - public function clear() + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<bags as $bag) { - $bag->clear(); - } + parent::__construct(\$env); - // clear out the session - $this->data = array(); + \$this->parent = \$this->env->loadTemplate("layout.twig"); - // reconnect the bags to the session - $this->loadSession(); + \$this->blocks = array( + ); } - /** - * {@inheritdoc} - */ - public function registerBag(SessionBagInterface $bag) + protected function doGetParent(array \$context) { - $this->bags[$bag->getName()] = $bag; + return "layout.twig"; } - /** - * {@inheritdoc} - */ - public function getBag($name) + protected function doDisplay(array \$context, array \$blocks = array()) { - if (!isset($this->bags[$name])) { - throw new \InvalidArgumentException(sprintf('The SessionBagInterface %s is not registered.', $name)); - } + \$context["macro"] = \$this->env->loadTemplate("foo.twig"); + \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); + } - if (!$this->started) { - $this->start(); - } + public function getTemplateName() + { + return "foo.twig"; + } - return $this->bags[$name]; + public function isTraitable() + { + return false; } - /** - * Sets the MetadataBag. - * - * @param MetadataBag $bag - */ - public function setMetadataBag(MetadataBag $bag = null) + public function getDebugInfo() { - if (null === $bag) { - $bag = new MetadataBag(); - } + return array (); + } +} +EOF + , $twig); + + $body = new Twig_Node(); + $extends = new Twig_Node_Expression_Conditional( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Expression_Constant('foo', 0), + new Twig_Node_Expression_Constant('foo', 0), + 0 + ); + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<metadataBag = $bag; +/* foo.twig */ +class __TwigTemplate_be925a7b06dda0dfdbd18a1509f7eb34 extends Twig_Template +{ + protected function doGetParent(array \$context) + { + return \$this->env->resolveTemplate(((true) ? ("foo") : ("foo"))); } - /** - * Gets the MetadataBag. - * - * @return MetadataBag - */ - public function getMetadataBag() + protected function doDisplay(array \$context, array \$blocks = array()) { - return $this->metadataBag; + \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks)); } - /** - * Generates a session ID. - * - * This doesn't need to be particularly cryptographically secure since this is just - * a mock. - * - * @return string - */ - protected function generateId() + public function getTemplateName() { - return sha1(uniqid(mt_rand())); + return "foo.twig"; } - protected function loadSession() + public function isTraitable() { - $bags = array_merge($this->bags, array($this->metadataBag)); + return false; + } - foreach ($bags as $bag) { - $key = $bag->getStorageKey(); - $this->data[$key] = isset($this->data[$key]) ? $this->data[$key] : array(); - $bag->initialize($this->data[$key]); - } + public function getDebugInfo() + { + return array (); + } +} +EOF + , $twig); - $this->started = true; - $this->closed = false; + return $tests; } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php similarity index 24% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php index 013fcb6..168663c 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php @@ -3,33 +3,41 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_PrintTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Print::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = new Twig_Node_Print($expr, 0); + + $this->assertEquals($expr, $node->getNode('expr')); } /** - * {@inheritdoc} + * @covers Twig_Node_Print::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 0), 0), 'echo "foo";'); + + return $tests; } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php similarity index 19% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php index 013fcb6..1610873 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php @@ -3,33 +3,55 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_SandboxTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Sandbox::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $body = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Sandbox($body, 0); + + $this->assertEquals($body, $node->getNode('body')); } /** - * {@inheritdoc} + * @covers Twig_Node_Sandbox::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $body = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Sandbox($body, 0); + + $tests[] = array($node, <<env->getExtension('sandbox'); +if (!\$alreadySandboxed = \$sandbox->isSandboxed()) { + \$sandbox->enableSandbox(); +} +echo "foo"; +if (!\$alreadySandboxed) { + \$sandbox->disableSandbox(); +} +EOF + ); + + return $tests; } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php similarity index 8% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php index 5d44b78..2ce0584 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Flash/AutoExpireFlashBagTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php @@ -1,155 +1,172 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\Tests\Session\Flash; +require_once dirname(__FILE__).'/TestCase.php'; -use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag as FlashBag; - -/** - * AutoExpireFlashBagTest - * - * @author Drak - */ -class AutoExpireFlashBagTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_SandboxedModuleTest extends Twig_Tests_Node_TestCase { /** - * @var \Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag + * @covers Twig_Node_SandboxedModule::__construct */ - private $bag; + public function testConstructor() + { + $body = new Twig_Node_Text('foo', 0); + $parent = new Twig_Node_Expression_Constant('layout.twig', 0); + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; + $node = new Twig_Node_Module($body, $parent, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $node = new Twig_Node_SandboxedModule($node, array('for'), array('upper'), array('cycle')); + + $this->assertEquals($body, $node->getNode('body')); + $this->assertEquals($blocks, $node->getNode('blocks')); + $this->assertEquals($macros, $node->getNode('macros')); + $this->assertEquals($parent, $node->getNode('parent')); + $this->assertEquals($filename, $node->getAttribute('filename')); + } /** - * @var array + * @covers Twig_Node_SandboxedModule::compile + * @covers Twig_Node_SandboxedModule::compileDisplayBody + * @covers Twig_Node_SandboxedModule::compileDisplayFooter + * @dataProvider getTests */ - protected $array = array(); - - protected function setUp() + public function testCompile($node, $source, $environment = null) { - parent::setUp(); - $this->bag = new FlashBag(); - $this->array = array('new' => array('notice' => array('A previous flash message'))); - $this->bag->initialize($this->array); + parent::testCompile($node, $source, $environment); } - public function tearDown() + public function getTests() { - $this->bag = null; - parent::tearDown(); - } + $twig = new Twig_Environment(new Twig_Loader_String()); + + $tests = array(); + + $body = new Twig_Node_Text('foo', 0); + $extends = null; + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; - public function testInitialize() + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $node = new Twig_Node_SandboxedModule($node, array('for'), array('upper'), array('cycle')); + + $tests[] = array($node, << array('notice' => array('A previous flash message'))); - $bag->initialize($array); - $this->assertEquals(array('A previous flash message'), $bag->peek('notice')); - $array = array('new' => array( - 'notice' => array('Something else'), - 'error' => array('a'), - )); - $bag->initialize($array); - $this->assertEquals(array('Something else'), $bag->peek('notice')); - $this->assertEquals(array('a'), $bag->peek('error')); + parent::__construct(\$env); + + \$this->parent = false; + + \$this->blocks = array( + ); } - public function testGetStorageKey() + protected function doDisplay(array \$context, array \$blocks = array()) { - $this->assertEquals('_sf2_flashes', $this->bag->getStorageKey()); - $attributeBag = new FlashBag('test'); - $this->assertEquals('test', $attributeBag->getStorageKey()); + \$this->checkSecurity(); + echo "foo"; } - public function testGetSetName() - { - $this->assertEquals('flashes', $this->bag->getName()); - $this->bag->setName('foo'); - $this->assertEquals('foo', $this->bag->getName()); + protected function checkSecurity() { + \$this->env->getExtension('sandbox')->checkSecurity( + array('upper'), + array('for'), + array('cycle') + ); } - public function testPeek() + public function getTemplateName() { - $this->assertEquals(array(), $this->bag->peek('non_existing')); - $this->assertEquals(array('default'), $this->bag->peek('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + return "foo.twig"; } - public function testSet() + public function getDebugInfo() { - $this->bag->set('notice', 'Foo'); - $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); + return array (); } +} +EOF + , $twig); + + $body = new Twig_Node(); + $extends = new Twig_Node_Expression_Constant('layout.twig', 0); + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $node = new Twig_Node_SandboxedModule($node, array('for'), array('upper'), array('cycle')); + + $tests[] = array($node, <<assertFalse($this->bag->has('nothing')); - $this->assertTrue($this->bag->has('notice')); + parent::__construct(\$env); + + \$this->parent = \$this->env->loadTemplate("layout.twig"); + + \$this->blocks = array( + ); } - public function testKeys() + protected function doGetParent(array \$context) { - $this->assertEquals(array('notice'), $this->bag->keys()); + return "layout.twig"; } - public function testPeekAll() + protected function doDisplay(array \$context, array \$blocks = array()) { - $array = array( - 'new' => array( - 'notice' => 'Foo', - 'error' => 'Bar', - ), - ); - - $this->bag->initialize($array); - $this->assertEquals(array( - 'notice' => 'Foo', - 'error' => 'Bar', - ), $this->bag->peekAll() - ); + \$this->checkSecurity(); + \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); + } - $this->assertEquals(array( - 'notice' => 'Foo', - 'error' => 'Bar', - ), $this->bag->peekAll() + protected function checkSecurity() { + \$this->env->getExtension('sandbox')->checkSecurity( + array('upper'), + array('for'), + array('cycle') ); } - public function testGet() + public function getTemplateName() { - $this->assertEquals(array(), $this->bag->get('non_existing')); - $this->assertEquals(array('default'), $this->bag->get('non_existing', array('default'))); - $this->assertEquals(array('A previous flash message'), $this->bag->get('notice')); - $this->assertEquals(array(), $this->bag->get('notice')); + return "foo.twig"; } - public function testSetAll() + public function isTraitable() { - $this->bag->setAll(array('a' => 'first', 'b' => 'second')); - $this->assertFalse($this->bag->has('a')); - $this->assertFalse($this->bag->has('b')); + return false; } - public function testAll() + public function getDebugInfo() { - $this->bag->set('notice', 'Foo'); - $this->bag->set('error', 'Bar'); - $this->assertEquals(array( - 'notice' => array('A previous flash message'), - ), $this->bag->all() - ); - - $this->assertEquals(array(), $this->bag->all()); + return array (); } +} +EOF + , $twig); - public function testClear() - { - $this->assertEquals(array('notice' => array('A previous flash message')), $this->bag->clear()); + return $tests; } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php similarity index 22% copy from core/vendor/Twig/Extension/Optimizer.php copy to core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php index 013fcb6..85adddf 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php @@ -3,33 +3,44 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_SandboxedPrintTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_SandboxedPrint::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $node = new Twig_Node_SandboxedPrint($expr = new Twig_Node_Expression_Constant('foo', 0), 0); + + $this->assertEquals($expr, $node->getNode('expr')); } /** - * {@inheritdoc} + * @covers Twig_Node_SandboxedPrint::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $tests[] = array(new Twig_Node_SandboxedPrint(new Twig_Node_Expression_Constant('foo', 0), 0), <<env->getExtension('sandbox')->ensureToStringAllowed("foo"); +EOF + ); + + return $tests; } } diff --git a/core/vendor/Twig/Extension.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php similarity index 10% rename from core/vendor/Twig/Extension.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php index 931fc03..6319fb6 100644 --- a/core/vendor/Twig/Extension.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php @@ -3,91 +3,71 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -abstract class Twig_Extension implements Twig_ExtensionInterface -{ - /** - * Initializes the runtime environment. - * - * This is where you can load some file that contains filter functions for instance. - * - * @param Twig_Environment $environment The current Twig_Environment instance - */ - public function initRuntime(Twig_Environment $environment) - { - } - /** - * Returns the token parser instances to add to the existing list. - * - * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances - */ - public function getTokenParsers() - { - return array(); - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_SetTest extends Twig_Tests_Node_TestCase +{ /** - * Returns the node visitor instances to add to the existing list. - * - * @return array An array of Twig_NodeVisitorInterface instances + * @covers Twig_Node_Set::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(); + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); + $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 0)), array(), 0); + $node = new Twig_Node_Set(false, $names, $values, 0); + + $this->assertEquals($names, $node->getNode('names')); + $this->assertEquals($values, $node->getNode('values')); + $this->assertEquals(false, $node->getAttribute('capture')); } /** - * Returns a list of filters to add to the existing list. - * - * @return array An array of filters + * @covers Twig_Node_Set::compile + * @dataProvider getTests */ - public function getFilters() + public function testCompile($node, $source, $environment = null) { - return array(); + parent::testCompile($node, $source, $environment); } - /** - * Returns a list of tests to add to the existing list. - * - * @return array An array of tests - */ public function getTests() { - return array(); - } + $tests = array(); - /** - * Returns a list of functions to add to the existing list. - * - * @return array An array of functions - */ - public function getFunctions() - { - return array(); - } + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); + $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 0)), array(), 0); + $node = new Twig_Node_Set(false, $names, $values, 0); + $tests[] = array($node, '$context["foo"] = "foo";'); - /** - * Returns a list of operators to add to the existing list. - * - * @return array An array of operators - */ - public function getOperators() - { - return array(); - } + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); + $values = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 0), 0)), array(), 0); + $node = new Twig_Node_Set(true, $names, $values, 0); + $tests[] = array($node, <<env->getCharset()); +EOF + ); - /** - * Returns a list of global variables to add to the existing list. - * - * @return array An array of global variables - */ - public function getGlobals() - { - return array(); + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); + $values = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Set(true, $names, $values, 0); + $tests[] = array($node, '$context["foo"] = (\'\' === $tmp = "foo") ? \'\' : new Twig_Markup($tmp, $this->env->getCharset());'); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0), new Twig_Node_Expression_AssignName('bar', 0)), array(), 0); + $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 0), new Twig_Node_Expression_Name('bar', 0)), array(), 0); + $node = new Twig_Node_Set(false, $names, $values, 0); + $tests[] = array($node, <<getVariableGetter('bar')}); +EOF + ); + + return $tests; } } diff --git a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/core/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php similarity index 20% rename from core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php index dc080db..55892f4 100644 --- a/core/vendor/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php @@ -1,46 +1,50 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\Routing\Tests\Annotation; +require_once dirname(__FILE__).'/TestCase.php'; -use Symfony\Component\Routing\Annotation\Route; - -class RouteTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_Node_SpacelessTest extends Twig_Tests_Node_TestCase { /** - * @expectedException \BadMethodCallException + * @covers Twig_Node_Spaceless::__construct */ - public function testInvalidRouteParameter() + public function testConstructor() { - $route = new Route(array('foo' => 'bar')); + $body = new Twig_Node(array(new Twig_Node_Text('
    foo
    ', 0))); + $node = new Twig_Node_Spaceless($body, 0); + + $this->assertEquals($body, $node->getNode('body')); } /** - * @dataProvider getValidParameters + * @covers Twig_Node_Spaceless::compile + * @dataProvider getTests */ - public function testRouteParameters($parameter, $value, $getter) + public function testCompile($node, $source, $environment = null) { - $route = new Route(array($parameter => $value)); - $this->assertEquals($route->$getter(), $value); + parent::testCompile($node, $source, $environment); } - public function getValidParameters() + public function getTests() { + $body = new Twig_Node(array(new Twig_Node_Text('
    foo
    ', 0))); + $node = new Twig_Node_Spaceless($body, 0); + return array( - array('value', '/Blog', 'getPattern'), - array('requirements', array('_method' => 'GET'), 'getRequirements'), - array('options', array('compiler_class' => 'RouteCompiler'), 'getOptions'), - array('name', 'blog_index', 'getName'), - array('defaults', array('_controller' => 'MyBlogBundle:Blog:index'), 'getDefaults') + array($node, <<
    foo
    "; +echo trim(preg_replace('/>\s+<', ob_get_clean())); +EOF + ), ); } } - diff --git a/core/vendor/Twig/Function.php b/core/vendor/twig/twig/test/Twig/Tests/Node/TestCase.php similarity index 17% rename from core/vendor/Twig/Function.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/TestCase.php index cd7643f..f142529 100644 --- a/core/vendor/Twig/Function.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/TestCase.php @@ -3,61 +3,56 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -/** - * Represents a template function. - * - * @package twig - * @author Fabien Potencier - */ -abstract class Twig_Function implements Twig_FunctionInterface +abstract class Twig_Tests_Node_TestCase extends PHPUnit_Framework_TestCase { - protected $options; - protected $arguments = array(); + abstract public function getTests(); - public function __construct(array $options = array()) + /** + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) { - $this->options = array_merge(array( - 'needs_environment' => false, - 'needs_context' => false, - ), $options); + $this->assertNodeCompilation($source, $node, $environment); } - public function setArguments($arguments) + public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null) { - $this->arguments = $arguments; - } + $compiler = $this->getCompiler($environment); + $compiler->compile($node); - public function getArguments() - { - return $this->arguments; + $this->assertEquals($source, trim($compiler->getSource())); } - public function needsEnvironment() + protected function getCompiler(Twig_Environment $environment = null) { - return $this->options['needs_environment']; + return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); } - public function needsContext() + protected function getEnvironment() { - return $this->options['needs_context']; + return new Twig_Environment(); } - public function getSafe(Twig_Node $functionArgs) + protected function getVariableGetter($name) { - if (isset($this->options['is_safe'])) { - return $this->options['is_safe']; + if (version_compare(phpversion(), '5.4.0RC1', '>=')) { + return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); } - if (isset($this->options['is_safe_callback'])) { - return call_user_func($this->options['is_safe_callback'], $functionArgs); + return sprintf('$this->getContext($context, "%s")', $name); + } + + protected function getAttributeGetter() + { + if (function_exists('twig_template_get_attributes')) { + return 'twig_template_get_attributes($this, '; } - return array(); + return '$this->getAttribute('; } } diff --git a/core/vendor/Twig/Extension/Optimizer.php b/core/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php similarity index 27% rename from core/vendor/Twig/Extension/Optimizer.php rename to core/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php index 013fcb6..87e0337 100644 --- a/core/vendor/Twig/Extension/Optimizer.php +++ b/core/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php @@ -3,33 +3,40 @@ /* * This file is part of Twig. * - * (c) 2010 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Extension_Optimizer extends Twig_Extension -{ - protected $optimizers; - public function __construct($optimizers = -1) - { - $this->optimizers = $optimizers; - } +require_once dirname(__FILE__).'/TestCase.php'; +class Twig_Tests_Node_TextTest extends Twig_Tests_Node_TestCase +{ /** - * {@inheritdoc} + * @covers Twig_Node_Text::__construct */ - public function getNodeVisitors() + public function testConstructor() { - return array(new Twig_NodeVisitor_Optimizer($this->optimizers)); + $node = new Twig_Node_Text('foo', 0); + + $this->assertEquals('foo', $node->getAttribute('data')); } /** - * {@inheritdoc} + * @covers Twig_Node_Text::compile + * @dataProvider getTests */ - public function getName() + public function testCompile($node, $source, $environment = null) { - return 'optimizer'; + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Text('foo', 0), 'echo "foo";'); + + return $tests; } } diff --git a/core/vendor/Symfony/Component/Yaml/Tests/ParserTest.php b/core/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php similarity index 8% rename from core/vendor/Symfony/Component/Yaml/Tests/ParserTest.php rename to core/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php index 98689ae..a55d98e 100644 --- a/core/vendor/Symfony/Component/Yaml/Tests/ParserTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php @@ -1,148 +1,118 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ +class Twig_Tests_NodeVisitor_OptimizerTest extends PHPUnit_Framework_TestCase +{ + public function testRenderBlockOptimizer() + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); -namespace Symfony\Component\Yaml\Tests; + $stream = $env->parse($env->tokenize('{{ block("foo") }}', 'index')); -use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Yaml\Exception\ParseException; + $node = $stream->getNode('body')->getNode(0); -class ParserTest extends \PHPUnit_Framework_TestCase -{ - protected $parser; + $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertTrue($node->getAttribute('output')); + } - protected function setUp() + public function testRenderParentBlockOptimizer() { - $this->parser = new Parser(); + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); + + $stream = $env->parse($env->tokenize('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index')); + + $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body'); + + $this->assertEquals('Twig_Node_Expression_Parent', get_class($node)); + $this->assertTrue($node->getAttribute('output')); } - protected function tearDown() + public function testRenderVariableBlockOptimizer() { - $this->parser = null; + if (version_compare(phpversion(), '5.4.0RC1', '>=')) { + return; + } + + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); + $stream = $env->parse($env->tokenize('{{ block(name|lower) }}', 'index')); + + $node = $stream->getNode('body')->getNode(0)->getNode(1); + + $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertTrue($node->getAttribute('output')); } /** - * @dataProvider getDataFormSpecifications + * @dataProvider getTestsForForOptimizer */ - public function testSpecifications($file, $expected, $yaml, $comment) + public function testForOptimizer($template, $expected) { - if ('escapedCharacters' == $file) { - if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { - $this->markTestSkipped('The iconv and mbstring extensions are not available.'); - } - } + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); + + $stream = $env->parse($env->tokenize($template, 'index')); - $this->assertEquals($expected, var_export($this->parser->parse($yaml), true), $comment); + foreach ($expected as $target => $withLoop) { + $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : '')); + } } - public function getDataFormSpecifications() + public function getTestsForForOptimizer() { - $parser = new Parser(); - $path = __DIR__.'/Fixtures'; - - $tests = array(); - $files = $parser->parse(file_get_contents($path.'/index.yml')); - foreach ($files as $file) { - $yamls = file_get_contents($path.'/'.$file.'.yml'); - - // split YAMLs documents - foreach (preg_split('/^---( %YAML\:1\.0)?/m', $yamls) as $yaml) { - if (!$yaml) { - continue; - } + return array( + array('{% for i in foo %}{% endfor %}', array('i' => false)), - $test = $parser->parse($yaml); - if (isset($test['todo']) && $test['todo']) { - // TODO - } else { - $expected = var_export(eval('return '.trim($test['php']).';'), true); + array('{% for i in foo %}{{ loop.index }}{% endfor %}', array('i' => true)), - $tests[] = array($file, $expected, $test['yaml'], $test['test']); - } - } - } + array('{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), - return $tests; - } + array('{% for i in foo %}{% include "foo" %}{% endfor %}', array('i' => true)), - public function testTabsInYaml() - { - // test tabs in YAML - $yamls = array( - "foo:\n bar", - "foo:\n bar", - "foo:\n bar", - "foo:\n bar", - ); + array('{% for i in foo %}{% include "foo" only %}{% endfor %}', array('i' => false)), - foreach ($yamls as $yaml) { - try { - $content = $this->parser->parse($yaml); + array('{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', array('i' => false)), - $this->fail('YAML files must not contain tabs'); - } catch (\Exception $e) { - $this->assertInstanceOf('\Exception', $e, 'YAML files must not contain tabs'); - $this->assertEquals('A YAML file cannot contain tabs as indentation at line 2 (near "'.strpbrk($yaml, "\t").'").', $e->getMessage(), 'YAML files must not contain tabs'); - } - } - } + array('{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', array('i' => true)), - public function testEndOfTheDocumentMarker() - { - $yaml = << false, 'j' => true)), - $this->assertEquals('foo', $this->parser->parse($yaml)); - } + array('{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), - public function testObjectsSupport() - { - $b = array('foo' => new B(), 'bar' => 1); - $this->assertEquals($this->parser->parse(<<parse() is able to dump objects'); + array('{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => false)), + + array('{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), + + array('{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), + ); } - public function testNonUtf8Exception() + public function checkForConfiguration(Twig_NodeInterface $node = null, $target, $withLoop) { - if (!function_exists('mb_detect_encoding') || !function_exists('iconv')) { - $this->markTestSkipped('Exceptions for non-utf8 charsets require the mb_detect_encoding() and iconv() functions.'); - + if (null === $node) { return; } - $yamls = array( - iconv("UTF-8", "ISO-8859-1", "foo: 'äöüß'"), - iconv("UTF-8", "ISO-8859-15", "euro: '€'"), - iconv("UTF-8", "CP1252", "cp1252: '©ÉÇáñ'") - ); - - foreach ($yamls as $yaml) { - try { - $this->parser->parse($yaml); + foreach ($node as $n) { + if ($n instanceof Twig_Node_For) { + if ($target === $n->getNode('value_target')->getAttribute('name')) { + return $withLoop == $n->getAttribute('with_loop'); + } + } - $this->fail('charsets other than UTF-8 are rejected.'); - } catch (\Exception $e) { - $this->assertInstanceOf('Symfony\Component\Yaml\Exception\ParseException', $e, 'charsets other than UTF-8 are rejected.'); + $ret = $this->checkForConfiguration($n, $target, $withLoop); + if (null !== $ret) { + return $ret; } } } } - -class B -{ - public $b = 'foo'; -} diff --git a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/core/vendor/twig/twig/test/Twig/Tests/ParserTest.php similarity index 8% rename from core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php rename to core/vendor/twig/twig/test/Twig/Tests/ParserTest.php index 432499e..76f257a 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ b/core/vendor/twig/twig/test/Twig/Tests/ParserTest.php @@ -1,171 +1,160 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -namespace Symfony\Component\HttpFoundation\Tests; - -use Symfony\Component\HttpFoundation\Session\Attribute\NamespacedAttributeBag; - -/** - * Tests NamespacedAttributeBag - * - * @author Drak - */ -class NamespacedAttributeBagTest extends \PHPUnit_Framework_TestCase +class Twig_Tests_ParserTest extends PHPUnit_Framework_TestCase { /** - * @var array + * @expectedException Twig_Error_Syntax */ - private $array; + public function testSetMacroThrowsExceptionOnReservedMethods() + { + $parser = new Twig_Parser(new Twig_Environment()); + $parser->setMacro('display', $this->getMock('Twig_Node_Macro', array(), array(), '', null)); + } /** - * @var NamespacedAttributeBag + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown tag name "foo". Did you mean "for" at line 0 */ - private $bag; - - protected function setUp() + public function testUnkownTag() { - $this->array = array( - 'hello' => 'world', - 'always' => 'be happy', - 'user.login' => 'drak', - 'csrf.token' => array( - 'a' => '1234', - 'b' => '4321', - ), - 'category' => array( - 'fishing' => array( - 'first' => 'cod', - 'second' => 'sole') - ), - ); - $this->bag = new NamespacedAttributeBag('_sf2', '/'); - $this->bag->initialize($this->array); + $stream = new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 0), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 0), + new Twig_Token(Twig_Token::EOF_TYPE, '', 0), + )); + $parser = new Twig_Parser(new Twig_Environment()); + $parser->parse($stream); } - protected function tearDown() + /** + * @dataProvider getFilterBodyNodesData + */ + public function testFilterBodyNodes($input, $expected) { - $this->bag = null; - $this->array = array(); - } + $parser = $this->getParserForFilterBodyNodes(); - public function testInitialize() - { - $bag = new NamespacedAttributeBag(); - $bag->initialize($this->array); - $this->assertEquals($this->array, $this->bag->all()); - $array = array('should' => 'not stick'); - $bag->initialize($array); - - // should have remained the same - $this->assertEquals($this->array, $this->bag->all()); + $this->assertEquals($expected, $parser->filterBodyNodes($input)); } - public function testGetStorageKey() + public function getFilterBodyNodesData() { - $this->assertEquals('_sf2', $this->bag->getStorageKey()); - $attributeBag = new NamespacedAttributeBag('test'); - $this->assertEquals('test', $attributeBag->getStorageKey()); + return array( + array( + new Twig_Node(array(new Twig_Node_Text(' ', 0))), + new Twig_Node(array()), + ), + array( + $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 0))), + $input, + ), + array( + $input = new Twig_Node(array(new Twig_Node_Set(true, new Twig_Node(), new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 0))))), 0))), + $input, + ), + ); } /** - * @dataProvider attributesProvider + * @dataProvider getFilterBodyNodesDataThrowsException + * @expectedException Twig_Error_Syntax */ - public function testHas($key, $value, $exists) + public function testFilterBodyNodesThrowsException($input) { - $this->assertEquals($exists, $this->bag->has($key)); - } + $parser = $this->getParserForFilterBodyNodes(); - /** - * @dataProvider attributesProvider - */ - public function testGet($key, $value, $expected) - { - $this->assertEquals($value, $this->bag->get($key)); + $parser->filterBodyNodes($input); } - public function testGetDefaults() + public function getFilterBodyNodesDataThrowsException() { - $this->assertNull($this->bag->get('user2.login')); - $this->assertEquals('default', $this->bag->get('user2.login', 'default')); + return array( + array(new Twig_Node_Text('foo', 0)), + array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 0)))))), + ); } /** - * @dataProvider attributesProvider + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage A template that extends another one cannot have a body but a byte order mark (BOM) has been detected; it must be removed at line 0. */ - public function testSet($key, $value, $expected) + public function testFilterBodyNodesWithBOM() { - $this->bag->set($key, $value); - $this->assertEquals($value, $this->bag->get($key)); + $parser = $this->getParserForFilterBodyNodes(); + $parser->filterBodyNodes(new Twig_Node_Text(chr(0xEF).chr(0xBB).chr(0xBF), 0)); } - public function testAll() + public function testParseIsReentrant() { - $this->assertEquals($this->array, $this->bag->all()); - - $this->bag->set('hello', 'fabien'); - $array = $this->array; - $array['hello'] = 'fabien'; - $this->assertEquals($array, $this->bag->all()); + $twig = new Twig_Environment(null, array( + 'autoescape' => false, + 'optimizations' => 0, + )); + $twig->addTokenParser(new TestTokenParser()); + + $parser = new Twig_Parser($twig); + + $parser->parse(new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'test', 0), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 0), + new Twig_Token(Twig_Token::VAR_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 0), + new Twig_Token(Twig_Token::VAR_END_TYPE, '', 0), + new Twig_Token(Twig_Token::EOF_TYPE, '', 0), + ))); + + $this->assertEquals(null, $parser->getParent()); } - public function testReplace() + protected function getParserForFilterBodyNodes() { - $array = array(); - $array['name'] = 'jack'; - $array['foo.bar'] = 'beep'; - $this->bag->replace($array); - $this->assertEquals($array, $this->bag->all()); - $this->assertNull($this->bag->get('hello')); - $this->assertNull($this->bag->get('always')); - $this->assertNull($this->bag->get('user.login')); - } + $parser = new TestParser(new Twig_Environment()); + $parser->setParent(new Twig_Node()); + $parser->stream = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock(); - public function testRemove() - { - $this->assertEquals('world', $this->bag->get('hello')); - $this->bag->remove('hello'); - $this->assertNull($this->bag->get('hello')); + return $parser; + } +} - $this->assertEquals('be happy', $this->bag->get('always')); - $this->bag->remove('always'); - $this->assertNull($this->bag->get('always')); +class TestParser extends Twig_Parser +{ + public $stream; - $this->assertEquals('drak', $this->bag->get('user.login')); - $this->bag->remove('user.login'); - $this->assertNull($this->bag->get('user.login')); + public function filterBodyNodes(Twig_NodeInterface $node) + { + return parent::filterBodyNodes($node); } +} - public function testClear() +class TestTokenParser extends Twig_TokenParser +{ + public function parse(Twig_Token $token) { - $this->bag->clear(); - $this->assertEquals(array(), $this->bag->all()); + // simulate the parsing of another template right in the middle of the parsing of the current template + $this->parser->parse(new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'extends', 0), + new Twig_Token(Twig_Token::STRING_TYPE, 'base', 0), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 0), + new Twig_Token(Twig_Token::EOF_TYPE, '', 0), + ))); + + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node(array()); } - public function attributesProvider() + public function getTag() { - return array( - array('hello', 'world', true), - array('always', 'be happy', true), - array('user.login', 'drak', true), - array('csrf.token', array('a' => '1234', 'b' => '4321'), true), - array('csrf.token/a', '1234', true), - array('csrf.token/b', '4321', true), - array('category', array('fishing' => array('first' => 'cod', 'second' => 'sole')), true), - array('category/fishing', array('first' => 'cod', 'second' => 'sole'), true), - array('category/fishing/first', 'cod', true), - array('category/fishing/second', 'sole', true), - array('user2.login', null, false), - array('never', null, false), - array('bye', null, false), - array('bye/for/now', null, false), - ); + return 'test'; } } diff --git a/core/vendor/Twig/Parser.php b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php similarity index 6% rename from core/vendor/Twig/Parser.php rename to core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php index 8c578fd..4213e2b 100644 --- a/core/vendor/Twig/Parser.php +++ b/core/vendor/twig/twig/test/Twig/Tests/TemplateTest.php @@ -3,382 +3,375 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier - * (c) 2009 Armin Ronacher + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ - -/** - * Default parser implementation. - * - * @package twig - * @author Fabien Potencier - */ -class Twig_Parser implements Twig_ParserInterface +class Twig_Tests_TemplateTest extends PHPUnit_Framework_TestCase { - protected $stack = array(); - protected $stream; - protected $parent; - protected $handlers; - protected $visitors; - protected $expressionParser; - protected $blocks; - protected $blockStack; - protected $macros; - protected $env; - protected $reservedMacroNames; - protected $importedFunctions; - protected $tmpVarCount; - protected $traits; - protected $embeddedTemplates = array(); + /** + * @expectedException Twig_Error_Runtime + * @expectedExceptionMessage Impossible to access a key ("a") on a "string" variable + */ + public function testAttributeOnAString() + { + $template = new Twig_TemplateTest( + new Twig_Environment(null, array('strict_variables' => true)), + false + ); + + $template->getAttribute('string', 'a', array(), Twig_TemplateInterface::ARRAY_CALL, false); + } /** - * Constructor. - * - * @param Twig_Environment $env A Twig_Environment instance + * @dataProvider getGetAttributeTests */ - public function __construct(Twig_Environment $env) + public function testGetAttribute($defined, $value, $object, $item, $arguments, $type, $useExt = false) { - $this->env = $env; + $template = new Twig_TemplateTest( + new Twig_Environment(), + $useExt + ); + + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); } - public function getEnvironment() + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false, $exceptionMessage = null) { - return $this->env; + $template = new Twig_TemplateTest( + new Twig_Environment(null, array('strict_variables' => true)), + $useExt + ); + + if ($defined) { + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } else { + try { + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + + throw new Exception('Expected Twig_Error_Runtime exception.'); + } catch (Twig_Error_Runtime $e) { + if (null !== $exceptionMessage) { + $this->assertSame($exceptionMessage, $e->getMessage()); + } + } + } } - public function getVarName() + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type, $useExt = false) { - return sprintf('__internal_%s_%d', substr($this->env->getTemplateClass($this->stream->getFilename()), strlen($this->env->getTemplateClassPrefix())), ++$this->tmpVarCount); + $template = new Twig_TemplateTest( + new Twig_Environment(), + $useExt + ); + + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); } /** - * Converts a token stream to a node tree. - * - * @param Twig_TokenStream $stream A token stream instance - * - * @return Twig_Node_Module A node tree + * @dataProvider getGetAttributeTests */ - public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false) + public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false) { - // push all variables into the stack to keep the current state of the parser - $vars = get_object_vars($this); - unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser']); - $this->stack[] = $vars; + $template = new Twig_TemplateTest( + new Twig_Environment(null, array('strict_variables' => true)), + $useExt + ); - $this->tmpVarCount = 0; + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); + } - // tag handlers - if (null === $this->handlers) { - $this->handlers = $this->env->getTokenParsers(); - $this->handlers->setParser($this); - } + public function getGetAttributeTests() + { + $array = array( + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + ); + + $objectArray = new Twig_TemplateArrayAccessObject(); + $stdObject = (object) $array; + $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); + $propertyObject = new Twig_TemplatePropertyObject(); + $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); + $methodObject = new Twig_TemplateMethodObject(); + $magicMethodObject = new Twig_TemplateMagicMethodObject(); + + $anyType = Twig_TemplateInterface::ANY_CALL; + $methodType = Twig_TemplateInterface::METHOD_CALL; + $arrayType = Twig_TemplateInterface::ARRAY_CALL; + + $basicTests = array( + // array(defined, value, property to fetch) + array(true, 'defined', 'defined'), + array(false, null, 'undefined'), + array(false, null, 'protected'), + array(true, 0, 'zero'), + array(true, 1, 1), + array(true, 1, 1.0), + array(true, null, 'null'), + ); + $testObjects = array( + // array(object, type of fetch) + array($array, $arrayType), + array($objectArray, $arrayType), + array($stdObject, $anyType), + array($magicPropertyObject, $anyType), + array($methodObject, $methodType), + array($methodObject, $anyType), + array($propertyObject, $anyType), + array($propertyObject1, $anyType), + ); + + $tests = array(); + foreach ($testObjects as $testObject) { + foreach ($basicTests as $test) { + // properties cannot be numbers + if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { + continue; + } - // node visitors - if (null === $this->visitors) { - $this->visitors = $this->env->getNodeVisitors(); + $tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]); + } } - if (null === $this->expressionParser) { - $this->expressionParser = new Twig_ExpressionParser($this, $this->env->getUnaryOperators(), $this->env->getBinaryOperators()); + // additional method tests + $tests = array_merge($tests, array( + array(true, 'defined', $methodObject, 'defined', array(), $methodType), + array(true, 'defined', $methodObject, 'DEFINED', array(), $methodType), + array(true, 'defined', $methodObject, 'getDefined', array(), $methodType), + array(true, 'defined', $methodObject, 'GETDEFINED', array(), $methodType), + array(true, 'static', $methodObject, 'static', array(), $methodType), + array(true, 'static', $methodObject, 'getStatic', array(), $methodType), + + array(true, '__call_undefined', $magicMethodObject, 'undefined', array(), $methodType), + array(true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', array(), $methodType), + )); + + // add the same tests for the any type + foreach ($tests as $test) { + if ($anyType !== $test[5]) { + $test[5] = $anyType; + $tests[] = $test; + } } - $this->stream = $stream; - $this->parent = null; - $this->blocks = array(); - $this->macros = array(); - $this->traits = array(); - $this->blockStack = array(); - $this->importedFunctions = array(array()); - $this->embeddedTemplates = array(); - - try { - $body = $this->subparse($test, $dropNeedle); - - if (null !== $this->parent) { - if (null === $body = $this->filterBodyNodes($body)) { - $body = new Twig_Node(); - } - } - } catch (Twig_Error_Syntax $e) { - if (null === $e->getTemplateFile()) { - $e->setTemplateFile($this->stream->getFilename()); - } + $methodAndPropObject = new Twig_TemplateMethodAndPropObject; - throw $e; - } + // additional method tests + $tests = array_merge($tests, array( + array(true, 'a', $methodAndPropObject, 'a', array(), $anyType), + array(true, 'a', $methodAndPropObject, 'a', array(), $methodType), + array(false, null, $methodAndPropObject, 'a', array(), $arrayType), - $node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $this->stream->getFilename()); + array(true, 'b_prop', $methodAndPropObject, 'b', array(), $anyType), + array(true, 'b', $methodAndPropObject, 'B', array(), $anyType), + array(true, 'b', $methodAndPropObject, 'b', array(), $methodType), + array(true, 'b', $methodAndPropObject, 'B', array(), $methodType), + array(false, null, $methodAndPropObject, 'b', array(), $arrayType), - $traverser = new Twig_NodeTraverser($this->env, $this->visitors); + array(false, null, $methodAndPropObject, 'c', array(), $anyType), + array(false, null, $methodAndPropObject, 'c', array(), $methodType), + array(false, null, $methodAndPropObject, 'c', array(), $arrayType), - $node = $traverser->traverse($node); + )); - // restore previous stack so previous parse() call can resume working - foreach (array_pop($this->stack) as $key => $val) { - $this->$key = $val; - } + // tests when input is not an array or object + $tests = array_merge($tests, array( + array(false, null, 42, 'a', array(), $anyType, false, 'Item "a" for "42" does not exist'), + array(false, null, "string", 'a', array(), $anyType, false, 'Item "a" for "string" does not exist'), + array(false, null, array(), 'a', array(), $anyType, false, 'Item "a" for "Array" does not exist'), + )); - return $node; - } + // add twig_template_get_attributes tests - public function subparse($test, $dropNeedle = false) - { - $lineno = $this->getCurrentToken()->getLine(); - $rv = array(); - while (!$this->stream->isEOF()) { - switch ($this->getCurrentToken()->getType()) { - case Twig_Token::TEXT_TYPE: - $token = $this->stream->next(); - $rv[] = new Twig_Node_Text($token->getValue(), $token->getLine()); - break; - - case Twig_Token::VAR_START_TYPE: - $token = $this->stream->next(); - $expr = $this->expressionParser->parseExpression(); - $this->stream->expect(Twig_Token::VAR_END_TYPE); - $rv[] = new Twig_Node_Print($expr, $token->getLine()); - break; - - case Twig_Token::BLOCK_START_TYPE: - $this->stream->next(); - $token = $this->getCurrentToken(); - - if ($token->getType() !== Twig_Token::NAME_TYPE) { - throw new Twig_Error_Syntax('A block must start with a tag name', $token->getLine(), $this->stream->getFilename()); - } - - if (null !== $test && call_user_func($test, $token)) { - if ($dropNeedle) { - $this->stream->next(); - } - - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); - } - - $subparser = $this->handlers->getTokenParser($token->getValue()); - if (null === $subparser) { - if (null !== $test) { - throw new Twig_Error_Syntax(sprintf('Unexpected tag name "%s" (expecting closing tag for the "%s" tag defined near line %s)', $token->getValue(), $test[0]->getTag(), $lineno), $token->getLine(), $this->stream->getFilename()); - } - - $message = sprintf('Unknown tag name "%s"', $token->getValue()); - if ($alternatives = $this->env->computeAlternatives($token->getValue(), array_keys($this->env->getTags()))) { - $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); - } - - throw new Twig_Error_Syntax($message, $token->getLine(), $this->stream->getFilename()); - } - - $this->stream->next(); - - $node = $subparser->parse($token); - if (null !== $node) { - $rv[] = $node; - } - break; - - default: - throw new Twig_Error_Syntax('Lexer or parser ended up in unsupported state.', -1, $this->stream->getFilename()); + if (function_exists('twig_template_get_attributes')) { + foreach(array_slice($tests, 0) as $test) { + $test = array_pad($test, 7, null); + $test[6] = true; + $tests[] = $test; } } - if (1 === count($rv)) { - return $rv[0]; - } - - return new Twig_Node($rv, array(), $lineno); + return $tests; } - public function addHandler($name, $class) + public function useExtGetAttribute() { - $this->handlers[$name] = $class; + return false; } +} + +class Twig_TemplateTest extends Twig_Template +{ + protected $useExtGetAttribute = false; - public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) + public function __construct(Twig_Environment $env, $useExtGetAttribute = false) { - $this->visitors[] = $visitor; + parent::__construct($env); + $this->useExtGetAttribute = $useExtGetAttribute; + Twig_Template::clearCache(); } - public function getBlockStack() + public function getTemplateName() { - return $this->blockStack; } - public function peekBlockStack() + public function getDebugInfo() { - return $this->blockStack[count($this->blockStack) - 1]; + return array(); } - public function popBlockStack() + protected function doGetParent(array $context) { - array_pop($this->blockStack); } - public function pushBlockStack($name) + protected function doDisplay(array $context, array $blocks = array()) { - $this->blockStack[] = $name; } - public function hasBlock($name) + public function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) { - return isset($this->blocks[$name]); + if ($this->useExtGetAttribute) { + return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } else { + return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } } +} - public function getBlock($name) +class Twig_TemplateArrayAccessObject implements ArrayAccess +{ + protected $protected = 'protected'; + + public $attributes = array( + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + ); + + public function offsetExists($name) { - return $this->blocks[$name]; + return array_key_exists($name, $this->attributes); } - public function setBlock($name, $value) + public function offsetGet($name) { - $this->blocks[$name] = new Twig_Node_Body(array($value), array(), $value->getLine()); + return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; } - public function hasMacro($name) + public function offsetSet($name, $value) { - return isset($this->macros[$name]); } - public function setMacro($name, Twig_Node_Macro $node) + public function offsetUnset($name) { - if (null === $this->reservedMacroNames) { - $this->reservedMacroNames = array(); - $r = new ReflectionClass($this->env->getBaseTemplateClass()); - foreach ($r->getMethods() as $method) { - $this->reservedMacroNames[] = $method->getName(); - } - } + } +} - if (in_array($name, $this->reservedMacroNames)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node->getLine()); - } +class Twig_TemplateMagicPropertyObject +{ + public $defined = 'defined'; - $this->macros[$name] = $node; - } + public $attributes = array( + 'zero' => 0, + 'null' => null, + '1' => 1, + ); + + protected $protected = 'protected'; - public function addTrait($trait) + public function __isset($name) { - $this->traits[] = $trait; + return array_key_exists($name, $this->attributes); } - public function hasTraits() + public function __get($name) { - return count($this->traits) > 0; + return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; } +} - public function embedTemplate(Twig_Node_Module $template) - { - $template->setIndex(count($this->embeddedTemplates) + 1); +class Twig_TemplatePropertyObject +{ + public $defined = 'defined'; + public $zero = 0; + public $null = null; - $this->embeddedTemplates[] = $template; - } + protected $protected = 'protected'; +} - public function addImportedFunction($alias, $name, Twig_Node_Expression $node) +class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements IteratorAggregate +{ + public function getIterator() { - $this->importedFunctions[0][$alias] = array('name' => $name, 'node' => $node); + return new ArrayIterator(array('foo', 'bar')); } +} - public function getImportedFunction($alias) +class Twig_TemplateMethodObject +{ + public function getDefined() { - foreach ($this->importedFunctions as $functions) { - if (isset($functions[$alias])) { - return $functions[$alias]; - } - } + return 'defined'; } - public function isMainScope() + public function get1() { - return 1 === count($this->importedFunctions); + return 1; } - public function pushLocalScope() + public function getZero() { - array_unshift($this->importedFunctions, array()); + return 0; } - public function popLocalScope() + public function getNull() { - array_shift($this->importedFunctions); + return null; } - /** - * Gets the expression parser. - * - * @return Twig_ExpressionParser The expression parser - */ - public function getExpressionParser() + protected function getProtected() { - return $this->expressionParser; + return 'protected'; } - public function getParent() + static public function getStatic() { - return $this->parent; + return 'static'; } +} - public function setParent($parent) - { - $this->parent = $parent; +class Twig_TemplateMethodAndPropObject +{ + private $a = 'a_prop'; + public function getA() { + return 'a'; } - /** - * Gets the token stream. - * - * @return Twig_TokenStream The token stream - */ - public function getStream() - { - return $this->stream; + public $b = 'b_prop'; + public function getB() { + return 'b'; } - /** - * Gets the current token. - * - * @return Twig_Token The current token - */ - public function getCurrentToken() - { - return $this->stream->getCurrent(); + private $c = 'c_prop'; + private function getC() { + return 'c'; } +} - protected function filterBodyNodes(Twig_NodeInterface $node) - { - // check that the body does not contain non-empty output nodes - if ( - ($node instanceof Twig_Node_Text && !ctype_space($node->getAttribute('data'))) - || - (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference && $node instanceof Twig_NodeOutputInterface) - ) { - if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) { - throw new Twig_Error_Syntax('A template that extends another one cannot have a body but a byte order mark (BOM) has been detected; it must be removed.', $node->getLine(), $this->stream->getFilename()); - } - - throw new Twig_Error_Syntax('A template that extends another one cannot have a body.', $node->getLine(), $this->stream->getFilename()); - } - - // bypass "set" nodes as they "capture" the output - if ($node instanceof Twig_Node_Set) { - return $node; - } - - if ($node instanceof Twig_NodeOutputInterface) { - return; - } - - foreach ($node as $k => $n) { - if (null !== $n && null === $n = $this->filterBodyNodes($n)) { - $node->removeNode($k); - } - } - - return $node; +class Twig_TemplateMagicMethodObject +{ + public function __call($method, $arguments) { + return '__call_'.$method; } } diff --git a/core/vendor/Twig/Autoloader.php b/core/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php similarity index 17% rename from core/vendor/Twig/Autoloader.php rename to core/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php index 0f62884..794a037 100644 --- a/core/vendor/Twig/Autoloader.php +++ b/core/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php @@ -3,44 +3,39 @@ /* * This file is part of Twig. * - * (c) 2009 Fabien Potencier + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -/** - * Autoloads Twig classes. - * - * @package twig - * @author Fabien Potencier - */ -class Twig_Autoloader +class Twig_Tests_TokenStreamTest extends PHPUnit_Framework_TestCase { - /** - * Registers Twig_Autoloader as an SPL autoloader. - */ - static public function register() + static protected $tokens; + + public function setUp() { - ini_set('unserialize_callback_func', 'spl_autoload_call'); - spl_autoload_register(array(new self, 'autoload')); + self::$tokens = array( + new Twig_Token(Twig_Token::TEXT_TYPE, 1, 0), + new Twig_Token(Twig_Token::TEXT_TYPE, 2, 0), + new Twig_Token(Twig_Token::TEXT_TYPE, 3, 0), + new Twig_Token(Twig_Token::TEXT_TYPE, 4, 0), + new Twig_Token(Twig_Token::TEXT_TYPE, 5, 0), + new Twig_Token(Twig_Token::TEXT_TYPE, 6, 0), + new Twig_Token(Twig_Token::TEXT_TYPE, 7, 0), + new Twig_Token(Twig_Token::EOF_TYPE, 0, 0), + ); } - /** - * Handles autoloading of classes. - * - * @param string $class A class name. - * - * @return boolean Returns true if the class has been loaded - */ - static public function autoload($class) + public function testNext() { - if (0 !== strpos($class, 'Twig')) { - return; - } + $stream = new Twig_TokenStream(self::$tokens); + $repr = array(); + while (!$stream->isEOF()) { + $token = $stream->next(); - if (is_file($file = dirname(__FILE__).'/../'.str_replace(array('_', "\0"), array('/', ''), $class).'.php')) { - require $file; + $repr[] = $token->getValue(); } + $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token'); } } diff --git a/core/vendor/Symfony/Component/HttpFoundation/Session/Session.php b/core/vendor/twig/twig/test/Twig/Tests/integrationTest.php similarity index 6% rename from core/vendor/Symfony/Component/HttpFoundation/Session/Session.php rename to core/vendor/twig/twig/test/Twig/Tests/integrationTest.php index 0c40c1c..b905b56 100644 --- a/core/vendor/Symfony/Component/HttpFoundation/Session/Session.php +++ b/core/vendor/twig/twig/test/Twig/Tests/integrationTest.php @@ -1,335 +1,322 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\Session; - -use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; -use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; -use Symfony\Component\HttpFoundation\Session\SessionBagInterface; -use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; +// This function is defined to check that escaping strategies +// like html works even if a function with the same name is defined. +function html() +{ + return 'foo'; +} -/** - * Session. - * - * @author Fabien Potencier - * @author Drak - * - * @api - */ -class Session implements SessionInterface, \IteratorAggregate, \Countable +class Twig_Tests_IntegrationTest extends PHPUnit_Framework_TestCase { - /** - * Storage driver. - * - * @var SessionStorageInterface - */ - protected $storage; + public function getTests() + { + $fixturesDir = realpath(dirname(__FILE__).'/Fixtures/'); + $tests = array(); - /** - * @var string - */ - private $flashName; + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fixturesDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if (!preg_match('/\.test$/', $file)) { + continue; + } - /** - * @var string - */ - private $attributeName; + $test = file_get_contents($file->getRealpath()); + + if (preg_match('/ + --TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*))+)\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = $this->parseTemplates($match[3]); + $exception = $match[4]; + $outputs = array(null, array(), null, ''); + } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = $this->parseTemplates($match[3]); + $exception = false; + preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); + } else { + throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); + } + + $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs); + } + + return $tests; + } /** - * Constructor. - * - * @param SessionStorageInterface $storage A SessionStorageInterface instance. - * @param AttributeBagInterface $attributes An AttributeBagInterface instance, (defaults null for default AttributeBag) - * @param FlashBagInterface $flashes A FlashBagInterface instance (defaults null for default FlashBag) + * @dataProvider getTests */ - public function __construct(SessionStorageInterface $storage = null, AttributeBagInterface $attributes = null, FlashBagInterface $flashes = null) + public function testIntegration($file, $message, $condition, $templates, $exception, $outputs) { - $this->storage = $storage ?: new NativeSessionStorage(); + if ($condition) { + eval('$ret = '.$condition.';'); + if (!$ret) { + $this->markTestSkipped($condition); + } + } + + $loader = new Twig_Loader_Array($templates); + + foreach ($outputs as $match) { + $config = array_merge(array( + 'cache' => false, + 'strict_variables' => true, + ), $match[2] ? eval($match[2].';') : array()); + $twig = new Twig_Environment($loader, $config); + $twig->addExtension(new TestExtension()); + $twig->addExtension(new Twig_Extension_Debug()); + $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(), array(), array()); + $twig->addExtension(new Twig_Extension_Sandbox($policy, false)); + $twig->addGlobal('global', 'global'); + + try { + $template = $twig->loadTemplate('index.twig'); + } catch (Exception $e) { + if (false !== $exception) { + $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); + + return; + } + + if ($e instanceof Twig_Error_Syntax) { + $e->setTemplateFile($file); + + throw $e; + } + + throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); + } + + try { + $output = trim($template->render(eval($match[1].';')), "\n "); + } catch (Exception $e) { + if (false !== $exception) { + $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); - $attributes = $attributes ?: new AttributeBag(); - $this->attributeName = $attributes->getName(); - $this->registerBag($attributes); + return; + } - $flashes = $flashes ?: new FlashBag(); - $this->flashName = $flashes->getName(); - $this->registerBag($flashes); + if ($e instanceof Twig_Error_Syntax) { + $e->setTemplateFile($file); + } else { + $e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); + } + + $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage())); + } + $expected = trim($match[3], "\n "); + + if ($expected != $output) { + echo 'Compiled template that failed:'; + + foreach (array_keys($templates) as $name) { + echo "Template: $name\n"; + $source = $loader->getSource($name); + echo $twig->compile($twig->parse($twig->tokenize($source, $name))); + } + } + $this->assertEquals($expected, $output, $message.' (in '.$file.')'); + } } - /** - * {@inheritdoc} - */ - public function start() + protected function parseTemplates($test) { - return $this->storage->start(); + $templates = array(); + preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); + foreach ($matches as $match) { + $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; + } + + return $templates; } +} - /** - * {@inheritdoc} - */ - public function has($name) +function test_foo($value = 'foo') +{ + return $value; +} + +class Foo implements Iterator +{ + const BAR_NAME = 'bar'; + + public $position = 0; + public $array = array(1, 2); + + public function bar($param1 = null, $param2 = null) { - return $this->storage->getBag($this->attributeName)->has($name); + return 'bar'.($param1 ? '_'.$param1 : '').($param2 ? '-'.$param2 : ''); } - /** - * {@inheritdoc} - */ - public function get($name, $default = null) + public function getFoo() { - return $this->storage->getBag($this->attributeName)->get($name, $default); + return 'foo'; } - /** - * {@inheritdoc} - */ - public function set($name, $value) + public function getSelf() { - $this->storage->getBag($this->attributeName)->set($name, $value); + return $this; } - /** - * {@inheritdoc} - */ - public function all() + public function is() { - return $this->storage->getBag($this->attributeName)->all(); + return 'is'; } - /** - * {@inheritdoc} - */ - public function replace(array $attributes) + public function in() { - $this->storage->getBag($this->attributeName)->replace($attributes); + return 'in'; } - /** - * {@inheritdoc} - */ - public function remove($name) + public function not() { - return $this->storage->getBag($this->attributeName)->remove($name); + return 'not'; } - /** - * {@inheritdoc} - */ - public function clear() + public function strToLower($value) { - $this->storage->getBag($this->attributeName)->clear(); + return strtolower($value); } - /** - * Returns an iterator for attributes. - * - * @return \ArrayIterator An \ArrayIterator instance - */ - public function getIterator() + public function rewind() { - return new \ArrayIterator($this->storage->getBag($this->attributeName)->all()); + $this->position = 0; } - /** - * Returns the number of attributes. - * - * @return int The number of attributes - */ - public function count() + public function current() { - return count($this->storage->getBag($this->attributeName)->all()); + return $this->array[$this->position]; } - /** - * {@inheritdoc} - */ - public function invalidate($lifetime = null) + public function key() { - $this->storage->clear(); - - return $this->migrate(true, $lifetime); + return 'a'; } - /** - * {@inheritdoc} - */ - public function migrate($destroy = false, $lifetime = null) + public function next() { - return $this->storage->regenerate($destroy, $lifetime); + ++$this->position; } - /** - * {@inheritdoc} - */ - public function save() + public function valid() { - $this->storage->save(); + return isset($this->array[$this->position]); } +} - /** - * {@inheritdoc} - */ - public function getId() +class TestTokenParser_☃ extends Twig_TokenParser +{ + public function parse(Twig_Token $token) { - return $this->storage->getId(); + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node_Print(new Twig_Node_Expression_Constant('☃', -1), -1); } - /** - * {@inheritdoc} - */ - public function setId($id) + public function getTag() { - $this->storage->setId($id); + return '☃'; } +} - /** - * {@inheritdoc} - */ - public function getName() +class TestExtension extends Twig_Extension +{ + public function getTokenParsers() { - return $this->storage->getName(); + return array( + new TestTokenParser_☃(), + ); } - /** - * {@inheritdoc} - */ - public function setName($name) + public function getFilters() { - $this->storage->setName($name); + return array( + '☃' => new Twig_Filter_Method($this, '☃Filter'), + 'escape_and_nl2br' => new Twig_Filter_Method($this, 'escape_and_nl2br', array('needs_environment' => true, 'is_safe' => array('html'))), + 'nl2br' => new Twig_Filter_Method($this, 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))), + 'escape_something' => new Twig_Filter_Method($this, 'escape_something', array('is_safe' => array('something'))), + 'preserves_safety' => new Twig_Filter_Method($this, 'preserves_safety', array('preserves_safety' => array('html'))), + '*_path' => new Twig_Filter_Method($this, 'dynamic_path'), + '*_foo_*_bar' => new Twig_Filter_Method($this, 'dynamic_foo'), + ); } - /** - * {@iheritdoc} - */ - public function getMetadataBag() + public function getFunctions() { - return $this->storage->getMetadataBag(); + return array( + '☃' => new Twig_Function_Method($this, '☃Function'), + 'safe_br' => new Twig_Function_Method($this, 'br', array('is_safe' => array('html'))), + 'unsafe_br' => new Twig_Function_Method($this, 'br'), + '*_path' => new Twig_Function_Method($this, 'dynamic_path'), + '*_foo_*_bar' => new Twig_Function_Method($this, 'dynamic_foo'), + ); } - /** - * {@iheritdoc} - */ - public function registerBag(SessionBagInterface $bag) + public function ☃Filter($value) { - $this->storage->registerBag($bag); + return "☃{$value}☃"; } - /** - * {@iheritdoc} - */ - public function getBag($name) + public function ☃Function($value) { - return $this->storage->getBag($name); + return "☃{$value}☃"; } /** - * Gets the flashbag interface. - * - * @return FlashBagInterface + * nl2br which also escapes, for testing escaper filters */ - public function getFlashBag() + public function escape_and_nl2br($env, $value, $sep = '
    ') { - return $this->getBag($this->flashName); + return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep); } - // the following methods are kept for compatibility with Symfony 2.0 (they will be removed for Symfony 2.3) - /** - * @return array - * - * @deprecated since 2.1, will be removed from 2.3 + * nl2br only, for testing filters with pre_escape */ - public function getFlashes() + public function nl2br($value, $sep = '
    ') { - $all = $this->getBag($this->flashName)->all(); - - $return = array(); - if ($all) { - foreach ($all as $name => $array) { - $return[$name] = reset($array); - } - } - - return $return; + // not secure if $value contains html tags (not only entities) + // don't use + return str_replace("\n", "$sep\n", $value); } - /** - * @param array $values - * - * @deprecated since 2.1, will be removed from 2.3 - */ - public function setFlashes($values) + public function dynamic_path($element, $item) { - foreach ($values as $name => $value) { - $this->getBag($this->flashName)->set($name, $value); - } + return $element.'/'.$item; } - /** - * @param string $name - * @param string $default - * - * @return string - * - * @deprecated since 2.1, will be removed from 2.3 - */ - public function getFlash($name, $default = null) + public function dynamic_foo($foo, $bar, $item) { - $return = $this->getBag($this->flashName)->get($name); - - return empty($return) ? $default : reset($return); + return $foo.'/'.$bar.'/'.$item; } - /** - * @param string $name - * @param string $value - * - * @deprecated since 2.1, will be removed from 2.3 - */ - public function setFlash($name, $value) + public function escape_something($value) { - $this->getBag($this->flashName)->set($name, $value); + return strtoupper($value); } - /** - * @param string $name - * - * @return Boolean - * - * @deprecated since 2.1, will be removed from 2.3 - */ - public function hasFlash($name) + public function preserves_safety($value) { - return $this->getBag($this->flashName)->has($name); + return strtoupper($value); } - /** - * @param string $name - * - * @deprecated since 2.1, will be removed from 2.3 - */ - public function removeFlash($name) + public function br() { - $this->getBag($this->flashName)->get($name); + return '
    '; } - /** - * @return array - * - * @deprecated since 2.1, will be removed from 2.3 - */ - public function clearFlashes() + public function getName() { - return $this->getBag($this->flashName)->clear(); + return 'test'; } } diff --git a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeParent.php b/core/vendor/twig/twig/test/bootstrap.php similarity index 50% rename from core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeParent.php rename to core/vendor/twig/twig/test/bootstrap.php index 5a859a9..36eb46a 100644 --- a/core/vendor/Symfony/Component/ClassLoader/Tests/Fixtures/classmap/SomeParent.php +++ b/core/vendor/twig/twig/test/bootstrap.php @@ -1,17 +1,13 @@ + * (c) Fabien Potencier * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -namespace ClassMap; - -abstract class SomeParent -{ - -} +require_once dirname(__FILE__).'/../lib/Twig/Autoloader.php'; +Twig_Autoloader::register();