mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-15 09:30:58 +00:00
[Behat] [Travis] Introduced test_cached environment, updated test suites, added metadata cache for Doctrine PHPCR, omit doubled composer dependencies installing
This commit is contained in:
parent
2108d32919
commit
ea47a46a10
13 changed files with 191 additions and 81 deletions
27
.travis.yml
27
.travis.yml
|
|
@ -47,23 +47,28 @@ before_install:
|
|||
|
||||
- composer self-update
|
||||
|
||||
- if [ $TRAVIS_PHP_VERSION != "7.0" ] && [ $TEST_SUITE = "no-javascript" ]; then travis/prepare/prepare-mongodb; fi
|
||||
|
||||
- composer install --prefer-dist --no-interaction
|
||||
|
||||
- if [ $TEST_SUITE = "javascript" ]; then travis/prepare/prepare-javascript; fi
|
||||
- |
|
||||
if [ $TRAVIS_PHP_VERSION != "7.0" ] && [ $TEST_SUITE = "no-javascript" ]; then
|
||||
travis/prepare/prepare-mongodb
|
||||
else
|
||||
composer install --prefer-dist --no-interaction
|
||||
fi
|
||||
|
||||
- cat travis/prepare/opcache.ini >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
|
||||
|
||||
before_script:
|
||||
- app/console doctrine:database:create --env=test
|
||||
- app/console doctrine:schema:create --env=test
|
||||
- app/console doctrine:phpcr:repository:init --env=test
|
||||
- app/console doctrine:database:create --env=test_cached
|
||||
- app/console doctrine:schema:create --env=test_cached
|
||||
- app/console doctrine:phpcr:repository:init --env=test_cached
|
||||
|
||||
- app/console cache:warmup --env=test --no-debug
|
||||
- app/console cache:warmup --env=test_cached --no-debug
|
||||
|
||||
- if [ $TEST_SUITE = "javascript" ]; then app/console assets:install --env=test; fi
|
||||
- if [ $TEST_SUITE = "javascript" ]; then app/console assetic:dump --env=test; fi
|
||||
- |
|
||||
if [ $TEST_SUITE = "javascript" ]; then
|
||||
travis/prepare/prepare-javascript
|
||||
app/console assets:install --env=test_cached --no-debug
|
||||
app/console assetic:dump --env=test_cached --no-debug
|
||||
fi
|
||||
|
||||
- php -v
|
||||
- php -i
|
||||
|
|
|
|||
|
|
@ -21,13 +21,6 @@ doctrine:
|
|||
dbname: %sylius.database.name%_test
|
||||
path: %sylius.database.path%
|
||||
driver_class: Sylius\Bundle\CoreBundle\Tests\MySqlDriver
|
||||
orm:
|
||||
entity_managers:
|
||||
default:
|
||||
metadata_cache_driver:
|
||||
type: memcached
|
||||
host: localhost
|
||||
port: 11211
|
||||
|
||||
sylius_money:
|
||||
currency: EUR
|
||||
|
|
|
|||
21
app/config/config_test_cached.yml
Normal file
21
app/config/config_test_cached.yml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# This file is part of the Sylius package.
|
||||
# (c) Paweł Jędrzejewski
|
||||
|
||||
imports:
|
||||
- { resource: config_test.yml }
|
||||
|
||||
doctrine:
|
||||
orm:
|
||||
entity_managers:
|
||||
default:
|
||||
metadata_cache_driver:
|
||||
type: memcached
|
||||
host: localhost
|
||||
port: 11211
|
||||
|
||||
doctrine_phpcr:
|
||||
odm:
|
||||
metadata_cache_driver:
|
||||
type: memcached
|
||||
host: localhost
|
||||
port: 11211
|
||||
38
app/config/router_test_cached.php
Normal file
38
app/config/router_test_cached.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file implements rewrite rules for PHP built-in web server.
|
||||
*
|
||||
* See: http://www.php.net/manual/en/features.commandline.webserver.php
|
||||
*
|
||||
* If you have custom directory layout, then you have to write your own router
|
||||
* and pass it as a value to 'router' option of server:run command.
|
||||
*
|
||||
* @author: Michał Pipa <michal.pipa.xsolve@gmail.com>
|
||||
* @author: Albert Jessurum <ajessu@gmail.com>
|
||||
*/
|
||||
|
||||
// Workaround https://bugs.php.net/64566
|
||||
if (ini_get('auto_prepend_file') && !in_array(realpath(ini_get('auto_prepend_file')), get_included_files(), true)) {
|
||||
require ini_get('auto_prepend_file');
|
||||
}
|
||||
|
||||
if (is_file($_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.$_SERVER['SCRIPT_NAME'])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$_SERVER = array_merge($_SERVER, $_ENV);
|
||||
$_SERVER['SCRIPT_FILENAME'] = $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR.'app_test_cached.php';
|
||||
|
||||
require 'app_test_cached.php';
|
||||
|
||||
error_log(sprintf('%s:%d [%d]: %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], http_response_code(), $_SERVER['REQUEST_URI']), 4);
|
||||
|
|
@ -405,9 +405,7 @@ default:
|
|||
sessions:
|
||||
default:
|
||||
symfony2: ~
|
||||
Behat\Symfony2Extension:
|
||||
kernel:
|
||||
debug: false
|
||||
Behat\Symfony2Extension: ~
|
||||
|
||||
gherkin:
|
||||
filters:
|
||||
|
|
@ -434,3 +432,37 @@ javascript:
|
|||
gherkin:
|
||||
filters:
|
||||
tags: "@javascript"
|
||||
|
||||
cached:
|
||||
extensions:
|
||||
Behat\Symfony2Extension:
|
||||
kernel:
|
||||
env: test_cached
|
||||
debug: false
|
||||
|
||||
javascript_cached:
|
||||
extensions:
|
||||
Lakion\Behat\MinkDebugExtension:
|
||||
screenshot: true
|
||||
Behat\MinkExtension:
|
||||
base_url: http://localhost:8080/
|
||||
selenium2:
|
||||
capabilities:
|
||||
browserName: chrome
|
||||
browser: chrome
|
||||
version: ""
|
||||
chrome:
|
||||
switches:
|
||||
- "start-fullscreen"
|
||||
- "no-sandbox"
|
||||
browser_name: chrome
|
||||
show_auto: false
|
||||
Behat\Symfony2Extension:
|
||||
kernel:
|
||||
env: test_cached
|
||||
debug: false
|
||||
|
||||
gherkin:
|
||||
filters:
|
||||
tags: "@javascript"
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,7 @@ function restore_composer_lock_from_cache
|
|||
# Argument 1: Cache unique key
|
||||
function is_cache_fresh
|
||||
{
|
||||
if [ -f $SYLIUS_CACHE_DIR/composer-$1.lock ] && [ -f $SYLIUS_CACHE_DIR/composer-$1.lock.md5sum ] && [ file_md5sum 'composer.lock' -eq `cat $SYLIUS_CACHE_DIR/composer-$1.lock.md5sum` ];
|
||||
then
|
||||
if [ -f "$SYLIUS_CACHE_DIR/composer-$1.lock" ] && [ -f "$SYLIUS_CACHE_DIR/composer-$1.lock.md5sum" ] && [ file_md5sum 'composer.lock' -eq "`cat $SYLIUS_CACHE_DIR/composer-$1.lock.md5sum`" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
|
|
|||
|
|
@ -27,5 +27,5 @@ java -jar $SYLIUS_CACHE_DIR/selenium.jar -Dwebdriver.chrome.driver=$SYLIUS_CACHE
|
|||
vendor/lakion/mink-debug-extension/travis/tools/wait-for-port 4444
|
||||
|
||||
# Running webserver
|
||||
app/console server:run 127.0.0.1:8080 --env=test > $SYLIUS_BUILD_DIR/webserver.log 2>&1 &
|
||||
app/console server:run 127.0.0.1:8080 --env=test_cached --router=app/config/router_test_cached.php --no-debug > $SYLIUS_BUILD_DIR/webserver.log 2>&1 &
|
||||
vendor/lakion/mink-debug-extension/travis/tools/wait-for-port 8080
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/bash
|
||||
bin/behat --strict -f progress -p javascript -s channels
|
||||
bin/behat --strict -f progress -p javascript -s users
|
||||
bin/behat --strict -f progress -p javascript -s taxonomies
|
||||
bin/behat --strict -f progress -p javascript -s taxation
|
||||
bin/behat --strict -f progress -p javascript -s shipping
|
||||
bin/behat --strict -f progress -p javascript -s promotions
|
||||
bin/behat --strict -f progress -p javascript -s products
|
||||
bin/behat --strict -f progress -p javascript -s payments
|
||||
bin/behat --strict -f progress -p javascript -s orders
|
||||
bin/behat --strict -f progress -p javascript -s addressing
|
||||
bin/behat --strict -f progress -p javascript -s account
|
||||
bin/behat --strict -f progress -p javascript_cached -s channels
|
||||
bin/behat --strict -f progress -p javascript_cached -s users
|
||||
bin/behat --strict -f progress -p javascript_cached -s taxonomies
|
||||
bin/behat --strict -f progress -p javascript_cached -s taxation
|
||||
bin/behat --strict -f progress -p javascript_cached -s shipping
|
||||
bin/behat --strict -f progress -p javascript_cached -s promotions
|
||||
bin/behat --strict -f progress -p javascript_cached -s products
|
||||
bin/behat --strict -f progress -p javascript_cached -s payments
|
||||
bin/behat --strict -f progress -p javascript_cached -s orders
|
||||
bin/behat --strict -f progress -p javascript_cached -s addressing
|
||||
bin/behat --strict -f progress -p javascript_cached -s account
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
#!/bin/bash
|
||||
bin/phpspec run -f dot
|
||||
|
||||
bin/behat --strict -f progress -s account
|
||||
bin/behat --strict -f progress -s cart
|
||||
bin/behat --strict -f progress -s currencies
|
||||
bin/behat --strict -f progress -s dashboard
|
||||
bin/behat --strict -f progress -s homepage
|
||||
bin/behat --strict -f progress -s inventory
|
||||
bin/behat --strict -f progress -s localization
|
||||
bin/behat --strict -f progress -s oauth
|
||||
bin/behat --strict -f progress -s reports
|
||||
bin/behat --strict -f progress -s taxonomies
|
||||
bin/behat --strict -f progress -s users
|
||||
bin/behat --strict -f progress -s search
|
||||
bin/behat --strict -f progress -s checkout
|
||||
bin/behat --strict -f progress -s addressing
|
||||
bin/behat --strict -f progress -s emails
|
||||
bin/behat --strict -f progress -s orders
|
||||
bin/behat --strict -f progress -s payments
|
||||
bin/behat --strict -f progress -s pricing
|
||||
bin/behat --strict -f progress -s settings
|
||||
bin/behat --strict -f progress -s shipping
|
||||
bin/behat --strict -f progress -s taxation
|
||||
bin/behat --strict -f progress -s i18n
|
||||
bin/behat --strict -f progress -s channels
|
||||
bin/behat --strict -f progress -s products
|
||||
bin/behat --strict -f progress -s promotions
|
||||
bin/behat --strict -f progress -p cached -s account
|
||||
bin/behat --strict -f progress -p cached -s cart
|
||||
bin/behat --strict -f progress -p cached -s currencies
|
||||
bin/behat --strict -f progress -p cached -s dashboard
|
||||
bin/behat --strict -f progress -p cached -s homepage
|
||||
bin/behat --strict -f progress -p cached -s inventory
|
||||
bin/behat --strict -f progress -p cached -s localization
|
||||
bin/behat --strict -f progress -p cached -s oauth
|
||||
bin/behat --strict -f progress -p cached -s reports
|
||||
bin/behat --strict -f progress -p cached -s taxonomies
|
||||
bin/behat --strict -f progress -p cached -s users
|
||||
bin/behat --strict -f progress -p cached -s search
|
||||
bin/behat --strict -f progress -p cached -s checkout
|
||||
bin/behat --strict -f progress -p cached -s addressing
|
||||
bin/behat --strict -f progress -p cached -s emails
|
||||
bin/behat --strict -f progress -p cached -s orders
|
||||
bin/behat --strict -f progress -p cached -s payments
|
||||
bin/behat --strict -f progress -p cached -s pricing
|
||||
bin/behat --strict -f progress -p cached -s settings
|
||||
bin/behat --strict -f progress -p cached -s shipping
|
||||
bin/behat --strict -f progress -p cached -s taxation
|
||||
bin/behat --strict -f progress -p cached -s i18n
|
||||
bin/behat --strict -f progress -p cached -s channels
|
||||
bin/behat --strict -f progress -p cached -s products
|
||||
bin/behat --strict -f progress -p cached -s promotions
|
||||
|
|
|
|||
11
web/app.php
11
web/app.php
|
|
@ -17,23 +17,14 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
* Live (production) environment.
|
||||
*/
|
||||
|
||||
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
|
||||
|
||||
//$loader = new ApcClassLoader('sylius', $loader);
|
||||
//$loader->register(true);
|
||||
|
||||
require_once __DIR__.'/../app/bootstrap.php.cache';
|
||||
require_once __DIR__.'/../app/AppKernel.php';
|
||||
//require_once __DIR__.'/../app/AppCache.php';
|
||||
|
||||
$kernel = new AppKernel('prod', false);
|
||||
$kernel->loadClassCache();
|
||||
|
||||
//$kernel = new AppCache($kernel);
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
|
||||
Request::enableHttpMethodParameterOverride();
|
||||
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
|
||||
|
|
|
|||
|
|
@ -31,14 +31,10 @@ Debug::enable();
|
|||
|
||||
require_once __DIR__.'/../app/AppKernel.php';
|
||||
|
||||
// Initialize kernel and run the application.
|
||||
$kernel = new AppKernel('dev', true);
|
||||
$kernel->loadClassCache();
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
|
||||
Request::enableHttpMethodParameterOverride();
|
||||
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||
|
||||
/*
|
||||
* Sylius front controller.
|
||||
* Testing environment.
|
||||
* Testing dev-like environment.
|
||||
*/
|
||||
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
|
|
@ -27,17 +27,12 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
|
|||
|
||||
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
|
||||
|
||||
// Require kernel.
|
||||
require_once __DIR__.'/../app/AppKernel.php';
|
||||
|
||||
// Initialize kernel and run the application.
|
||||
$kernel = new AppKernel('test', false);
|
||||
$kernel->loadClassCache();
|
||||
$kernel = new AppKernel('test', true);
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
|
||||
Request::enableHttpMethodParameterOverride();
|
||||
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
|
||||
|
|
|
|||
40
web/app_test_cached.php
Normal file
40
web/app_test_cached.php
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Sylius package.
|
||||
*
|
||||
* (c) Paweł Jędrzejewski
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
/*
|
||||
* Sylius front controller.
|
||||
* Testing prod-like environment.
|
||||
*/
|
||||
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||
|| !(in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '113.0.0.1'))
|
||||
|| php_sapi_name() === 'cli-server')
|
||||
) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
||||
}
|
||||
|
||||
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
|
||||
|
||||
require_once __DIR__.'/../app/AppKernel.php';
|
||||
|
||||
$kernel = new AppKernel('test_cached', false);
|
||||
$kernel->loadClassCache();
|
||||
|
||||
$request = Request::createFromGlobals();
|
||||
|
||||
$response = $kernel->handle($request);
|
||||
$response->send();
|
||||
|
||||
$kernel->terminate($request, $response);
|
||||
Loading…
Add table
Reference in a new issue