From b4793bc9f68a90e85141891dc8814fc61d36cebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 10 Nov 2019 13:55:48 +0100 Subject: [PATCH 1/2] remove @expectedException* annotation --- .../condition/VersionCompareConditionTest.php | 5 +-- .../phing/system/io/IniFileParserTest.php | 4 +- .../phing/system/io/YamlFileParserTest.php | 8 +++- .../phing/system/lang/EventObjectTest.php | 7 ++- test/classes/phing/tasks/PropertyTaskTest.php | 42 ++++++++++------- test/classes/phing/tasks/TaskdefTaskTest.php | 5 +-- test/classes/phing/tasks/TypedefTaskTest.php | 5 +-- .../phing/tasks/ext/GrowlNotifyTaskTest.php | 5 ++- .../phing/tasks/ext/HTTP/BaseHttpTaskTest.php | 6 +-- .../phing/tasks/ext/HTTP/HttpGetTaskTest.php | 15 +++---- .../tasks/ext/HTTP/HttpRequestTaskTest.php | 7 ++- .../Acceptance/PHPStanTaskTest.php | 4 +- .../PHPStanCommandBuilderFactoryTest.php | 5 +-- .../PHPStanCommandBuilderTest.php | 5 +-- .../Acceptance/SassTaskAcceptanceTest.php | 15 +++---- .../SassTask/Integration/SassCompilerTest.php | 5 +-- .../Integration/ScssPhpCompilerTest.php | 5 +-- .../Unit/SassTaskCompilerFactoryTest.php | 14 +++--- .../tasks/ext/inifile/IniFileTaskTest.php | 26 +++++------ .../ext/rST/RSTTaskMultipleMappersTest.php | 7 ++- .../phing/tasks/ext/rST/RSTTaskTest.php | 33 +++++++------- .../SonarConfigurationFileParserTest.php | 16 +++---- .../phing/tasks/system/AppendTaskTest.php | 13 +++--- .../phing/tasks/system/BlockForTaskTest.php | 5 +-- .../phing/tasks/system/ExecTaskTest.php | 45 ++++++++++--------- .../phing/tasks/system/ForeachTaskTest.php | 9 ++-- .../phing/tasks/system/RelentlessTest.php | 8 ++-- test/classes/phing/tasks/system/RetryTest.php | 7 ++- .../phing/tasks/system/TouchTaskTest.php | 6 +-- .../phing/tasks/system/TruncateTaskTest.php | 15 +++---- test/classes/phing/types/CommandlineTest.php | 22 +++++---- test/classes/phing/types/DataTypeTest.php | 21 ++++----- test/classes/phing/types/EnvironmentTest.php | 8 ++-- test/classes/phing/types/PatternSetTest.php | 32 ++++++------- .../phing/types/PearPackageFileSetTest.php | 8 ++-- test/classes/phing/types/ReferenceTest.php | 20 ++++----- .../phing/util/DirectoryScannerTest.php | 8 ++-- .../phing/util/PearPackageScannerTest.php | 28 ++++++------ 38 files changed, 245 insertions(+), 254 deletions(-) diff --git a/test/classes/phing/system/condition/VersionCompareConditionTest.php b/test/classes/phing/system/condition/VersionCompareConditionTest.php index 04483b3d2d..7b1d9cefda 100644 --- a/test/classes/phing/system/condition/VersionCompareConditionTest.php +++ b/test/classes/phing/system/condition/VersionCompareConditionTest.php @@ -47,11 +47,10 @@ public function testUseDebugMode() $this->_condition->evaluate(); } - /** - * @expectedException BuildException - */ public function testCanNotUseUnsupportedOperator() { + $this->expectException(BuildException::class); + $this->_condition->setOperator('<<<<'); } } diff --git a/test/classes/phing/system/io/IniFileParserTest.php b/test/classes/phing/system/io/IniFileParserTest.php index c9753e4a93..f6fd8146b6 100644 --- a/test/classes/phing/system/io/IniFileParserTest.php +++ b/test/classes/phing/system/io/IniFileParserTest.php @@ -51,11 +51,13 @@ public function testParseFile($data, $expected) /** * @covers IniFileParser::parseFile - * @expectedException IOException */ public function testParseFileCouldntOpenFile() { $phingFile = new PhingFile(uniqid('', true)); + + $this->expectException(IOException::class); + $this->parser->parseFile($phingFile); } diff --git a/test/classes/phing/system/io/YamlFileParserTest.php b/test/classes/phing/system/io/YamlFileParserTest.php index 7f8681e46c..6f1c59ca17 100644 --- a/test/classes/phing/system/io/YamlFileParserTest.php +++ b/test/classes/phing/system/io/YamlFileParserTest.php @@ -65,7 +65,6 @@ public function tearDown(): void /** * @covers IniFileParser::parseFile - * @expectedException IOException */ public function testParseFileFileNotReadable() { @@ -73,16 +72,21 @@ public function testParseFileFileNotReadable() touch($tmpFile); $file = new PhingFile($tmpFile); unlink($tmpFile); + + $this->expectException(IOException::class); + $this->objectToTest->parseFile($file); } /** * @covers IniFileParser::parseFile - * @expectedException IOException */ public function testParseFileFileIncorrectYaml() { $file = new PhingFile($this->incorrectYamlFileStub); + + $this->expectException(IOException::class); + $this->objectToTest->parseFile($file); } diff --git a/test/classes/phing/system/lang/EventObjectTest.php b/test/classes/phing/system/lang/EventObjectTest.php index 922c24b08c..f0bec9b016 100644 --- a/test/classes/phing/system/lang/EventObjectTest.php +++ b/test/classes/phing/system/lang/EventObjectTest.php @@ -44,12 +44,11 @@ public function testEventObject() $this->assertSame('EventObject[source=stdClass]', (string) $this->eventObject); } - /** - * @expectedException Exception - * @expectedExceptionMessage Null source - */ public function testEventObjectThrowsExceptionOnNull() { + $this->expectException(Exception::class); + $this->expectExceptionMessage('Null source'); + new EventObject(null); } } diff --git a/test/classes/phing/tasks/PropertyTaskTest.php b/test/classes/phing/tasks/PropertyTaskTest.php index 9c1bc34b6e..9c7b95908e 100644 --- a/test/classes/phing/tasks/PropertyTaskTest.php +++ b/test/classes/phing/tasks/PropertyTaskTest.php @@ -55,14 +55,19 @@ public function testPrefixSuccess() public function testPrefixFailure() { - try { - $this->executeTarget("prefix.fail"); - } catch (BuildException $e) { - $this->assertContains("Prefix is only valid", $e->getMessage(), "Prefix allowed on non-resource/file load - "); - - return; - } - $this->fail("Did not throw exception on invalid use of prefix"); + $this->expectException(BuildException::class); + $this->expectExceptionMessageRegExp('/Prefix is only valid/'); + +// try { +// $this->executeTarget("prefix.fail"); +// } catch (BuildException $e) { +// $this->assertContains("Prefix is only valid", $e->getMessage(), "Prefix allowed on non-resource/file load - "); +// +// return; +// } +// $this->fail("Did not throw exception on invalid use of prefix"); + + $this->executeTarget("prefix.fail"); } public function testFilterChain() @@ -85,14 +90,19 @@ public function circularDefinitionTargets() */ public function testCircularDefinitionDetection($target) { - try { - $this->executeTarget($target); - } catch (BuildException $e) { - $this->assertContains("was circularly defined", $e->getMessage(), "Circular definition not detected - "); - - return; - } - $this->fail("Did not throw exception on circular exception"); + $this->expectException(BuildException::class); + $this->expectExceptionMessageRegExp('/was circularly defined/'); + +// try { +// $this->executeTarget($target); +// } catch (BuildException $e) { +// $this->assertContains("was circularly defined", $e->getMessage(), "Circular definition not detected - "); +// +// return; +// } +// $this->fail("Did not throw exception on circular exception"); + + $this->executeTarget($target); } public function testToString() diff --git a/test/classes/phing/tasks/TaskdefTaskTest.php b/test/classes/phing/tasks/TaskdefTaskTest.php index 0f5157e612..aeb61eddd9 100644 --- a/test/classes/phing/tasks/TaskdefTaskTest.php +++ b/test/classes/phing/tasks/TaskdefTaskTest.php @@ -43,11 +43,10 @@ public function testNoClassname() $this->expectBuildException("noClassname", "required argument not specified"); } - /** - * @expectedException BuildException - */ public function testClassNotFound() { + $this->expectException(BuildException::class); + try { $this->executeTarget("classNotFound"); $this->fail( diff --git a/test/classes/phing/tasks/TypedefTaskTest.php b/test/classes/phing/tasks/TypedefTaskTest.php index f07a3ca5ff..7fe4693542 100644 --- a/test/classes/phing/tasks/TypedefTaskTest.php +++ b/test/classes/phing/tasks/TypedefTaskTest.php @@ -45,11 +45,10 @@ public function testNoClassname() $this->expectBuildException("noClassname", "required argument not specified"); } - /** - * @expectedException BuildException - */ public function testClassNotFound() { + $this->expectException(BuildException::class); + try { $this->executeTarget("classNotFound"); $this->fail( diff --git a/test/classes/phing/tasks/ext/GrowlNotifyTaskTest.php b/test/classes/phing/tasks/ext/GrowlNotifyTaskTest.php index 7b62227405..c125f6326d 100644 --- a/test/classes/phing/tasks/ext/GrowlNotifyTaskTest.php +++ b/test/classes/phing/tasks/ext/GrowlNotifyTaskTest.php @@ -99,12 +99,13 @@ public function setUp(): void /** * Test for required message attribute * - * @expectedException BuildException - * @expectedExceptionMessage "message" attribute cannot be empty * @return void */ public function testEmptyMessage() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('"message" attribute cannot be empty'); + $this->executeTarget(__FUNCTION__); } diff --git a/test/classes/phing/tasks/ext/HTTP/BaseHttpTaskTest.php b/test/classes/phing/tasks/ext/HTTP/BaseHttpTaskTest.php index ef0185ab96..1ecf5c794d 100644 --- a/test/classes/phing/tasks/ext/HTTP/BaseHttpTaskTest.php +++ b/test/classes/phing/tasks/ext/HTTP/BaseHttpTaskTest.php @@ -58,12 +58,10 @@ protected function createMockAdapter(array $responses) return $adapter; } - /** - * @expectedException BuildException - * @expectedExceptionMessage Required attribute 'url' is missing - */ public function testMissingUrl() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Required attribute \'url\' is missing'); $this->executeTarget('missingURL'); } } diff --git a/test/classes/phing/tasks/ext/HTTP/HttpGetTaskTest.php b/test/classes/phing/tasks/ext/HTTP/HttpGetTaskTest.php index 1eac27ad23..8fb6543d92 100644 --- a/test/classes/phing/tasks/ext/HTTP/HttpGetTaskTest.php +++ b/test/classes/phing/tasks/ext/HTTP/HttpGetTaskTest.php @@ -29,19 +29,14 @@ public function setUp(): void $this->configureProject(PHING_TEST_BASE . "/etc/tasks/ext/http/httpget.xml"); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Required attribute 'dir' is missing - */ public function testMissingDir() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Required attribute \'dir\' is missing'); + $this->executeTarget('missingDir'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Response from server: 404 Not Found - */ public function testError404() { $this->copyTasksAddingCustomRequest( @@ -58,6 +53,10 @@ public function testError404() ) ) ); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Response from server: 404 Not Found'); + $this->executeTarget('recipient'); } diff --git a/test/classes/phing/tasks/ext/HTTP/HttpRequestTaskTest.php b/test/classes/phing/tasks/ext/HTTP/HttpRequestTaskTest.php index 9df279a1b8..98df059364 100644 --- a/test/classes/phing/tasks/ext/HTTP/HttpRequestTaskTest.php +++ b/test/classes/phing/tasks/ext/HTTP/HttpRequestTaskTest.php @@ -57,14 +57,13 @@ public function testMatchesCodeRegexp() $this->expectLog('recipient', 'The response status-code matched the provided regex.'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage The received response body did not match the given regular expression - */ public function testDoesntMatchRegexp() { $this->copyTasksAddingCustomRequest('doesNotMatchRegexp', 'recipient', $this->createRequestWithMockAdapter()); + $this->expectException(BuildException::class); + $this->expectExceptionMessage('The received response body did not match the given regular expression'); + $this->executeTarget('recipient'); } diff --git a/test/classes/phing/tasks/ext/PHPStanTask/Acceptance/PHPStanTaskTest.php b/test/classes/phing/tasks/ext/PHPStanTask/Acceptance/PHPStanTaskTest.php index e41bdfd2c0..62083e8091 100644 --- a/test/classes/phing/tasks/ext/PHPStanTask/Acceptance/PHPStanTaskTest.php +++ b/test/classes/phing/tasks/ext/PHPStanTask/Acceptance/PHPStanTaskTest.php @@ -52,11 +52,11 @@ public function testExecutableCanBeSet(): void /** * @depends testItRun - * @expectedException BuildException - * @expectedExceptionMessage unknown command */ public function testTestInvalidCommandCausesBuildError(): void { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('unknown command'); $this->executeTarget("testInvalidCommand"); } diff --git a/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderFactoryTest.php b/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderFactoryTest.php index 3613b9de26..562fcbe5b7 100644 --- a/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderFactoryTest.php +++ b/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderFactoryTest.php @@ -55,14 +55,13 @@ public function testItCanCreateHelpCommandBuilder(): void $this->assertInstanceOf(PHPStanHelpCommandBuilder::class, $builder); } - /** - * @expectedException BuildException - */ public function testItThrowsExceptionWhenCommandIsUnknown(): void { $task = new PHPStanTask(); $task->setCommand('any unknown'); + $this->expectException(BuildException::class); + $this->factory->createBuilder($task); } } diff --git a/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderTest.php b/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderTest.php index 6cd472217a..35e000b1d2 100644 --- a/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderTest.php +++ b/test/classes/phing/tasks/ext/PHPStanTask/Unit/CommandBuilder/PHPStanCommandBuilderTest.php @@ -32,14 +32,13 @@ public function testItHandleBaseCommandParts(): void $this->assertEquals($cmd, str_replace("\r", '', $task->getCommandline()->describeCommand())); } - /** - * @expectedException BuildException - */ public function testItFailsWhenExecutableNotSet(): void { $task = new PHPStanTask(); $task->setExecutable(''); + $this->expectException(BuildException::class); + $this->builder->build($task); } diff --git a/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php b/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php index 935c2c2db4..89a8d9809e 100644 --- a/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php +++ b/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php @@ -22,22 +22,21 @@ public function tearDown(): void $this->sassCleanUp(self::SASS_TEST_BASE, 'test.css'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Neither sass nor scssphp are to be used. - */ public function testNothing(): void { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Neither sass nor scssphp are to be used.'); + $this->executeTarget("nothing"); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Neither sass nor scssphp are to be used. - */ public function testSetStyleToUnrecognised(): void { $this->executeTarget("testSettingUnrecognisedStyle"); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Neither sass nor scssphp are to be used.'); + $this->assertInLogs('Style compacted ignored', Project::MSG_INFO); } diff --git a/test/classes/phing/tasks/ext/SassTask/Integration/SassCompilerTest.php b/test/classes/phing/tasks/ext/SassTask/Integration/SassCompilerTest.php index aca4bb098d..4d2d526ea2 100644 --- a/test/classes/phing/tasks/ext/SassTask/Integration/SassCompilerTest.php +++ b/test/classes/phing/tasks/ext/SassTask/Integration/SassCompilerTest.php @@ -52,9 +52,6 @@ public function testItNotProducesAnyCompiledOutputWhenNoInput(): void $this->assertFileNotExists(self::SASS_TEST_BASE . 'test.css'); } - /** - * @expectedException BuildException - */ public function testItThrowsExceptionWhenFailOnErrorIsSet(): void { $this->compiler->compile( @@ -63,6 +60,8 @@ public function testItThrowsExceptionWhenFailOnErrorIsSet(): void true ); + $this->expectException(BuildException::class); + $this->assertFileNotExists(self::SASS_TEST_BASE . 'test.css'); } } diff --git a/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php b/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php index 1e10752cd6..e15bd480e9 100644 --- a/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php +++ b/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php @@ -52,9 +52,6 @@ public function testItNotProducesAnyCompiledOutputWhenNoInput(): void $this->assertFileNotExists(self::SASS_TEST_BASE . 'test.css'); } - /** - * @expectedException BuildException - */ public function testItThrowsExceptionWhenFailOnErrorIsSet(): void { $this->compiler->compile( @@ -63,6 +60,8 @@ public function testItThrowsExceptionWhenFailOnErrorIsSet(): void true ); + $this->expectException(BuildException::class); + $this->assertFileNotExists(self::SASS_TEST_BASE . 'test.css'); } } diff --git a/test/classes/phing/tasks/ext/SassTask/Unit/SassTaskCompilerFactoryTest.php b/test/classes/phing/tasks/ext/SassTask/Unit/SassTaskCompilerFactoryTest.php index 915e8c53d7..6839cbfa15 100644 --- a/test/classes/phing/tasks/ext/SassTask/Unit/SassTaskCompilerFactoryTest.php +++ b/test/classes/phing/tasks/ext/SassTask/Unit/SassTaskCompilerFactoryTest.php @@ -7,10 +7,6 @@ class SassTaskCompilerFactoryTest extends TestCase { - /** - * @expectedException BuildException - * @expectedExceptionMessage Neither sass nor scssphp are to be used. - */ public function testItFailsWhenNoCompilerIsSet(): void { $sassTask = new SassTask(); @@ -19,6 +15,9 @@ public function testItFailsWhenNoCompilerIsSet(): void $fileSystem = new FileSystemWhichStub(true); $factory = new SassTaskCompilerFactory($fileSystem); + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Neither sass nor scssphp are to be used.'); + $factory->prepareCompiler($sassTask); } @@ -48,10 +47,6 @@ public function testItPrefersSassCompiler(): void $this->assertInstanceOf(SassCompiler::class, $compiler); } - /** - * @expectedException BuildException - * @expectedExceptionMessage sass not found. Install sass. - */ public function testItFailsWhenSassExecutableNotFound(): void { $sassTask = new SassTask(); @@ -61,6 +56,9 @@ public function testItFailsWhenSassExecutableNotFound(): void $fileSystem = new FileSystemWhichStub(false); $factory = new SassTaskCompilerFactory($fileSystem); + $this->expectException(BuildException::class); + $this->expectExceptionMessage('sass not found. Install sass.'); + $factory->prepareCompiler($sassTask); } } diff --git a/test/classes/phing/tasks/ext/inifile/IniFileTaskTest.php b/test/classes/phing/tasks/ext/inifile/IniFileTaskTest.php index 8a7d90b7a8..cb16d97a77 100644 --- a/test/classes/phing/tasks/ext/inifile/IniFileTaskTest.php +++ b/test/classes/phing/tasks/ext/inifile/IniFileTaskTest.php @@ -15,39 +15,33 @@ public function tearDown(): void $this->executeTarget("clean"); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Neither source nor dest is set - */ public function testNoSourceOrDestSet() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Neither source nor dest is set'); + $this->executeTarget('noSourceOrDestSet'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage doesnotexist.ini does not exist - */ public function testNonexistingSourceOnly() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('doesnotexist.ini does not exist'); + $this->executeTarget('nonexistingSourceOnly'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage doesnotexist.ini does not exist - */ public function testNonexistingDestOnly() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('doesnotexist.ini does not exist'); $this->executeTarget('nonexistingDestOnly'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage sourcedoesnotexist.ini does not exist - */ public function testNonexistingDestAndSource() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('sourcedoesnotexist.ini does not exist'); $this->executeTarget('nonexistingDestAndSource'); } diff --git a/test/classes/phing/tasks/ext/rST/RSTTaskMultipleMappersTest.php b/test/classes/phing/tasks/ext/rST/RSTTaskMultipleMappersTest.php index d0cc393a54..ff23cead08 100644 --- a/test/classes/phing/tasks/ext/rST/RSTTaskMultipleMappersTest.php +++ b/test/classes/phing/tasks/ext/rST/RSTTaskMultipleMappersTest.php @@ -30,16 +30,15 @@ */ class RSTTaskMultipleMappersTest extends BuildFileTest { - /** - * @expectedException BuildException - * @expectedExceptionMessage Cannot define more than one mapper - */ public function testMultipleMappers() { $this->configureProject( PHING_TEST_BASE . '/etc/tasks/ext/rst/build-error-multiple-mappers.xml' ); + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Cannot define more than one mapper'); + $this->executeTarget(__FUNCTION__); } } diff --git a/test/classes/phing/tasks/ext/rST/RSTTaskTest.php b/test/classes/phing/tasks/ext/rST/RSTTaskTest.php index 439557f06f..2dee0fa94f 100644 --- a/test/classes/phing/tasks/ext/rST/RSTTaskTest.php +++ b/test/classes/phing/tasks/ext/rST/RSTTaskTest.php @@ -72,11 +72,6 @@ protected function assertFileCreated($file) unlink(PHING_TEST_BASE . '/etc/tasks/ext/rst/' . $file); } - - /** - * @expectedException BuildException - * @expectedExceptionMessage "rst2doesnotexist" not found. Install python-docutils. - */ public function testGetToolPathFail() { if (method_exists('ReflectionMethod', 'setAccessible')) { @@ -84,6 +79,10 @@ public function testGetToolPathFail() $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.'); @@ -107,24 +106,23 @@ public function testGetToolPathCustom() } } - - /** - * @expectedException BuildException - * @expectedExceptionMessage Tool does not exist. Path: - */ public function testSetToolpathNotExisting() { $rt = new RSTTask(); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Tool does not exist. Path:'); + $rt->setToolpath('doesnotandwillneverexist'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Tool not executable. Path: - */ public function testSetToolpathNonExecutable() { $rt = new RSTTask(); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Tool not executable. Path:'); + $rt->setToolpath(__FILE__); } @@ -274,12 +272,11 @@ public function testMultipleMapper() $this->assertFileCreated('files/two.my.html'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage No filename mapper found for "./files/single.rst" - */ public function testNotMatchingMapper() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('No filename mapper found for "./files/single.rst"'); + $this->executeTarget(__FUNCTION__); } diff --git a/test/classes/phing/tasks/ext/sonar/SonarConfigurationFileParserTest.php b/test/classes/phing/tasks/ext/sonar/SonarConfigurationFileParserTest.php index cb0eae04ce..571439245a 100644 --- a/test/classes/phing/tasks/ext/sonar/SonarConfigurationFileParserTest.php +++ b/test/classes/phing/tasks/ext/sonar/SonarConfigurationFileParserTest.php @@ -38,35 +38,31 @@ private function initParser($fileName) return $parser; } - /** - * @expectedException BuildException - */ public function test_construct_fileIsNull_throwsException() { $file = null; + $this->expectException(BuildException::class); + new SonarConfigurationFileParser($file, $this->getProject()); } - /** - * @expectedException BuildException - */ public function test_construct_fileIsEmpty_throwsException() { $file = ''; + $this->expectException(BuildException::class); + new SonarConfigurationFileParser($file, $this->getProject()); } - - /** - * @expectedException BuildException - */ public function test_construct_fileDoesNotExist_throwsException() { $file = 'ThisFileDoesNotExist'; $parser = new SonarConfigurationFileParser($file, $this->getProject()); + $this->expectException(BuildException::class); + $parser->parse(); } diff --git a/test/classes/phing/tasks/system/AppendTaskTest.php b/test/classes/phing/tasks/system/AppendTaskTest.php index 8ed3229b35..93f5ae6e2f 100644 --- a/test/classes/phing/tasks/system/AppendTaskTest.php +++ b/test/classes/phing/tasks/system/AppendTaskTest.php @@ -40,19 +40,17 @@ public function tearDown(): void $this->getProject()->executeTarget('cleanup'); } - /** - * @expectedException BuildException - */ public function test1() { + $this->expectException(BuildException::class); + $this->getProject()->executeTarget(__FUNCTION__); } - /** - * @expectedException BuildException - */ public function test2() { + $this->expectException(BuildException::class); + $this->getProject()->executeTarget(__FUNCTION__); } @@ -135,10 +133,11 @@ public function testfileheader() /** * Expect an exception when attempting to cat an file to itself - * @expectedException BuildException */ public function testsame() { + $this->expectException(BuildException::class); + $this->executeTarget("samefile"); } diff --git a/test/classes/phing/tasks/system/BlockForTaskTest.php b/test/classes/phing/tasks/system/BlockForTaskTest.php index 44f2cb48e8..0bced7438d 100644 --- a/test/classes/phing/tasks/system/BlockForTaskTest.php +++ b/test/classes/phing/tasks/system/BlockForTaskTest.php @@ -39,11 +39,10 @@ public function testConditionMet() $this->assertInLogs('blockfor: condition was met'); } - /** - * @expectedException BuildTimeoutException - */ public function testTimeout() { + $this->expectException(BuildTimeoutException::class); + $this->executeTarget(__FUNCTION__); } } diff --git a/test/classes/phing/tasks/system/ExecTaskTest.php b/test/classes/phing/tasks/system/ExecTaskTest.php index 7016398b38..ec8a381f15 100644 --- a/test/classes/phing/tasks/system/ExecTaskTest.php +++ b/test/classes/phing/tasks/system/ExecTaskTest.php @@ -196,12 +196,11 @@ public function testPropertySetLevelDebug() $this->assertAttributeIsSetTo('levelDebug', Project::MSG_DEBUG, 'logLevel'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Unknown log level "unknown" - */ public function testPropertySetLevelUnknown() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Unknown log level "unknown"'); + $this->getConfiguredTask('testPropertySetLevelUnknown', 'ExecTask'); } @@ -234,15 +233,20 @@ public function testExecuteOnCorrectOsFamily() public function testFailOnNonExistingDir() { - try { - $this->executeTarget(__FUNCTION__); - $this->fail('Expected BuildException was not thrown'); - } catch (BuildException $e) { - $this->assertContains( - str_replace('/', DIRECTORY_SEPARATOR, "'/this/dir/does/not/exist' does not exist"), - $e->getMessage() - ); - } + $this->expectException(BuildException::class); + $this->expectExceptionMessageRegExp('/' . preg_quote(str_replace('/', DIRECTORY_SEPARATOR, "'/this/dir/does/not/exist' does not exist"), '/') . '/'); + +// try { +// $this->executeTarget(__FUNCTION__); +// $this->fail('Expected BuildException was not thrown'); +// } catch (BuildException $e) { +// $this->assertContains( +// str_replace('/', DIRECTORY_SEPARATOR, "'/this/dir/does/not/exist' does not exist"), +// $e->getMessage() +// ); +// } + + $this->executeTarget(__FUNCTION__); } public function testChangeToDir() @@ -263,15 +267,15 @@ public function testCheckreturnTrue() $this->assertTrue(true); } - /** - * @expectedException BuildException - * @expectedExceptionMessage exec returned: 1 - */ public function testCheckreturnFalse() { if (FileSystem::getFileSystem()->which('false') === false) { $this->markTestSkipped("'false' not found."); } + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('exec returned: 1'); + $this->executeTarget(__FUNCTION__); } @@ -341,12 +345,11 @@ public function testNestedArg() $this->assertInLogs($this->windows ? 'nested-arg "b ar"' : 'nested-arg b ar'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage ExecTask: Please provide "executable" - */ public function testMissingExecutableAndCommand() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('ExecTask: Please provide "executable"'); + $this->executeTarget(__FUNCTION__); } diff --git a/test/classes/phing/tasks/system/ForeachTaskTest.php b/test/classes/phing/tasks/system/ForeachTaskTest.php index 6d50dbe3e9..4e7e94e381 100644 --- a/test/classes/phing/tasks/system/ForeachTaskTest.php +++ b/test/classes/phing/tasks/system/ForeachTaskTest.php @@ -40,33 +40,36 @@ public function setUp(): void /** * Test for required attributes * - * @expectedException BuildException * @return void */ public function testRequiredParameters() { + $this->expectException(BuildException::class); + $this->executeTarget(__FUNCTION__); } /** * Test list of values to process without the 'param' attribute * - * @expectedException BuildException * @return void */ public function testListWithoutParam() { + $this->expectException(BuildException::class); + $this->executeTarget(__FUNCTION__); } /** * Test list of values to process without the 'target' attribute * - * @expectedException BuildException * @return void */ public function testListWithoutCalleeTarget() { + $this->expectException(BuildException::class); + $this->executeTarget(__FUNCTION__); } diff --git a/test/classes/phing/tasks/system/RelentlessTest.php b/test/classes/phing/tasks/system/RelentlessTest.php index b9959c3fa4..c3c482e218 100644 --- a/test/classes/phing/tasks/system/RelentlessTest.php +++ b/test/classes/phing/tasks/system/RelentlessTest.php @@ -28,13 +28,13 @@ public function testTerse() $this->assertNotInLogs('Executing: task 3'); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Relentless execution: 1 of 5 tasks failed. - */ public function testFailure() { $this->executeTarget(__FUNCTION__); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Relentless execution: 1 of 5 tasks failed.'); + $this->assertInLogs('Task task 3 failed: baz'); } } diff --git a/test/classes/phing/tasks/system/RetryTest.php b/test/classes/phing/tasks/system/RetryTest.php index b677c0e4ea..d9d42c7eb7 100644 --- a/test/classes/phing/tasks/system/RetryTest.php +++ b/test/classes/phing/tasks/system/RetryTest.php @@ -32,12 +32,11 @@ public function setUp(): void ); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Task [fail] failed after [3] attempts; giving up - */ public function testRetry() { + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Task [fail] failed after [3] attempts; giving up'); + $this->expectLogContaining(__FUNCTION__, 'This task failed.'); } } diff --git a/test/classes/phing/tasks/system/TouchTaskTest.php b/test/classes/phing/tasks/system/TouchTaskTest.php index 6d6174b0ba..cdc9f4e2e1 100644 --- a/test/classes/phing/tasks/system/TouchTaskTest.php +++ b/test/classes/phing/tasks/system/TouchTaskTest.php @@ -58,12 +58,12 @@ public function testMkdirs() ); } - /** - * @expectedException BuildException - */ public function testMkdirsFails() { $this->executeTarget(__FUNCTION__); + + $this->expectException(BuildException::class); + $this->assertFileNotExists( PHING_TEST_BASE . "/etc/tasks/system/tmp/this/is/a/test/file" diff --git a/test/classes/phing/tasks/system/TruncateTaskTest.php b/test/classes/phing/tasks/system/TruncateTaskTest.php index 15bdd5ec8c..ef57be0055 100644 --- a/test/classes/phing/tasks/system/TruncateTaskTest.php +++ b/test/classes/phing/tasks/system/TruncateTaskTest.php @@ -79,27 +79,24 @@ public function testMkdirs() $this->assertSame($this->getProject()->getProperty('test.mkdirs.length'), 0); } - /** - * @expectedException BuildException - */ public function testInvalidAttrs() { + $this->expectException(BuildException::class); + $this->executeTarget(__FUNCTION__); } - /** - * @expectedException BuildException - */ public function testBadLength() { + $this->expectException(BuildException::class); + $this->executeTarget(__FUNCTION__); } - /** - * @expectedException BuildException - */ public function testNoFiles() { + $this->expectException(BuildException::class); + $this->executeTarget(__FUNCTION__); } } diff --git a/test/classes/phing/types/CommandlineTest.php b/test/classes/phing/types/CommandlineTest.php index f8906f5b5a..73204c6435 100644 --- a/test/classes/phing/types/CommandlineTest.php +++ b/test/classes/phing/types/CommandlineTest.php @@ -61,14 +61,20 @@ public function testTranslateCommandline() // now try unbalanced quotes -- this should fail $cmd4 = "cvs -d:pserver:hans@xmpl.org:/cvs commit -m \"added a new test file for 'fun' Test.php"; - try { - $c4 = new Commandline($cmd4); - $this->fail("Should throw BuildException because 'unbalanced quotes'"); - } catch (BuildException $be) { - if (false === strpos($be->getMessage(), "unbalanced quotes")) { - $this->fail("Should throw BuildException because 'unbalanced quotes'"); - } - } + + $this->expectException(BuildException::class); + $this->expectExceptionMessageRegExp('/unbalanced quotes/'); + +// try { +// new Commandline($cmd4); +// $this->fail("Should throw BuildException because 'unbalanced quotes'"); +// } catch (BuildException $be) { +// if (false === strpos($be->getMessage(), "unbalanced quotes")) { +// $this->fail("Should throw BuildException because 'unbalanced quotes'"); +// } +// } + + new Commandline($cmd4); } public function testCreateMarkerWithArgument() diff --git a/test/classes/phing/types/DataTypeTest.php b/test/classes/phing/types/DataTypeTest.php index 7ff3950233..438b880451 100644 --- a/test/classes/phing/types/DataTypeTest.php +++ b/test/classes/phing/types/DataTypeTest.php @@ -33,38 +33,35 @@ protected function setUp(): void /** * testTooManyAttributes - * - * @expectedException BuildException - * @expectedExceptionMessage You must not specify more than one attribute when using refid */ public function testTooManyAttributes() { $ex = $this->datatype->tooManyAttributes(); - throw $ex; + + $this->assertInstanceOf(BuildException::class, $ex); + $this->assertSame('You must not specify more than one attribute when using refid', $ex->getMessage()); } /** * testNoChildrenAllowedException - * - * @expectedException BuildException - * @expectedExceptionMessage You must not specify nested elements when using refid */ public function testNoChildrenAllowedException() { $ex = $this->datatype->noChildrenAllowed(); - throw $ex; + + $this->assertInstanceOf(BuildException::class, $ex); + $this->assertSame('You must not specify nested elements when using refid', $ex->getMessage()); } /** * testCircularReferenceException - * - * @expectedException BuildException - * @expectedExceptionMessage This data type contains a circular reference. */ public function testCircularReferenceException() { $ex = $this->datatype->circularReference(); - throw $ex; + + $this->assertInstanceOf(BuildException::class, $ex); + $this->assertSame('This data type contains a circular reference.', $ex->getMessage()); } public function testToString() diff --git a/test/classes/phing/types/EnvironmentTest.php b/test/classes/phing/types/EnvironmentTest.php index 6be3406376..7669d28640 100644 --- a/test/classes/phing/types/EnvironmentTest.php +++ b/test/classes/phing/types/EnvironmentTest.php @@ -21,13 +21,13 @@ public function testVariablesObjectIsArrayObject() $this->assertEquals("ArrayObject", get_class($variablesObj)); } - /** - * @expectedException BuildException - * @expectedExceptionMessage key and value must be specified for environment variables. - */ public function testValidateWithoutKeyAndValueSetRaisesException() { $ev = new EnvVariable(); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('key and value must be specified for environment variables.'); + $ev->validate(); } diff --git a/test/classes/phing/types/PatternSetTest.php b/test/classes/phing/types/PatternSetTest.php index a7af6adf13..06deeb7fe3 100644 --- a/test/classes/phing/types/PatternSetTest.php +++ b/test/classes/phing/types/PatternSetTest.php @@ -15,51 +15,51 @@ public function testBothEmpty() $this->assertEquals(false, $this->patternset->hasPatterns()); } - /** - * @expectedException BuildException - * @expectedExceptionMessage You must not specify nested elements when using refid - */ public function testIfReferenceSetThenCreateIncludeThrowsException() { $project = new Project(); $reference = new Reference($project); $this->patternset->setRefId($reference); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('You must not specify nested elements when using refid'); + $this->patternset->createInclude(); } - /** - * @expectedException BuildException - * @expectedExceptionMessage You must not specify nested elements when using refid - */ public function testIfReferenceSetThenCreateExcludeThrowsException() { $project = new Project(); $reference = new Reference($project); $this->patternset->setRefId($reference); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('You must not specify nested elements when using refid'); + $this->patternset->createExclude(); } - /** - * @expectedException BuildException - * @expectedExceptionMessage You must not specify nested elements when using refid - */ public function testIfReferencesSetThenCreatExcludesFileThrowsException() { $project = new Project(); $reference = new Reference($project); $this->patternset->setRefId($reference); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('You must not specify nested elements when using refid'); + $this->patternset->createExcludesFile(); } - /** - * @expectedException BuildException - * @expectedExceptionMessage You must not specify nested elements when using refid - */ public function testIfReferencesSetThenCreatIncludesFileThrowsException() { $project = new Project(); $reference = new Reference($project); $this->patternset->setRefId($reference); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('You must not specify nested elements when using refid'); + $this->patternset->createIncludesFile(); } diff --git a/test/classes/phing/types/PearPackageFileSetTest.php b/test/classes/phing/types/PearPackageFileSetTest.php index ed463b1b2f..e0b59dfe4d 100644 --- a/test/classes/phing/types/PearPackageFileSetTest.php +++ b/test/classes/phing/types/PearPackageFileSetTest.php @@ -118,13 +118,13 @@ public function testGetDirWithoutScanner() ); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Invalid package name - */ public function testSetPackageInvalid() { $ppfs = new PearPackageFileSet(); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Invalid package name'); + $ppfs->setPackage('pear.php.net/console_getopt/thisiswrong'); } } diff --git a/test/classes/phing/types/ReferenceTest.php b/test/classes/phing/types/ReferenceTest.php index efdd3a3eaf..382075ec12 100644 --- a/test/classes/phing/types/ReferenceTest.php +++ b/test/classes/phing/types/ReferenceTest.php @@ -20,25 +20,25 @@ public function testGetProject() $this->assertEquals($retrieved->getDescription(), $description); } - /** - * @expectedException BuildException - * @expectedExceptionMessage Reference refOne not found. - */ public function testGetReferencedObjectThrowsExceptionIfReferenceNotSet() { $project = new Project(); $reference = new Reference($project, "refOne"); - $referenced = $reference->getReferencedObject(null); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('Reference refOne not found.'); + + $reference->getReferencedObject(null); } - /** - * @expectedException BuildException - * @expectedExceptionMessage No reference specified - */ public function testGetReferencedObjectThrowsExceptionIfNoReferenceIsGiven() { $project = new Project(); $reference = new Reference($project); - $referenced = $reference->getReferencedObject(null); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('No reference specified'); + + $reference->getReferencedObject(null); } } diff --git a/test/classes/phing/util/DirectoryScannerTest.php b/test/classes/phing/util/DirectoryScannerTest.php index f1965f2e3f..ea445964b5 100644 --- a/test/classes/phing/util/DirectoryScannerTest.php +++ b/test/classes/phing/util/DirectoryScannerTest.php @@ -45,15 +45,15 @@ public function tearDown(): void $this->executeTarget("cleanup"); } - /** - * @expectedException BuildException - * @expectedExceptionMessageRegExp /basedir (.*)THIS_DOES_NOT_EXIST does not exist\./ - */ public function testErrorOnMissingDir() { $ds = new DirectoryScanner(); $ds->setBasedir($this->_basedir . '/THIS_DOES_NOT_EXIST'); $ds->setErrorOnMissingDir(true); + + $this->expectException(BuildException::class); + $this->expectExceptionMessageRegExp('/basedir (.*)THIS_DOES_NOT_EXIST does not exist\./'); + $ds->scan(); } diff --git a/test/classes/phing/util/PearPackageScannerTest.php b/test/classes/phing/util/PearPackageScannerTest.php index 23c5395988..a9e8213925 100644 --- a/test/classes/phing/util/PearPackageScannerTest.php +++ b/test/classes/phing/util/PearPackageScannerTest.php @@ -58,10 +58,6 @@ public function testLoadPackageInfo() $this->assertInstanceOf('PEAR_PackageFile_v2', $packageInfo); } - /** - * @expectedException BuildException - * @expectedExceptionMessage PEAR package pear.php.net/this_package_does_not_exist does not exist - */ public function testLoadPackageInfoNonexistingPackage() { $ppfs = new PearPackageScanner(); @@ -70,15 +66,19 @@ public function testLoadPackageInfoNonexistingPackage() $ref = new ReflectionClass($ppfs); $method = $ref->getMethod('loadPackageInfo'); $method->setAccessible(true); - $packageInfo = $method->invoke($ppfs); + + $this->expectException(BuildException::class); + $this->expectExceptionMessage('PEAR package pear.php.net/this_package_does_not_exist does not exist'); + + $method->invoke($ppfs); } - /** - * @expectedException BuildException - */ public function testSetRoleEmpty() { $ppfs = new PearPackageScanner(); + + $this->expectException(BuildException::class); + $ppfs->setRole(null); } @@ -102,12 +102,12 @@ public function testScanRoleDocCorrectDirectory() } } - /** - * @expectedException BuildException - */ public function testSetConfigNonexistingFile() { $ppfs = new PearPackageScanner(); + + $this->expectException(BuildException::class); + $ppfs->setConfig('/this/file/does/not/really/exist'); } @@ -131,12 +131,12 @@ public function testScan() $this->markTestIncomplete(); } - /** - * @expectedException BuildException - */ public function testSetDescFileNonexistingFile() { $ppfs = new PearPackageScanner(); + + $this->expectException(BuildException::class); + $ppfs->setDescFile('/this/file/does/not/exist'); } From 96e81f661914923f850480aea4b7e292ea98b3d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 10 Nov 2019 23:47:32 +0100 Subject: [PATCH 2/2] update tests --- .../tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php | 4 ++-- .../tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php | 4 ++-- test/classes/phing/tasks/system/RelentlessTest.php | 4 ++-- test/classes/phing/tasks/system/TouchTaskTest.php | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php b/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php index 89a8d9809e..96efaf8851 100644 --- a/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php +++ b/test/classes/phing/tasks/ext/SassTask/Acceptance/SassTaskAcceptanceTest.php @@ -32,11 +32,11 @@ public function testNothing(): void public function testSetStyleToUnrecognised(): void { - $this->executeTarget("testSettingUnrecognisedStyle"); - $this->expectException(BuildException::class); $this->expectExceptionMessage('Neither sass nor scssphp are to be used.'); + $this->executeTarget("testSettingUnrecognisedStyle"); + $this->assertInLogs('Style compacted ignored', Project::MSG_INFO); } diff --git a/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php b/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php index e15bd480e9..f9c2ef4a23 100644 --- a/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php +++ b/test/classes/phing/tasks/ext/SassTask/Integration/ScssPhpCompilerTest.php @@ -54,14 +54,14 @@ public function testItNotProducesAnyCompiledOutputWhenNoInput(): void public function testItThrowsExceptionWhenFailOnErrorIsSet(): void { + $this->expectException(BuildException::class); + $this->compiler->compile( self::SASS_TEST_BASE . 'non-existing.sass', self::SASS_TEST_BASE . 'test.css', true ); - $this->expectException(BuildException::class); - $this->assertFileNotExists(self::SASS_TEST_BASE . 'test.css'); } } diff --git a/test/classes/phing/tasks/system/RelentlessTest.php b/test/classes/phing/tasks/system/RelentlessTest.php index c3c482e218..b81155f7ae 100644 --- a/test/classes/phing/tasks/system/RelentlessTest.php +++ b/test/classes/phing/tasks/system/RelentlessTest.php @@ -30,11 +30,11 @@ public function testTerse() public function testFailure() { - $this->executeTarget(__FUNCTION__); - $this->expectException(BuildException::class); $this->expectExceptionMessage('Relentless execution: 1 of 5 tasks failed.'); + $this->executeTarget(__FUNCTION__); + $this->assertInLogs('Task task 3 failed: baz'); } } diff --git a/test/classes/phing/tasks/system/TouchTaskTest.php b/test/classes/phing/tasks/system/TouchTaskTest.php index cdc9f4e2e1..0e4ce491d4 100644 --- a/test/classes/phing/tasks/system/TouchTaskTest.php +++ b/test/classes/phing/tasks/system/TouchTaskTest.php @@ -60,9 +60,10 @@ public function testMkdirs() public function testMkdirsFails() { - $this->executeTarget(__FUNCTION__); - $this->expectException(BuildException::class); + $this->expectExceptionMessage('Error touch()ing file'); + + $this->executeTarget(__FUNCTION__); $this->assertFileNotExists( PHING_TEST_BASE