Tests > implement Codeception (instead of PHPUnit)

This commit is contained in:
Meritoo
2018-05-28 17:42:15 +02:00
parent 7382bce842
commit 233473d915
8 changed files with 30 additions and 75 deletions

12
.gitignore vendored
View File

@@ -23,24 +23,12 @@
/.phing/properties /.phing/properties
# ----------------------------------------------------------------------------------------------------------------------
### PHPUnit
# ----------------------------------------------------------------------------------------------------------------------
/phpunit.xml
# ---------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------
### PHP Coding Standards Fixer generated files ### PHP Coding Standards Fixer generated files
# ---------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------
/.php_cs.cache /.php_cs.cache
# ----------------------------------------------------------------------------------------------------------------------
### Build files
# ----------------------------------------------------------------------------------------------------------------------
/.build/
# ---------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------
### Generated databases ### Generated databases
# ---------------------------------------------------------------------------------------------------------------------- # ----------------------------------------------------------------------------------------------------------------------

View File

@@ -76,7 +76,6 @@ dir.tests = ${project.basedir}/tests
dir.build = ${project.basedir}/.build dir.build = ${project.basedir}/.build
dir.reports = ${dir.build}/logs dir.reports = ${dir.build}/logs
dir.reports.pdepend = ${dir.reports}/pdepend dir.reports.pdepend = ${dir.reports}/pdepend
dir.reports.coverage = ${dir.reports}/phpunit_coverage
# #
# Disabled, because unnecessary right now # Disabled, because unnecessary right now
# phpdocumentor/phpdocumentor cannot be installed via Composer # phpdocumentor/phpdocumentor cannot be installed via Composer
@@ -97,9 +96,9 @@ dir.data.temporary = ${dir.data}/tmp
# Testing # Testing
# -------------------------------------------------------------------------------- # --------------------------------------------------------------------------------
# Path of the PHPUnit # Path of the framework used to run unit tests
# #
phpUnit.path = ./vendor/bin/phpunit tests_framework.path = ./vendor/bin/codecept
# Path of the PHP Coding Standards Fixer (http://cs.sensiolabs.org) # Path of the PHP Coding Standards Fixer (http://cs.sensiolabs.org)
# #

View File

@@ -87,7 +87,7 @@
<!-- Test target --> <!-- Test target -->
<target name="build:test" <target name="build:test"
depends="test:phpunit" depends="test:unit"
description="Executes all tests" /> description="Executes all tests" />
<!-- Project build clean --> <!-- Project build clean -->
@@ -103,7 +103,6 @@
<!--<mkdir dir="${dir.docs}" />--> <!--<mkdir dir="${dir.docs}" />-->
<!--<mkdir dir="${dir.docs.phpdoc2}" />--> <!--<mkdir dir="${dir.docs.phpdoc2}" />-->
<mkdir dir="${dir.reports}" /> <mkdir dir="${dir.reports}" />
<mkdir dir="${dir.reports.coverage}" />
<mkdir dir="${dir.reports.pdepend}" /> <mkdir dir="${dir.reports.pdepend}" />
</target> </target>
@@ -212,10 +211,9 @@
</target> </target>
<!-- Unit tests --> <!-- Unit tests -->
<target name="test:phpunit" description="Executes PHPUnit tests"> <target name="test:unit" description="Executes unit tests">
<echo msg="Running unit tests..." /> <echo msg="Running unit tests..." />
<exec command="${phpUnit.path} --verbose --no-coverage --configuration ${project.basedir}/phpunit.xml.dist" <exec command="${tests_framework.path} run --silent" passthru="true"/>
passthru="true"/>
</target> </target>
<!-- Checkout and finalization --> <!-- Checkout and finalization -->

22
codeception.yml Normal file
View File

@@ -0,0 +1,22 @@
namespace: 'Meritoo\Common\Test'
suites:
unit:
path: .
settings:
shuffle: true
lint: true
paths:
tests: tests
output: tests/_output
support: tests/_support
data: tests
coverage:
enabled: true
include:
- src/*
exclude:
- .data/*
- .docker/*
- .phing/*
- tests/*
- vendor/*

View File

@@ -17,11 +17,11 @@
"symfony/http-foundation": "^3.3" "symfony/http-foundation": "^3.3"
}, },
"require-dev": { "require-dev": {
"codeception/codeception": "^2.4",
"friendsofphp/php-cs-fixer": "^2.2", "friendsofphp/php-cs-fixer": "^2.2",
"pdepend/pdepend": "^2.5", "pdepend/pdepend": "^2.5",
"phploc/phploc": "^2.1", "phploc/phploc": "^2.1",
"phpmd/phpmd": "^2.6", "phpmd/phpmd": "^2.6",
"phpunit/phpunit": "^4.8",
"sebastian/phpcpd": "^2.0", "sebastian/phpcpd": "^2.0",
"squizlabs/php_codesniffer": "^2.9" "squizlabs/php_codesniffer": "^2.9"
}, },

View File

@@ -1,54 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="true"
backupStaticAttributes="false"
bootstrap="./vendor/autoload.php"
cacheTokens="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
mapTestClassNameToCoveredClassName="false"
printerClass="PHPUnit_TextUI_ResultPrinter"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
stopOnRisky="false"
testSuiteLoaderClass="PHPUnit_Runner_StandardTestSuiteLoader"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
verbose="true"
>
<php>
<ini name="error_reporting" value="-1"/>
</php>
<testsuites>
<testsuite name="Meritoo Package - Main Test Suite">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
<groups>
<exclude>
<group>performance</group>
</exclude>
</groups>
<logging>
<log type="coverage-html" target="./.build/logs/phpunit_coverage/html"/>
</logging>
</phpunit>

2
tests/_output/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*
!.gitignore

0
tests/_support/.gitkeep Normal file
View File