From 3c06c815a41cef67fcc95e5ed46616a1637bf752 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 12 Oct 2015 13:28:14 +0200 Subject: [PATCH 1/4] [ClassLoader] Split LegacyApcUniversalClassLoaderTest fixtures --- .../Fixtures/LegacyApc/Namespaced/Bar.php | 17 ++++ .../Fixtures/LegacyApc/Namespaced/Baz.php | 17 ++++ .../Fixtures/LegacyApc/Namespaced/Foo.php | 17 ++++ .../Fixtures/LegacyApc/Namespaced/FooBar.php | 17 ++++ .../Tests/Fixtures/LegacyApc/Pearlike/Bar.php | 6 ++ .../Tests/Fixtures/LegacyApc/Pearlike/Baz.php | 6 ++ .../Tests/Fixtures/LegacyApc/Pearlike/Foo.php | 6 ++ .../LegacyApcPrefixCollision/A/Bar.php | 6 ++ .../LegacyApcPrefixCollision/A/Foo.php | 6 ++ .../LegacyApc/NamespaceCollision/A/Bar.php | 17 ++++ .../LegacyApc/NamespaceCollision/A/Foo.php | 17 ++++ .../LegacyApcPrefixCollision/A/B/Bar.php | 6 ++ .../LegacyApcPrefixCollision/A/B/Foo.php | 6 ++ .../LegacyApc/NamespaceCollision/A/B/Bar.php | 17 ++++ .../LegacyApc/NamespaceCollision/A/B/Foo.php | 17 ++++ .../fallback/LegacyApc/Pearlike/FooBar.php | 6 ++ .../LegacyApc/fallback/Namespaced/FooBar.php | 17 ++++ .../LegacyApcUniversalClassLoaderTest.php | 84 +++++++++---------- 18 files changed, 243 insertions(+), 42 deletions(-) create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Bar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Baz.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Foo.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/FooBar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Pearlike/Bar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Pearlike/Baz.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Pearlike/Foo.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/alpha/LegacyApc/LegacyApcPrefixCollision/A/Bar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/alpha/LegacyApc/LegacyApcPrefixCollision/A/Foo.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/alpha/LegacyApc/NamespaceCollision/A/Bar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/alpha/LegacyApc/NamespaceCollision/A/Foo.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/LegacyApcPrefixCollision/A/B/Bar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/LegacyApcPrefixCollision/A/B/Foo.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/NamespaceCollision/A/B/Bar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/NamespaceCollision/A/B/Foo.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/fallback/LegacyApc/Pearlike/FooBar.php create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/fallback/Namespaced/FooBar.php diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Bar.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Bar.php new file mode 100644 index 0000000000..7ea4f05664 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Bar.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\Namespaced; + +class Bar +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Baz.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Baz.php new file mode 100644 index 0000000000..a89fbbc313 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Baz.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\Namespaced; + +class Baz +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Foo.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Foo.php new file mode 100644 index 0000000000..1b04072e5a --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/Foo.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\Namespaced; + +class Foo +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/FooBar.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/FooBar.php new file mode 100644 index 0000000000..16244ec0c6 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Namespaced/FooBar.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\Namespaced; + +class FooBar +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Pearlike/Bar.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Pearlike/Bar.php new file mode 100644 index 0000000000..8d98583078 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/Pearlike/Bar.php @@ -0,0 +1,6 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\NamespaceCollision\A; + +class Bar +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/alpha/LegacyApc/NamespaceCollision/A/Foo.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/alpha/LegacyApc/NamespaceCollision/A/Foo.php new file mode 100644 index 0000000000..fb75d9a439 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/alpha/LegacyApc/NamespaceCollision/A/Foo.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\NamespaceCollision\A; + +class Foo +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/LegacyApcPrefixCollision/A/B/Bar.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/LegacyApcPrefixCollision/A/B/Bar.php new file mode 100644 index 0000000000..08834f9fd9 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/LegacyApcPrefixCollision/A/B/Bar.php @@ -0,0 +1,6 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\NamespaceCollision\A\B; + +class Bar +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/NamespaceCollision/A/B/Foo.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/NamespaceCollision/A/B/Foo.php new file mode 100644 index 0000000000..ddb0a69e94 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/beta/LegacyApc/NamespaceCollision/A/B/Foo.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\NamespaceCollision\A\B; + +class Foo +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/fallback/LegacyApc/Pearlike/FooBar.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/fallback/LegacyApc/Pearlike/FooBar.php new file mode 100644 index 0000000000..f0fac9ef25 --- /dev/null +++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/LegacyApc/fallback/LegacyApc/Pearlike/FooBar.php @@ -0,0 +1,6 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace LegacyApc\Namespaced; + +class FooBar +{ + public static $loaded = true; +} diff --git a/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php b/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php index 01a201d1be..fa956577e4 100644 --- a/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php +++ b/src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php @@ -38,9 +38,9 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase public function testConstructor() { $loader = new ApcUniversalClassLoader('test.prefix.'); - $loader->registerNamespace('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->registerNamespace('LegacyApc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $this->assertEquals($loader->findFile('\Apc\Namespaced\FooBar'), apc_fetch('test.prefix.\Apc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument'); + $this->assertEquals($loader->findFile('\LegacyApc\Namespaced\FooBar'), apc_fetch('test.prefix.\LegacyApc\Namespaced\FooBar'), '__construct() takes a prefix as its first argument'); } /** @@ -49,8 +49,8 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase public function testLoadClass($className, $testClassName, $message) { $loader = new ApcUniversalClassLoader('test.prefix.'); - $loader->registerNamespace('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $loader->registerPrefix('Apc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->registerNamespace('LegacyApc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->registerPrefix('LegacyApc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); $loader->loadClass($testClassName); $this->assertTrue(class_exists($className), $message); } @@ -58,8 +58,8 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase public function getLoadClassTests() { return array( - array('\\Apc\\Namespaced\\Foo', 'Apc\\Namespaced\\Foo', '->loadClass() loads Apc\Namespaced\Foo class'), - array('Apc_Pearlike_Foo', 'Apc_Pearlike_Foo', '->loadClass() loads Apc_Pearlike_Foo class'), + array('\\LegacyApc\\Namespaced\\Foo', 'LegacyApc\\Namespaced\\Foo', '->loadClass() loads LegacyApc\Namespaced\Foo class'), + array('LegacyApc_Pearlike_Foo', 'LegacyApc_Pearlike_Foo', '->loadClass() loads LegacyApc_Pearlike_Foo class'), ); } @@ -69,10 +69,10 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase public function testLoadClassFromFallback($className, $testClassName, $message) { $loader = new ApcUniversalClassLoader('test.prefix.fallback'); - $loader->registerNamespace('Apc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $loader->registerPrefix('Apc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); - $loader->registerNamespaceFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/fallback')); - $loader->registerPrefixFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/fallback')); + $loader->registerNamespace('LegacyApc\Namespaced', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->registerPrefix('LegacyApc_Pearlike_', __DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $loader->registerNamespaceFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/fallback')); + $loader->registerPrefixFallbacks(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/fallback')); $loader->loadClass($testClassName); $this->assertTrue(class_exists($className), $message); } @@ -80,10 +80,10 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase public function getLoadClassFromFallbackTests() { return array( - array('\\Apc\\Namespaced\\Baz', 'Apc\\Namespaced\\Baz', '->loadClass() loads Apc\Namespaced\Baz class'), - array('Apc_Pearlike_Baz', 'Apc_Pearlike_Baz', '->loadClass() loads Apc_Pearlike_Baz class'), - array('\\Apc\\Namespaced\\FooBar', 'Apc\\Namespaced\\FooBar', '->loadClass() loads Apc\Namespaced\Baz class from fallback dir'), - array('Apc_Pearlike_FooBar', 'Apc_Pearlike_FooBar', '->loadClass() loads Apc_Pearlike_Baz class from fallback dir'), + array('\\LegacyApc\\Namespaced\\Baz', 'LegacyApc\\Namespaced\\Baz', '->loadClass() loads LegacyApc\Namespaced\Baz class'), + array('LegacyApc_Pearlike_Baz', 'LegacyApc_Pearlike_Baz', '->loadClass() loads LegacyApc_Pearlike_Baz class'), + array('\\LegacyApc\\Namespaced\\FooBar', 'LegacyApc\\Namespaced\\FooBar', '->loadClass() loads LegacyApc\Namespaced\Baz class from fallback dir'), + array('LegacyApc_Pearlike_FooBar', 'LegacyApc_Pearlike_FooBar', '->loadClass() loads LegacyApc_Pearlike_Baz class from fallback dir'), ); } @@ -105,34 +105,34 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase return array( array( array( - 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', - 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', + 'LegacyApc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha', + 'LegacyApc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta', ), - 'Apc\NamespaceCollision\A\Foo', + 'LegacyApc\NamespaceCollision\A\Foo', '->loadClass() loads NamespaceCollision\A\Foo from alpha.', ), array( array( - 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', - 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', + 'LegacyApc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta', + 'LegacyApc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha', ), - 'Apc\NamespaceCollision\A\Bar', + 'LegacyApc\NamespaceCollision\A\Bar', '->loadClass() loads NamespaceCollision\A\Bar from alpha.', ), array( array( - 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', - 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', + 'LegacyApc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha', + 'LegacyApc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta', ), - 'Apc\NamespaceCollision\A\B\Foo', + 'LegacyApc\NamespaceCollision\A\B\Foo', '->loadClass() loads NamespaceCollision\A\B\Foo from beta.', ), array( array( - 'Apc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta', - 'Apc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha', + 'LegacyApc\\NamespaceCollision\\A\\B' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta', + 'LegacyApc\\NamespaceCollision\\A' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha', ), - 'Apc\NamespaceCollision\A\B\Bar', + 'LegacyApc\NamespaceCollision\A\B\Bar', '->loadClass() loads NamespaceCollision\A\B\Bar from beta.', ), ); @@ -155,35 +155,35 @@ class LegacyApcUniversalClassLoaderTest extends \PHPUnit_Framework_TestCase return array( array( array( - 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', - 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', + 'LegacyApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha/LegacyApc', + 'LegacyApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta/LegacyApc', ), - 'ApcPrefixCollision_A_Foo', - '->loadClass() loads ApcPrefixCollision_A_Foo from alpha.', + 'LegacyApcPrefixCollision_A_Foo', + '->loadClass() loads LegacyApcPrefixCollision_A_Foo from alpha.', ), array( array( - 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', - 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', + 'LegacyApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta/LegacyApc', + 'LegacyApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha/LegacyApc', ), - 'ApcPrefixCollision_A_Bar', - '->loadClass() loads ApcPrefixCollision_A_Bar from alpha.', + 'LegacyApcPrefixCollision_A_Bar', + '->loadClass() loads LegacyApcPrefixCollision_A_Bar from alpha.', ), array( array( - 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', - 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', + 'LegacyApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha/LegacyApc', + 'LegacyApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta/LegacyApc', ), - 'ApcPrefixCollision_A_B_Foo', - '->loadClass() loads ApcPrefixCollision_A_B_Foo from beta.', + 'LegacyApcPrefixCollision_A_B_Foo', + '->loadClass() loads LegacyApcPrefixCollision_A_B_Foo from beta.', ), array( array( - 'ApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/beta/Apc', - 'ApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/Apc/alpha/Apc', + 'LegacyApcPrefixCollision_A_B_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/beta/LegacyApc', + 'LegacyApcPrefixCollision_A_' => __DIR__.DIRECTORY_SEPARATOR.'Fixtures/LegacyApc/alpha/LegacyApc', ), - 'ApcPrefixCollision_A_B_Bar', - '->loadClass() loads ApcPrefixCollision_A_B_Bar from beta.', + 'LegacyApcPrefixCollision_A_B_Bar', + '->loadClass() loads LegacyApcPrefixCollision_A_B_Bar from beta.', ), ); } From 27040333cf72f618596ef6b2d89b06687ccb83a4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 12 Oct 2015 11:43:29 +0200 Subject: [PATCH 2/4] [ci] load php_memcache.dll and apcu.so --- .travis.yml | 4 ++-- appveyor.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d1dcbfe6a..caf64d1ebb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,8 +32,8 @@ before_install: - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - - if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo -e "extension = apc.so\napc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi; + - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.7 && echo "apc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without apcu extension"; fi; + - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi; - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi; - if [ "$deps" != "skip" ]; then ./phpunit install; fi; - export PHPUNIT="$(readlink -f ./phpunit)" diff --git a/appveyor.yml b/appveyor.yml index b9a95c9fd7..82f97cd804 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -40,6 +40,7 @@ install: - IF %PHP%==1 copy /Y php.ini-min php.ini-max - IF %PHP%==1 echo extension=php_apcu.dll >> php.ini-max - IF %PHP%==1 echo apc.enable_cli=1 >> php.ini-max + - IF %PHP%==1 echo extension=php_memcache.dll >> php.ini-max - IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max From c9f92baad739f231804434b6c8c2b50ee13b36b5 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 11 Oct 2015 11:00:41 +0200 Subject: [PATCH 3/4] [2.3] Cherry-pick @group time-sensitive annotations --- .../Component/Console/Tests/ClockMock.php | 41 --------- .../Tests/Helper/ProgressHelperTest.php | 16 +--- .../Tests/ClockMockTestCase.php | 88 ------------------- .../HttpFoundation/Tests/CookieTest.php | 4 +- .../Tests/ResponseHeaderBagTest.php | 5 +- .../Handler/MemcacheSessionHandlerTest.php | 4 +- .../Handler/MemcachedSessionHandlerTest.php | 4 +- .../Handler/MongoDbSessionHandlerTest.php | 4 +- .../Storage/Handler/PdoSessionHandlerTest.php | 4 +- .../Tests/Session/Storage/MetadataBagTest.php | 5 +- .../Component/Stopwatch/Tests/ClockMock.php | 60 ------------- .../Stopwatch/Tests/StopwatchEventTest.php | 14 +-- .../Stopwatch/Tests/StopwatchTest.php | 14 +-- 13 files changed, 25 insertions(+), 238 deletions(-) delete mode 100644 src/Symfony/Component/Console/Tests/ClockMock.php delete mode 100644 src/Symfony/Component/HttpFoundation/Tests/ClockMockTestCase.php delete mode 100644 src/Symfony/Component/Stopwatch/Tests/ClockMock.php diff --git a/src/Symfony/Component/Console/Tests/ClockMock.php b/src/Symfony/Component/Console/Tests/ClockMock.php deleted file mode 100644 index 0e9231662e..0000000000 --- a/src/Symfony/Component/Console/Tests/ClockMock.php +++ /dev/null @@ -1,41 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Console\Helper; - -use Symfony\Component\Console\Tests; - -function time() -{ - return Tests\time(); -} - -namespace Symfony\Component\Console\Tests; - -function with_clock_mock($enable = null) -{ - static $enabled; - - if (null === $enable) { - return $enabled; - } - - $enabled = $enable; -} - -function time() -{ - if (!with_clock_mock()) { - return \time(); - } - - return $_SERVER['REQUEST_TIME']; -} diff --git a/src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php index 0afcf044e5..5043b493c9 100644 --- a/src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php +++ b/src/Symfony/Component/Console/Tests/Helper/ProgressHelperTest.php @@ -13,22 +13,12 @@ namespace Symfony\Component\Console\Tests\Helper; use Symfony\Component\Console\Helper\ProgressHelper; use Symfony\Component\Console\Output\StreamOutput; -use Symfony\Component\Console\Tests; - -require_once __DIR__.'/../ClockMock.php'; +/** + * @group time-sensitive + */ class ProgressHelperTest extends \PHPUnit_Framework_TestCase { - protected function setUp() - { - Tests\with_clock_mock(true); - } - - protected function tearDown() - { - Tests\with_clock_mock(false); - } - public function testAdvance() { $progress = new ProgressHelper(); diff --git a/src/Symfony/Component/HttpFoundation/Tests/ClockMockTestCase.php b/src/Symfony/Component/HttpFoundation/Tests/ClockMockTestCase.php deleted file mode 100644 index ba009168f3..0000000000 --- a/src/Symfony/Component/HttpFoundation/Tests/ClockMockTestCase.php +++ /dev/null @@ -1,88 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundationSession\Tests\Storage\Handler; - -use Symfony\Component\HttpFoundation\Tests; - -function time() -{ - return Tests\time(); -} - -namespace Symfony\Component\HttpFoundationSession\Storage\Handler; - -use Symfony\Component\HttpFoundation\Tests; - -function time() -{ - return Tests\time(); -} - -namespace Symfony\Component\HttpFoundationSession\Tests\Storage; - -use Symfony\Component\HttpFoundation\Tests; - -function time() -{ - return Tests\time(); -} - -namespace Symfony\Component\HttpFoundationSession\Storage; - -use Symfony\Component\HttpFoundation\Tests; - -function time() -{ - return Tests\time(); -} - -namespace Symfony\Component\HttpFoundation; - -function time() -{ - return Tests\time(); -} - -namespace Symfony\Component\HttpFoundation\Tests; - -function with_clock_mock($enable = null) -{ - static $enabled; - - if (null === $enable) { - return $enabled; - } - - $enabled = $enable; -} - -function time() -{ - if (!with_clock_mock()) { - return \time(); - } - - return $_SERVER['REQUEST_TIME']; -} - -class ClockMockTestCase extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - with_clock_mock(true); - } - - protected function tearDown() - { - with_clock_mock(false); - } -} diff --git a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php index 831eef0c65..5b9438911d 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/CookieTest.php @@ -18,8 +18,10 @@ use Symfony\Component\HttpFoundation\Cookie; * * @author John Kary * @author Hugo Hamon + * + * @group time-sensitive */ -class CookieTest extends ClockMockTestCase +class CookieTest extends \PHPUnit_Framework_TestCase { public function invalidNames() { diff --git a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php index 48e049f87b..b716ac162a 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/ResponseHeaderBagTest.php @@ -14,7 +14,10 @@ namespace Symfony\Component\HttpFoundation\Tests; use Symfony\Component\HttpFoundation\ResponseHeaderBag; use Symfony\Component\HttpFoundation\Cookie; -class ResponseHeaderBagTest extends ClockMockTestCase +/** + * @group time-sensitive + */ +class ResponseHeaderBagTest extends \PHPUnit_Framework_TestCase { /** * @covers Symfony\Component\HttpFoundation\ResponseHeaderBag::allPreserveCase diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php index 3c5144d68e..81b4075992 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php @@ -12,12 +12,12 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler; -use Symfony\Component\HttpFoundation\Tests\ClockMockTestCase; /** * @requires extension memcache + * @group time-sensitive */ -class MemcacheSessionHandlerTest extends ClockMockTestCase +class MemcacheSessionHandlerTest extends \PHPUnit_Framework_TestCase { const PREFIX = 'prefix_'; const TTL = 1000; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index d29ab4b00b..34276ce8ee 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -12,12 +12,12 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcachedSessionHandler; -use Symfony\Component\HttpFoundation\Tests\ClockMockTestCase; /** * @requires extension memcached + * @group time-sensitive */ -class MemcachedSessionHandlerTest extends ClockMockTestCase +class MemcachedSessionHandlerTest extends \PHPUnit_Framework_TestCase { const PREFIX = 'prefix_'; const TTL = 1000; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index 7634fea49c..c72358afc8 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -12,13 +12,13 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler; -use Symfony\Component\HttpFoundation\Tests\ClockMockTestCase; /** * @author Markus Bachmann * @requires extension mongo + * @group time-sensitive */ -class MongoDbSessionHandlerTest extends ClockMockTestCase +class MongoDbSessionHandlerTest extends \PHPUnit_Framework_TestCase { /** * @var \PHPUnit_Framework_MockObject_MockObject diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 19de8ac731..1936b1c294 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -12,12 +12,12 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler; -use Symfony\Component\HttpFoundation\Tests\ClockMockTestCase; /** * @requires extension pdo_sqlite + * @group time-sensitive */ -class PdoSessionHandlerTest extends ClockMockTestCase +class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase { private $pdo; diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php index b7f4b3c8b4..b1453e4540 100644 --- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php +++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MetadataBagTest.php @@ -12,12 +12,13 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; -use Symfony\Component\HttpFoundation\Tests\ClockMockTestCase; /** * Test class for MetadataBag. + * + * @group time-sensitive */ -class MetadataBagTest extends ClockMockTestCase +class MetadataBagTest extends \PHPUnit_Framework_TestCase { /** * @var MetadataBag diff --git a/src/Symfony/Component/Stopwatch/Tests/ClockMock.php b/src/Symfony/Component/Stopwatch/Tests/ClockMock.php deleted file mode 100644 index 718296cc5b..0000000000 --- a/src/Symfony/Component/Stopwatch/Tests/ClockMock.php +++ /dev/null @@ -1,60 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Stopwatch; - -function microtime($asFloat = false) -{ - return Tests\microtime($asFloat); -} - -namespace Symfony\Component\Stopwatch\Tests; - -function with_clock_mock($enable = null) -{ - static $enabled; - - if (null === $enable) { - return $enabled; - } - - $enabled = $enable; -} - -function usleep($us) -{ - static $now; - - if (!with_clock_mock()) { - \usleep($us); - - return; - } - - if (null === $now) { - $now = \microtime(true); - } - - return $now += $us / 1000000; -} - -function microtime($asFloat = false) -{ - if (!with_clock_mock()) { - return \microtime($asFloat); - } - - if (!$asFloat) { - return \microtime(false); - } - - return usleep(1); -} diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php index f67d9dc16d..79db149f91 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchEventTest.php @@ -13,27 +13,17 @@ namespace Symfony\Component\Stopwatch\Tests; use Symfony\Component\Stopwatch\StopwatchEvent; -require_once __DIR__.'/ClockMock.php'; - /** * StopwatchEventTest. * * @author Fabien Potencier + * + * @group time-sensitive */ class StopwatchEventTest extends \PHPUnit_Framework_TestCase { const DELTA = 37; - protected function setUp() - { - with_clock_mock(true); - } - - protected function tearDown() - { - with_clock_mock(false); - } - public function testGetOrigin() { $event = new StopwatchEvent(12); diff --git a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php index b7835c6a02..1994fe06ff 100644 --- a/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php +++ b/src/Symfony/Component/Stopwatch/Tests/StopwatchTest.php @@ -13,27 +13,17 @@ namespace Symfony\Component\Stopwatch\Tests; use Symfony\Component\Stopwatch\Stopwatch; -require_once __DIR__.'/ClockMock.php'; - /** * StopwatchTest. * * @author Fabien Potencier + * + * @group time-sensitive */ class StopwatchTest extends \PHPUnit_Framework_TestCase { const DELTA = 20; - protected function setUp() - { - with_clock_mock(true); - } - - protected function tearDown() - { - with_clock_mock(false); - } - public function testStart() { $stopwatch = new Stopwatch(); From ed40dc3300c353d77fe8e3acb1a20a04915e5786 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 12 Oct 2015 14:38:55 +0200 Subject: [PATCH 4/4] [travis] Load memcache.so --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index caf64d1ebb..d6f3aa4934 100644 --- a/.travis.yml +++ b/.travis.yml @@ -32,6 +32,7 @@ before_install: - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; + - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (echo yes | pecl install -f apcu-4.0.7 && echo "apc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without apcu extension"; fi; - if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then pecl install -f memcached-2.1.0 || echo "Let's continue without memcached extension"; fi; - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then php -i; fi;