From 18a48239a4750a408719f0c9beb339a20e29d074 Mon Sep 17 00:00:00 2001 From: Siad Ardroumli Date: Thu, 14 Nov 2024 13:17:35 +0100 Subject: [PATCH] Improved code coverage (#1869) --- .../Type/Selector/ReadableSelectorTest.php | 52 +++++++++++++++++++ ...WriteTest.php => WritableSelectorTest.php} | 24 +++------ .../types/selectors/ReadableSelectorTest.xml | 49 +++++++++++++++++ ...WriteTest.xml => WritableSelectorTest.xml} | 14 ++--- 4 files changed, 112 insertions(+), 27 deletions(-) create mode 100644 tests/Phing/Test/Type/Selector/ReadableSelectorTest.php rename tests/Phing/Test/Type/Selector/{ReadWriteTest.php => WritableSelectorTest.php} (67%) create mode 100644 tests/etc/types/selectors/ReadableSelectorTest.xml rename tests/etc/types/selectors/{ReadWriteTest.xml => WritableSelectorTest.xml} (89%) diff --git a/tests/Phing/Test/Type/Selector/ReadableSelectorTest.php b/tests/Phing/Test/Type/Selector/ReadableSelectorTest.php new file mode 100644 index 0000000000..d156a0dda5 --- /dev/null +++ b/tests/Phing/Test/Type/Selector/ReadableSelectorTest.php @@ -0,0 +1,52 @@ +. + */ + +namespace Phing\Test\Type\Selector; + +use Phing\Test\Support\BuildFileTest; + +/** + * Class ReadableSelectorTest. + * + * Test cases for isReadable selectors. + * + * @internal + */ +class ReadableSelectorTest extends BuildFileTest +{ + public function setUp(): void + { + $this->configureProject( + PHING_TEST_BASE . '/etc/types/selectors/ReadableSelectorTest.xml' + ); + $this->executeTarget('setup'); + } + + public function tearDown(): void + { + $this->executeTarget('clean'); + } + + public function testReadable(): void + { + $this->executeTarget(__FUNCTION__); + $this->assertPropertySet('selected'); + } +} diff --git a/tests/Phing/Test/Type/Selector/ReadWriteTest.php b/tests/Phing/Test/Type/Selector/WritableSelectorTest.php similarity index 67% rename from tests/Phing/Test/Type/Selector/ReadWriteTest.php rename to tests/Phing/Test/Type/Selector/WritableSelectorTest.php index 24c501e645..e454354e69 100644 --- a/tests/Phing/Test/Type/Selector/ReadWriteTest.php +++ b/tests/Phing/Test/Type/Selector/WritableSelectorTest.php @@ -23,18 +23,18 @@ use Phing\Test\Support\BuildFileTest; /** - * Class ReadWriteTest. + * Class ReadableSelectorTest. * - * Test cases for isReadable/isWritable selectors. + * Test cases for isReadable selectors. * * @internal */ -class ReadWriteTest extends BuildFileTest +class WritableSelectorTest extends BuildFileTest { public function setUp(): void { $this->configureProject( - PHING_TEST_BASE . '/etc/types/selectors/ReadWriteTest.xml' + PHING_TEST_BASE . '/etc/types/selectors/WritableSelectorTest.xml' ); $this->executeTarget('setup'); } @@ -44,22 +44,10 @@ public function tearDown(): void $this->executeTarget('clean'); } - public function testReadable(): void - { - $this->executeTarget(__FUNCTION__); - $project = $this->getProject(); - $output = $project->getProperty('output'); - $file = $project->getProperty('file'); - $this->assertTrue(is_readable(sprintf('%s/%s', $output, $file))); - } - public function testWritable(): void { $this->executeTarget(__FUNCTION__); - $project = $this->getProject(); - $output = $project->getProperty('output'); - $file = $project->getProperty('file'); - $this->assertTrue(is_writable(sprintf('%s/%s', $output, $file))); + $this->assertPropertySet('selected'); } public function testUnwritable(): void @@ -68,6 +56,6 @@ public function testUnwritable(): void $project = $this->getProject(); $output = $project->getProperty('output'); $file = $project->getProperty('file'); - $this->assertFalse(is_writable(sprintf('%s/%s', $output, $file))); + $this->assertIsNotWritable(sprintf('%s/%s', $output, $file)); } } diff --git a/tests/etc/types/selectors/ReadableSelectorTest.xml b/tests/etc/types/selectors/ReadableSelectorTest.xml new file mode 100644 index 0000000000..f41d08d01c --- /dev/null +++ b/tests/etc/types/selectors/ReadableSelectorTest.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/etc/types/selectors/ReadWriteTest.xml b/tests/etc/types/selectors/WritableSelectorTest.xml similarity index 89% rename from tests/etc/types/selectors/ReadWriteTest.xml rename to tests/etc/types/selectors/WritableSelectorTest.xml index c4e4457f65..3565785a82 100644 --- a/tests/etc/types/selectors/ReadWriteTest.xml +++ b/tests/etc/types/selectors/WritableSelectorTest.xml @@ -35,16 +35,12 @@ - - - - - - - - - + + + + +