Skip to content

Commit

Permalink
Updates PHPUnit up to version 7 in plugin-hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Zykov authored and Helmut Januschka committed May 25, 2020
1 parent 7959bb3 commit b43fc35
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Unit Test:
- echo "zend_extension=xdebug.so" > /usr/local/etc/php/conf.d/xdebug.ini
- bin/install-wp-tests.sh wordpress_test root 'somepw' 127.0.0.1 latest
- composer update
- phpunit --colors=always --coverage-text=1.txt
- vendor/bin/phpunit --colors=always --coverage-text=1.txt
- grep "Lines:" 1.txt
except:
- /^v.*/ # do not unit test release tags
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"friendsofphp/php-cs-fixer": "^2.11",
"phpstan/phpstan": "^0.9.2",
"phpstan/phpstan-phpunit": "^0.9.4",
"phpunit/phpunit": "^6.0",
"phpunit/phpunit": "7.*",
"scrutinizer/ocular": "^1.5"
}
}
14 changes: 7 additions & 7 deletions tests/phpunit/PrettyPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class PrettyPrinter extends \PHPUnit\TextUI\ResultPrinter implements \PHPUnit\Fr
* Function name is slightly deceiving because it is called at the beginning of the
* unit test summary (after all tests have run)
*/
protected function printHeader()
protected function printHeader(): void
{
parent::printHeader();
}
Expand All @@ -23,7 +23,7 @@ protected function formatExceptionMsg($exceptionMessage)
return preg_replace("/\++(.*)$/m", " \033[01;31m$1\033[0m", $exceptionMessage);
}

protected function printDefectTrace(\PHPUnit\Framework\TestFailure $defect)
protected function printDefectTrace(\PHPUnit\Framework\TestFailure $defect): void
{
$this->write($this->formatExceptionMsg($defect->getExceptionAsString()));
$trace = \PHPUnit\Util\Filter::getFilteredStacktrace(
Expand Down Expand Up @@ -54,7 +54,7 @@ private function out($message, $color='', $linebreak=false)
/**
* Fired prior to each individual test
*/
public function startTest(\PHPUnit\Framework\Test $test)
public function startTest(\PHPUnit\Framework\Test $test): void
{
$this->out(">> RUN '".preg_replace("/^test/", "",$test->getName())."'...");
}
Expand All @@ -63,7 +63,7 @@ public function startTest(\PHPUnit\Framework\Test $test)
* @param PHPUnit\Framework\TestCase
* @param int time of execution
*/
public function endTest(\PHPUnit\Framework\Test $test, $time)
public function endTest(\PHPUnit\Framework\Test $test, $time): void
{
// copied from parent:endTest()
if ($test instanceof \PHPUnit\Framework\TestCase) {
Expand Down Expand Up @@ -93,7 +93,7 @@ public function endTest(\PHPUnit\Framework\Test $test, $time)
public function prettySuiteName($s) {
return preg_replace("/^Tests\\\/", "", $s);
}
public function startTestSuite(\PHPUnit\Framework\TestSuite $suite)
public function startTestSuite(\PHPUnit\Framework\TestSuite $suite): void
{
parent::startTestSuite($suite);
if (!$this->headerPrinted) {
Expand All @@ -112,7 +112,7 @@ public function startTestSuite(\PHPUnit\Framework\TestSuite $suite)
$this->out("BEGIN SUITE '".$this->prettySuiteName($suite->getName())."'\n");
}
}
public function endTestSuite(\PHPUnit\Framework\TestSuite $suite)
public function endTestSuite(\PHPUnit\Framework\TestSuite $suite): void
{
if ($suite->getName() != 'PHPUnit') {
$this->out("END SUITE '".$this->prettySuiteName($suite->getName())."'\n\n");
Expand All @@ -123,7 +123,7 @@ public function endTestSuite(\PHPUnit\Framework\TestSuite $suite)
* result codes that PHPUnit sends to the console
* @param string $progress
*/
protected function writeProgress($progress)
protected function writeProgress($progress): void
{
// suppress output;
}
Expand Down

0 comments on commit b43fc35

Please sign in to comment.