Skip to content
This repository has been archived by the owner on May 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #631 from elcodi/fix/appveyor
Browse files Browse the repository at this point in the history
moved and improved tests
  • Loading branch information
mmoreram committed Nov 18, 2015
2 parents 292eea2 + 9840a18 commit 62eb00d
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 54 deletions.
57 changes: 28 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,42 @@
language: php

env:
- COMPOSER_OPTIONS="update --prefer-source"
sudo: false

cache:
directories:
- bin
- vendor
- $HOME/.composer/cache

php:
- 5.4
- 5.5
- 5.6
- hhvm
- 7.0
- 5.4
- 5.5
- 5.6
- hhvm
- 7.0

matrix:
fast_finish: true
allow_failures:
- php: 7.0
- php: hhvm
fast_finish: true
allow_failures:
- php: 7.0
- php: hhvm

before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "wget http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar"
- "java -jar selenium-server-standalone-2.39.0.jar > /tmp/selenium.log 2> /tmp/selenium.error &"
# - sh -c "echo 'extension = redis.so' >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini"
- /home/travis/.phpenv/versions/$(phpenv version-name)/bin/composer self-update
- sh -c "sudo mkdir vendor"
- sh -c "sudo mount -t tmpfs -o size=512M tmpfs vendor"
- 'export DISPLAY=:99.0'
- 'sh -e /etc/init.d/xvfb start'
- 'wget http://selenium.googlecode.com/files/selenium-server-standalone-2.39.0.jar'
- 'java -jar selenium-server-standalone-2.39.0.jar > /tmp/selenium.log 2> /tmp/selenium.error &'
- 'if [[ $TRAVIS_PHP_VERSION != "hhvm" && $TRAVIS_PHP_VERSION != "7.0" ]]; then phpenv config-rm xdebug.ini; fi;'
- composer self-update
- 'if [[ -n "$GH_TOKEN" ]]; then composer config github-oauth.github.com ${GH_TOKEN}; fi;'

install:
- composer ${COMPOSER_OPTIONS} --no-interaction

before_script:
- sh -c "sudo mkdir /tmp/Bamboo"
- sh -c "sudo mount -t tmpfs -o size=512M tmpfs /tmp/Bamboo/"
- composer update --prefer-dist --no-interaction --no-progress

script:
- bin/behat -fprogress --tags="~javascript"
- bin/phpunit
- php app/console visithor:go --format=pretty --env=test
- bin/behat -fprogress --tags="~javascript"
- bin/phpunit
- php app/console visithor:go --format=pretty --env=test

notifications:
email: false

email: false
4 changes: 0 additions & 4 deletions app/config/config_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ framework:
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
path: "%database_path%"
user: "%database_user%"
password: "%database_password%"
charset: UTF8

orm:
Expand Down
2 changes: 1 addition & 1 deletion app/config/parameters_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ parameters:

database_driver: pdo_sqlite
database_name: bamboo_test
database_path: /tmp/Bamboo/bamboo.test
database_path: %kernel.cache_dir%bamboo.test
12 changes: 9 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@ build: false
platform: x86
clone_folder: c:\projects\elcodi

environment:
composer_oauth_token:
secure: 5C0BklEY/lq+iNw/I6jxBgwqC9yWeQL+/Am9vJQ0gRRg1gddmkZhkAZOmxplfw1i

matrix:
fast_finish: true

cache:
- '%LOCALAPPDATA%\Composer\files'

init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH%
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\SQLite\;%PATH%

install:
- cinst -y OpenSSL.Light
- cinst -y php
- cinst -y sqlite
- cd c:\tools\php
- copy php.ini-production php.ini /Y
- echo extension_dir=ext >> php.ini
Expand All @@ -28,9 +33,10 @@ install:
- echo extension=php_pdo_sqlite.dll >> php.ini
- cd %APPVEYOR_BUILD_FOLDER%
- php -r "readfile('http://getcomposer.org/installer');" | php
- php composer.phar config -g github-oauth.github.com %composer_oauth_token%
- php composer.phar install --prefer-dist --no-interaction --no-progress

