Skip to content
Snippets Groups Projects
Commit bdf36ed8 authored by Daniel Hürtgen's avatar Daniel Hürtgen
Browse files

FEATURE: Initialized unit tests

parent e63949aa
Branches
No related merge requests found
Pipeline #361 failed with stages
in 2 minutes and 51 seconds
stages: stages:
- lint - lint
- test
.lint: &lint .lint: &lint
image: composer image: composer
...@@ -26,3 +27,37 @@ lint:coding-guideline: ...@@ -26,3 +27,37 @@ lint:coding-guideline:
script: script:
- mkdir result - mkdir result
- ./vendor/bin/phpcs -n --report-full=result/phpcs-full.txt --report-diff=result/phpcs-diff.txt --report-summary=result/phpcs-summary.txt - ./vendor/bin/phpcs -n --report-full=result/phpcs-full.txt --report-diff=result/phpcs-diff.txt --report-summary=result/phpcs-summary.txt
.test: &test
stage: test
tags:
- docker
variables:
TIMEZONE: "Europe/Berlin"
WITH_XDEBUG: "true"
before_script:
- apt-get update; apt-get install -y unzip
- composer install --optimize-autoloader --no-interaction --no-ansi --prefer-dist
script:
- ./vendor/bin/phpunit --coverage-text --colors=never
test:5.3:
<<: *test
image: tetraweb/php:5.3
test:5.4:
<<: *test
image: tetraweb/php:5.4
test:5.5:
<<: *test
image: tetraweb/php:5.5
test:5.6:
<<: *test
image: tetraweb/php:5.6
test:7.0:
<<: *test
image: tetraweb/php:7.0
test:7.1:
<<: *test
image: tetraweb/php:7.1
test:latest:
<<: *test
image: tetraweb/php:latest
...@@ -25,11 +25,17 @@ ...@@ -25,11 +25,17 @@
"issues": "https://git.higidi.com/higidi/ninja-mutex/issues", "issues": "https://git.higidi.com/higidi/ninja-mutex/issues",
"source": "https://git.higidi.com/higidi/ninja-mutex" "source": "https://git.higidi.com/higidi/ninja-mutex"
}, },
"autoload-dev": {
"psr-4": {
"Higidi\\NinjaMutex\\Tests\\": "tests/"
}
},
"require": { "require": {
"php": ">=5.3.0", "php": ">=5.3.0",
"arvenil/ninja-mutex": "^0.6" "arvenil/ninja-mutex": "^0.6"
}, },
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": "^2.9|^3.0" "squizlabs/php_codesniffer": "^2.9||^3.0",
"phpunit/phpunit": "^4.5||^5.0.5"
} }
} }
...@@ -7,4 +7,10 @@ ...@@ -7,4 +7,10 @@
<arg name="encoding" value="utf-8" /> <arg name="encoding" value="utf-8" />
<rule ref="PSR2"/> <rule ref="PSR2"/>
<file>./tests</file>
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
<exclude-pattern>./tests/bootstrap.php</exclude-pattern>
</rule>
</ruleset> </ruleset>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="tests/bootstrap.php">
<filter>
<whitelist>
<directory>./src/</directory>
</whitelist>
</filter>
</phpunit>
<?php
error_reporting(E_ALL);
if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
date_default_timezone_set(@date_default_timezone_get());
}
function includeIfExists($file)
{
return file_exists($file) ? include $file : false;
}
if (!$autoLoader = includeIfExists(__DIR__ . '/../vendor/autoload.php')) {
echo 'You must set up the project dependencies, run the following command from the project root:' . PHP_EOL .
'php composer.phar install' . PHP_EOL;
exit(1);
}
return $autoLoader;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment