Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the test suite #15

Merged
merged 7 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
.gitignore export-ignore
.travis.yml export-ignore
build.xml export-ignore
phpunit.xml export-ignore
phpunit.xml.dist export-ignore
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/.idea/
/build/
/vendor/
/composer.lock
/composer.lock
phpunit.xml
.phpunit.result.cache
6 changes: 3 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
<target name="phpunit" depends="prepare" description="PHP unit">
<delete file="${basedir}/build/logs/phpunit.xml" quiet="true" />

<exec executable="${phpunit}">
<arg line='--configuration ${basedir}/phpunit.xml' />
<exec executable="${phpunit}" failonerror="true">
<arg line='--configuration ${basedir}/phpunit.xml.dist' />
<arg line='-d memory_limit=256M' />
<arg line='--log-junit "${basedir}/build/logs/phpunit.xml"' />
<arg line='${colors-arg.color}' />
Expand All @@ -79,7 +79,7 @@
<mkdir dir="${basedir}/build/coverage" />

<exec executable="${phpunit}" failonerror="true">
<arg line='--configuration ${basedir}/phpunit.xml' />
<arg line='--configuration ${basedir}/phpunit.xml.dist' />
<arg line='-d memory_limit=256M' />
<arg line='--log-junit "${basedir}/build/logs/phpunit.xml"' />
<arg line='--coverage-clover "${basedir}/build/logs/clover.xml"' />
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"php-parallel-lint/php-console-color": "^0.2 || ^0.3"
},
"require-dev": {
"phpunit/phpunit": "^4.8.36",
"phpunit/phpunit": "^4.8.36 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0",
"php-parallel-lint/php-parallel-lint": "^1.0",
"php-parallel-lint/php-var-dump-check": "0.*",
"squizlabs/php_codesniffer": "^3.5",
Expand Down
15 changes: 0 additions & 15 deletions phpunit.xml

This file was deleted.

19 changes: 19 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
backupGlobals="true"
bootstrap="./vendor/autoload.php"
colors="true">

<testsuites>
<testsuite name="PHP-Console-Highlighter">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>

</phpunit>
10 changes: 8 additions & 2 deletions tests/HigligterTest.php → tests/HighlighterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ protected function getConsoleColorMock()
return $mock;
}

protected function setUp()
/**
* @before
*/
protected function setUpHighlighter()
{
$this->uut = new Highlighter($this->getConsoleColorMock());
}

protected function compare($original, $expected)
{
$output = $this->uut->getWholeFile($original);
$this->assertEquals($expected, $output);
// Allow unit tests to succeed on non-*nix systems.
$output = str_replace(array("\r\n", "\r"), "\n", $output);

$this->assertSame($expected, $output);
}

public function testVariable()
Expand Down