Skip to content

Commit

Permalink
Merge pull request #399 from AntonShevchuk/master
Browse files Browse the repository at this point in the history
Migrate to codeception
  • Loading branch information
Anton authored Feb 16, 2017
2 parents e7ece21 + dacc06c commit d45aba6
Show file tree
Hide file tree
Showing 121 changed files with 3,017 additions and 299 deletions.
2 changes: 1 addition & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
service_name: travis-ci
coverage_clover: .reports/clover.xml
coverage_clover: tests/_output/coverage.xml
json_path: .reports/coveralls-upload.json
28 changes: 10 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,25 @@ install:
- mysql -e 'CREATE DATABASE bluz;'
before_script:
# Database
- mysql -uroot bluz < tests/dump.sql
- mysql -uroot bluz < tests/_data/dump.sql
# Directories
- mkdir .reports
- chmod a+w ./tests/cache
- chmod a+w ./tests/_output
# Codeception
- wget http://codeception.com/codecept.phar
# Scrutinizer
- wget https://scrutinizer-ci.com/ocular.phar
script:
# PHPUnit tests
- php vendor/bin/phpunit --configuration ./phpunit.xml.dist --coverage-clover=.reports/clover.xml --coverage-xml=.reports/coverage
# Code style
#- php vendor/bin/phpcs --report=xml --report-file=.reports/phpcs.xml
- php vendor/bin/phpcs
# Lines of code
- php vendor/bin/phploc --log-xml=.reports/phploc.xml src
# Mess detection
- php vendor/bin/phpmd ./src xml codesize,unusedcode,naming --reportfile .reports/phpmd.xml || true
# Duplicate code
#- php vendor/bin/phpcpd --log-pmd .reports/pmd-cpd.xml src
# works incorrect with latest PHP versions
# PHP Depend
#- php vendor/bin/pdepend --jdepend-xml=.reports/jdepend.xml --jdepend-chart=.reports/dependencies.svg --overview-pyramid=.reports/pyramid.svg ./src

# CodeCeption
- php codecept.phar run --coverage-xml
after_script:
# Coveralls
- php vendor/bin/coveralls -v
# Scrutinizer
- wget https://scrutinizer-ci.com/ocular.phar
- php ocular.phar code-coverage:upload --format=php-clover .reports/clover.xml
# PHPDocumentor
- php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml
# Generate documentation
- bash .travis.sh
notifications:
email: false
Expand Down
27 changes: 27 additions & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: 'mysql:host=localhost;dbname=bluz'
user: 'root'
password: ''
dump: tests/_data/dump.sql
PhpBrowser:
url: http://127.0.0.1:8000/
REST:
url: http://127.0.0.1:8000/
depends: PhpBrowser
part: Json
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"zendframework/zend-diactoros": "~1.3"
},
"require-dev": {
"phpunit/phpunit": "~6.0",
"satooshi/php-coveralls": "~1.0",
"squizlabs/php_codesniffer": "~2.3",
"phploc/phploc": "*",
Expand Down
23 changes: 0 additions & 23 deletions phpunit.xml.dist

This file was deleted.

11 changes: 1 addition & 10 deletions tests/bootstrap.php → tests/_bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
// This is global bootstrap for autoloading
// Environment
define('DEBUG', true);
error_reporting(E_ALL | E_STRICT);
Expand All @@ -9,15 +10,5 @@
define('PATH_APPLICATION', PATH_ROOT . '/tests');
define('PATH_VENDOR', PATH_ROOT . '/vendor');

// Emulate session
$_SESSION = [];
$_COOKIE[session_name()] = uniqid();

// init autoloader
require_once PATH_ROOT . '/vendor/autoload.php';

// init application
$env = getenv('BLUZ_ENV') ?: 'testing';

$app = \Bluz\Tests\BootstrapTest::getInstance();
$app->init($env);
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/_output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
26 changes: 26 additions & 0 deletions tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php


/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;

/**
* Define custom actions here
*/
}
26 changes: 26 additions & 0 deletions tests/_support/FunctionalTester.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php


/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;

/**
* Define custom actions here
*/
}
10 changes: 10 additions & 0 deletions tests/_support/Helper/Acceptance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class Acceptance extends \Codeception\Module
{

}
10 changes: 10 additions & 0 deletions tests/_support/Helper/Functional.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class Functional extends \Codeception\Module
{

}
10 changes: 10 additions & 0 deletions tests/_support/Helper/Unit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace Helper;

// here you can define custom actions
// all public methods declared in helper class will be available in $I

class Unit extends \Codeception\Module
{

}
26 changes: 26 additions & 0 deletions tests/_support/UnitTester.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php


/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;

/**
* Define custom actions here
*/
}
Loading

0 comments on commit d45aba6

Please sign in to comment.