Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Feb 5, 2017
1 parent 1d13edb commit 0b33278
Show file tree
Hide file tree
Showing 16 changed files with 51 additions and 31 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Expand Up @@ -18,12 +18,12 @@ matrix:
- php: hhvm

before_script:
- if [[ $TRAVIS_PHP_VERSION != "5.6" ]]; then COMPOSER_ROOT_VERSION=4.0 composer install --prefer-dist; fi
- if [[ $TRAVIS_PHP_VERSION = "5.6" ]]; then COMPOSER_ROOT_VERSION=4.0 composer require satooshi/php-coveralls --prefer-dist; fi
- if [[ $TRAVIS_PHP_VERSION != "5.6" ]]; then COMPOSER_ROOT_VERSION=4.0 composer install; fi
- if [[ $TRAVIS_PHP_VERSION = "5.6" ]]; then COMPOSER_ROOT_VERSION=4.0 composer require satooshi/php-coveralls; fi

script:
- mkdir -p build/logs
- phpunit --coverage-clover build/logs/clover.xml
- phpunit --coverage-clover ../build/logs/clover.xml

after_success:
- if [[ "$TRAVIS_PHP_VERSION" = "5.6" ]]; then php vendor/bin/coveralls -v; fi
6 changes: 3 additions & 3 deletions Makefile
Expand Up @@ -10,10 +10,10 @@ usage:
@echo "test: Runs the test suite.\ndoc: Creates the documentation.\nclean: Removes the documentation, the dependencies and the Composer files."

vendor:
@$(COMPOSER_ENV) composer install --prefer-dist
@$(COMPOSER_ENV) composer install

update:
@$(COMPOSER_ENV) composer update --prefer-dist
@$(COMPOSER_ENV) composer update

autoload: vendor
@$(COMPOSER_ENV) composer dump-autoload
Expand All @@ -23,7 +23,7 @@ test: vendor

test-coverage: vendor
@mkdir -p build/coverage
@phpunit --coverage-html build/coverage
@phpunit --coverage-html ../build/coverage

doc: vendor
@mkdir -p build/docs
Expand Down
9 changes: 9 additions & 0 deletions composer.json
Expand Up @@ -20,6 +20,7 @@

"minimum-stability": "dev",
"prefer-stable": true,
"prefer-dist": true,

"require": {
"php": ">=5.6",
Expand Down Expand Up @@ -49,6 +50,14 @@
},
"classmap": [ "lib/Module.php" ]
},
"autoload-dev": {
"psr-4": {
"ICanBoogie\\": "tests/lib"
},
"classmap": [
"tests/Application.php"
]
},

"scripts": {
"post-autoload-dump": "ICanBoogie\\Autoconfig\\Hooks::on_autoload_dump"
Expand Down
18 changes: 18 additions & 0 deletions tests/Application.php
@@ -0,0 +1,18 @@
<?php

/*
* This file is part of the ICanBoogie package.
*
* (c) Olivier Laviale <olivier.laviale@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace ICanBoogie;

class Application extends Core
{
use Module\ApplicationBindings;
use Binding\ActiveRecord\ApplicationBindings;
}
15 changes: 15 additions & 0 deletions tests/app/all/config/app.php
@@ -0,0 +1,15 @@
<?php

namespace ICanBoogie;

use ICanBoogie\Autoconfig\Autoconfig;

return [

Autoconfig::MODULE_PATH => [

getcwd() . DIRECTORY_SEPARATOR . 'modules'

]

];
26 changes: 1 addition & 25 deletions tests/bootstrap.php
Expand Up @@ -11,12 +11,8 @@

namespace ICanBoogie;

use ICanBoogie\Autoconfig\Autoconfig;

chdir(__DIR__);

$_SERVER['DOCUMENT_ROOT'] = __DIR__;

/* @var $autoload \Composer\Autoload\ClassLoader */

$autoload = require __DIR__ . '/../vendor/autoload.php';
Expand All @@ -25,24 +21,4 @@
$autoload->setPsr4('ICanBoogie\Module\ModulesTest\ModuleC\\', __DIR__ . '/modules/c/lib');
$autoload->setPsr4('ICanBoogie\Module\ModulesTest\Sample\\', __DIR__ . '/modules/sample/lib');

class Application extends Core
{
use Module\ApplicationBindings;
use Binding\ActiveRecord\ApplicationBindings;
}

boot(array_merge_recursive(get_autoconfig(), [

Autoconfig::CONFIG_PATH => [

__DIR__ . '/../config' => Autoconfig::CONFIG_WEIGHT_APP

],

Autoconfig::MODULE_PATH => [

__DIR__ . DIRECTORY_SEPARATOR . 'modules'

]

]));
boot();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/repository/.gitignore
@@ -0,0 +1,2 @@
*
!.gitignore

0 comments on commit 0b33278

Please sign in to comment.