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

replace ignore-checks in tests #1193

Merged
merged 1 commit into from
Nov 24, 2019
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ bin/*
ansible/playbook.retry
test/etc/tasks/system/defaultexcludestestinput/
test/etc/types/selectors/tmp/
test/tmp/
1 change: 0 additions & 1 deletion test/classes/phing/PhingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
* // TODO implement all methods
*
* @author Kirill chEbba Chebunin <iam@chebba.org>
* @version $Revision: $
* @package phing
*/
class PhingTest extends \PHPUnit\Framework\TestCase
Expand Down
5 changes: 2 additions & 3 deletions test/classes/phing/regression/ExcludeZipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
* - Excluded files may be included in Zip/Tar tasks
*
* @package phing.regression
*
* @requires extension zip
*/
class ExcludeZipTest extends BuildFileTest
{
public function setUp(): void
{
if (!extension_loaded('zip')) {
$this->markTestSkipped("Zip extension is required");
}
$this->configureProject(PHING_TEST_BASE . "/etc/regression/137/build.xml");
}

Expand Down
5 changes: 0 additions & 5 deletions test/classes/phing/regression/PearPkg2CompatibilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
class PearPkg2CompatibilityTest extends BuildFileTest
{
private $savedErrorLevel;
protected $backupGlobals = false;

public function setUp(): void
{
Expand All @@ -37,10 +36,6 @@ public function setUp(): void
$buildFile = PHING_TEST_BASE . "/etc/regression/524/build.xml";
$this->configureProject($buildFile);

if (defined('HHVM_VERSION')) {
$this->markTestSkipped("PEAR tests do not run on HHVM");
}

if (!class_exists('PEAR_PackageFileManager', false)) {
$this->markTestSkipped("This test requires PEAR_PackageFileManager to be installed");
}
Expand Down
2 changes: 2 additions & 0 deletions test/classes/phing/system/condition/SocketConditionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
* Tests for the <socket> condition
*
* @package phing.tasks.system.condition
*
* @requires extension sockets
*/
class SocketConditionTest extends \PHPUnit\Framework\TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@ abstract class AbstractWinFileSystemTestCase extends \PHPUnit\Framework\TestCase

protected function setUp(): void
{
if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
$this->markTestSkipped(
'Testing not on a windows os.'
);
}
$this->fs = $this->createFileSystem();
}

Expand Down
2 changes: 2 additions & 0 deletions test/classes/phing/system/io/WindowsFileSystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
*
* @author Daniel Holmes
* @package phing.system.io
*
* @requires OS WIN32|WINNT
*/
class WindowsFileSystemTest extends AbstractWinFileSystemTestCase
{
Expand Down
6 changes: 2 additions & 4 deletions test/classes/phing/tasks/ext/DbDeployTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,13 @@
/**
* @author Michiel Rook <mrook@php.net>
* @package phing.tasks.ext
*
* @requires extension sqlite
*/
class DbDeployTaskTest extends BuildFileTest
{
public function setUp(): void
{
if (!extension_loaded('sqlite')) {
$this->markTestSkipped('This test require sqlite extension to be loaded');
}

$this->configureProject(PHING_TEST_BASE . "/etc/tasks/ext/dbdeploy/build.xml");
$this->executeTarget("prepare");
}
Expand Down
6 changes: 2 additions & 4 deletions test/classes/phing/tasks/ext/PHPLOCTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@
*
* @author Michiel Rook <mrook@php.net>
* @package phing.tasks.ext
*
* @requires PHP < 7.3
*/
class PHPLOCTaskTest extends BuildFileTest
{
public function setUp(): void
{
if (PHP_VERSION_ID >= 70300) {
$this->markTestSkipped('phploc task is not running on PHP 7.3');
}

$this->configureProject(PHING_TEST_BASE . "/etc/tasks/ext/phploc/build.xml");
}

Expand Down
6 changes: 0 additions & 6 deletions test/classes/phing/tasks/ext/PearPackageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
*/
class PearPackageTest extends BuildFileTest
{
protected $backupGlobals = false;

private $savedErrorLevel;

public function setUp(): void
Expand All @@ -36,10 +34,6 @@ public function setUp(): void
$buildFile = PHING_TEST_BASE . "/etc/tasks/ext/pearpackage.xml";
$this->configureProject($buildFile);

if (defined('HHVM_VERSION')) {
$this->markTestSkipped("PEAR tests do not run on HHVM");
}

if (!class_exists('PEAR_PackageFileManager', false)) {
$this->markTestSkipped("This test requires PEAR_PackageFileManager to be installed");
}
Expand Down
11 changes: 3 additions & 8 deletions test/classes/phing/tasks/ext/PharDataTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,11 @@
*/
class PharDataTaskTest extends BuildFileTest
{
/**
* @requires extension phar
*/
public function setUp(): void
{
if (!extension_loaded('phar')) {
$this->markTestSkipped("PharDataTask require either PHP 5.3 or better or the PECL's Phar extension");
}

if (defined('HHVM_VERSION')) {
$this->markTestSkipped("PHAR tests do not run on HHVM");
}

$this->configureProject(
PHING_TEST_BASE
. "/etc/tasks/ext/PharDataTaskTest.xml"
Expand Down
5 changes: 1 addition & 4 deletions test/classes/phing/tasks/ext/PharPackageTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @author François Poirotte <clicky@erebot.net>
* @package phing.tasks.ext
* @requires extension phar
* @requires extension openssl
*/
class PharPackageTaskTest extends BuildFileTest
{
Expand All @@ -32,10 +33,6 @@ public function setUp(): void
$this->markTestSkipped("This test require phar.readonly php.ini setting to be disabled");
}

if (defined('HHVM_VERSION')) {
$this->markTestSkipped("PHAR tests do not run on HHVM");
}

$this->configureProject(PHING_TEST_BASE . "/etc/tasks/ext/pharpackage/build.xml");
}

Expand Down
4 changes: 0 additions & 4 deletions test/classes/phing/tasks/ext/PhpCodeSnifferTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ class PhpCodeSnifferTaskTest extends BuildFileTest
{
public function setUp(): void
{
if (defined('HHVM_VERSION')) {
$this->markTestSkipped("PHP CodeSniffer tests do not (yet) run on HHVM");
}

if (!class_exists('PHP_CodeSniffer')) {
$this->markTestSkipped('PHP CodeSniffer package not available.');
}
Expand Down
6 changes: 2 additions & 4 deletions test/classes/phing/tasks/ext/PhpLintTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ public function testSyntaxError()

/**
* Regression test for ticket http://www.phing.info/trac/ticket/590
*
* @requires PHP < 7.0
*/
public function testDeprecated()
{
if (defined('HHVM_VERSION') || PHP_MAJOR_VERSION > 5) {
$this->markTestSkipped("Testing for deprecated statements only works on PHP 5.x");
}

file_put_contents(
PHING_TEST_BASE . '/tmp/phplint_file.php',
'<?php class TestClass {}; $t = & new TestClass();'
Expand Down
3 changes: 3 additions & 0 deletions test/classes/phing/tasks/ext/VisualizerTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
* <http://phing.info>.
*/

/**
* @requires extension xsl
*/
class VisualizerTaskTest extends BuildFileTest
{
public function setUp(): void
Expand Down
5 changes: 2 additions & 3 deletions test/classes/phing/tasks/ext/ZipUnzipTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,13 @@
*
* @author Michiel Rook <mrook@php.net>
* @package phing.tasks.ext
*
* @requires extension zip
*/
class ZipUnzipTaskTest extends BuildFileTest
{
public function setUp(): void
{
if (!extension_loaded('zip')) {
$this->markTestSkipped("Zip extension is required");
}
$this->configureProject(
PHING_TEST_BASE
. "/etc/tasks/ext/ZipUnzipTaskTest.xml"
Expand Down
6 changes: 3 additions & 3 deletions test/classes/phing/tasks/ext/property/VariableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ public function setUp(): void
);
}

/**
* @requires PHP > 5.3
*/
public function testVariable()
{
if (version_compare(PHP_VERSION, '5.3', '<')) {
$this->markTestSkipped('PHP Version less than 5.3');
}
$this->executeTarget(__FUNCTION__);

$this->assertInLogs('1: aazz');
Expand Down
61 changes: 29 additions & 32 deletions test/classes/phing/tasks/ext/rST/RSTTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,38 +72,35 @@ protected function assertFileCreated($file)
unlink(PHING_TEST_BASE . '/etc/tasks/ext/rst/' . $file);
}

/**
* @requires function ReflectionMethod::setAccessible
*/
public function testGetToolPathFail()
{
if (method_exists('ReflectionMethod', 'setAccessible')) {
$rt = new RSTTask();
$ref = new ReflectionClass($rt);
$method = $ref->getMethod('getToolPath');
$method->setAccessible(true);

$this->expectException(BuildException::class);
$this->expectExceptionMessage('"rst2doesnotexist" not found. Install python-docutils.');

$method->invoke($rt, 'doesnotexist');
} else {
$this->markTestSkipped('No ReflectionMethod::setAccessible available.');
}
$rt = new RSTTask();
$ref = new ReflectionClass($rt);
$method = $ref->getMethod('getToolPath');
$method->setAccessible(true);

$this->expectException(BuildException::class);
$this->expectExceptionMessage('"rst2doesnotexist" not found. Install python-docutils.');

$method->invoke($rt, 'doesnotexist');
}

/**
* Get the tool path previously set with setToolpath()
*
* @requires function ReflectionMethod::setAccessible
*/
public function testGetToolPathCustom()
{
if (method_exists('ReflectionMethod', 'setAccessible')) {
$rt = new RSTTask();
$rt->setToolpath('true'); //mostly /bin/true on unix
$ref = new ReflectionClass($rt);
$method = $ref->getMethod('getToolPath');
$method->setAccessible(true);
$this->assertContains('/true', $method->invoke($rt, 'foo'));
} else {
$this->markTestSkipped('No ReflectionMethod::setAccessible available.');
}
$rt = new RSTTask();
$rt->setToolpath('true'); //mostly /bin/true on unix
$ref = new ReflectionClass($rt);
$method = $ref->getMethod('getToolPath');
$method->setAccessible(true);
$this->assertContains('/true', $method->invoke($rt, 'foo'));
}

public function testSetToolpathNotExisting()
Expand All @@ -126,17 +123,17 @@ public function testSetToolpathNonExecutable()
$rt->setToolpath(__FILE__);
}

/**
* @throws ReflectionException
* @requires function ReflectionMethod::setAccessible
*/
public function testGetToolPathHtmlFormat()
{
if (method_exists('ReflectionMethod', 'setAccessible')) {
$rt = new RSTTask();
$ref = new ReflectionClass($rt);
$method = $ref->getMethod('getToolPath');
$method->setAccessible(true);
$this->assertContains('rst2html', $method->invoke($rt, 'html'));
} else {
$this->markTestSkipped('No ReflectionMethod::setAccessible available.');
}
$rt = new RSTTask();
$ref = new ReflectionClass($rt);
$method = $ref->getMethod('getToolPath');
$method->setAccessible(true);
$this->assertContains('rst2html', $method->invoke($rt, 'html'));
}

public function testSingleFileParameterFile()
Expand Down
Loading