Skip to content

Commit ba3e420

Browse files
committed
Setting up PHPUnit
1 parent c0d9ed0 commit ba3e420

File tree

9 files changed

+80
-0
lines changed

9 files changed

+80
-0
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ indent_style = space
1919

2020
[*.md]
2121
indent_style = space
22+
23+
[*.xml]
24+
indent_style = space
25+
26+
[*.json]
27+
indent_style = space

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ before_install:
5656

5757
script:
5858
- php --ri "Zephir Parser"
59+
- valgrind --read-var-info=yes --error-exitcode=1 --fullpath-after= --track-origins=yes --leak-check=full ./vendor/bin/phpunit -c phpunit.xml.dist --debug tests/
5960

6061
notifications:
6162
email:

appveyor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ build_script:
7878
- '%PHP_DEVPACK%\\phpize'
7979
- configure --enable-zephir_parser
8080
- nmake 2> compile-errors.log 1> compile.log
81+
- 'type compile-errors.log'
82+
- 'type compile.log'
83+
- 'php vendor\bin\phpunit -c phpunit.xml.dist --debug tests\'
8184

8285
on_finish:
8386
- cd %APPVEYOR_BUILD_FOLDER%

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"require": {
33
"phpunit/phpunit": "^4.8"
4+
},
5+
"autoload-dev": {
6+
"psr-4": {
7+
"Zephir\\Parser\\Tests\\": "tests/Extension/"
8+
}
49
}
510
}

phpunit.xml.dist

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
bootstrap="./tests/bootstrap.php"
6+
colors="true"
7+
convertErrorsToExceptions="true"
8+
convertNoticesToExceptions="true"
9+
convertWarningsToExceptions="true"
10+
processIsolation="false"
11+
stopOnFailure="false"
12+
syntaxCheck="true"
13+
verbose="true"
14+
>
15+
<testsuites>
16+
<testsuite name="Extension Test Suite">
17+
<directory suffix=".php">./tests/Extension/</directory>
18+
</testsuite>
19+
</testsuites>
20+
<logging>
21+
<log type="coverage-text" target="php://stdout" showUncoveredFiles="true"/>
22+
<log type="coverage-html" target="coverage" showUncoveredFiles="true"/>
23+
<log type="coverage-clover" target="coverage.xml" showUncoveredFiles="true"/>
24+
</logging>
25+
</phpunit>

tests/Data/.gitkeep

Whitespace-only changes.

tests/Extension/.gitkeep

Whitespace-only changes.

tests/Output/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

tests/bootstrap.php

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/*
4+
+--------------------------------------------------------------------------+
5+
| Zephir Parser. |
6+
+--------------------------------------------------------------------------+
7+
| Copyright (c) 2013-2017 Zephir Team and contributors |
8+
+--------------------------------------------------------------------------+
9+
| This source file is subject the MIT license, that is bundled with |
10+
| this package in the file LICENSE, and is available through the |
11+
| world-wide-web at the following url: |
12+
| http://zephir-lang.com/license.html |
13+
| |
14+
| If you did not receive a copy of the MIT license and are unable |
15+
| to obtain it through the world-wide-web, please send a note to |
16+
| license@zephir-lang.com so we can mail you a copy immediately. |
17+
+--------------------------------------------------------------------------+
18+
*/
19+
20+
// turn on all errors
21+
error_reporting(-1);
22+
23+
ini_set('date.timezone', 'UTC');
24+
ini_set('display_errors', 'on');
25+
ini_set('display_startup_errors', 'on');
26+
27+
$vendorPath = dirname(dirname(__FILE__)) . '/vendor';
28+
29+
if (!is_file($vendorPath . '/autoload.php')) {
30+
throw new \RuntimeException(
31+
'Unable to locate autoloader. Run `composer install` from the project root directory.'
32+
);
33+
}
34+
35+
require $vendorPath . '/autoload.php';
36+
37+
define('ZEPHIR_DATA', __DIR__ . DIRECTORY_SEPARATOR . 'Data' . DIRECTORY_SEPARATOR);
38+
define('OUTPUT_DATA', __DIR__ . DIRECTORY_SEPARATOR . 'Output' . DIRECTORY_SEPARATOR);

0 commit comments

Comments
 (0)