test_script:
- cd %APPVEYOR_BUILD_FOLDER%
- bin\behat.bat -fprogress --tags="~javascript"
- bin\phpunit.bat --verbose
- 'bin\behat.bat -fprogress --tags="~javascript&&@store"'
- 'bin\phpunit.bat --verbose'
41 changes: 24 additions & 17 deletions src/Elcodi/Bridge/BehatBridgeBundle/DoctrineContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,31 @@ public function prepare(BeforeScenarioScope $scope)
*/
public function cleanDB(AfterScenarioScope $scope)
{
$this
->getContainer()
$container = $this->getContainer();

$container
->get('doctrine')
->getConnection()
->close();

$this
->application
->run(new ArrayInput([
'command' => 'doctrine:database:drop',
'--env' => 'test',
'--no-interaction' => true,
'--force' => true,
'--quiet' => true,
]));
// to remove if tests move from sqlite to *
$params = $container
->get('doctrine')
->getConnection()
->getParams();

unlink($params['path']);

// to restore if tests move from sqlite to *
// $this
// ->application
// ->run(new ArrayInput([
// 'command' => 'doctrine:database:drop',
// '--env' => 'test',
// '--no-interaction' => true,
// '--force' => true,
// '--quiet' => true,
// ]));
}

/**
Expand Down Expand Up @@ -109,6 +119,7 @@ private function executeCommand(
[
'command' => $command,
'--no-interaction' => true,
'--env' => 'test',
], $parameters
);

Expand Down Expand Up @@ -152,14 +163,10 @@ private function checkDoctrineConnection()
*/
private function loadCommonFixtures()
{
$rootDir = $this
->kernel
->getRootDir();

$command =
'doctrine:fixtures:load ' .
'--fixtures=' . $rootDir . '/../src/Elcodi/Plugin/ ' .
'--fixtures=' . $rootDir . '/../src/Elcodi/Fixtures ' .
'--fixtures=src/Elcodi/Plugin ' .
'--fixtures=src/Elcodi/Fixtures ' .
'--env=test ' .
'--no-interaction ';

Expand Down
5 changes: 5 additions & 0 deletions vagrant/ansible/roles/php/tasks/mod-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
lineinfile: dest=/etc/php5/apache2/php.ini
regexp=';?opcache.enable=\d'
line='opcache.enable=1'

- name: ensure xdebug.max_nesting_level is set to 255 in apache2 php.ini
lineinfile: dest=/etc/php5/apache2/php.ini
regexp='xdebug.max_nesting_level ='
line='xdebug.max_nesting_level = 255'
5 changes: 5 additions & 0 deletions vagrant/ansible/roles/php/tasks/php-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
lineinfile: dest=/etc/php5/cli/php.ini
regexp=';?opcache.enable_cli=\d'
line='opcache.enable_cli=1'

- name: ensure xdebug.max_nesting_level is set to 255 in cli php.ini
lineinfile: dest=/etc/php5/cli/php.ini
regexp='xdebug.max_nesting_level ='
line='xdebug.max_nesting_level = 255'
6 changes: 6 additions & 0 deletions vagrant/ansible/roles/php/tasks/php-fpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@
lineinfile: dest=/etc/php5/fpm/php.ini
regexp='date.timezone ='
line='date.timezone = {{ server.timezone }}'

- name: enabling opcache
lineinfile: dest=/etc/php5/fpm/php.ini
regexp=';?opcache.enable=\d'
line='opcache.enable=1'

- name: ensure xdebug.max_nesting_level is set to 255 in fpm php.ini
lineinfile: dest=/etc/php5/fpm/php.ini
regexp='xdebug.max_nesting_level ='
line='xdebug.max_nesting_level = 255'

0 comments on commit 62eb00d

Please sign in to comment.