Skip to content

Commit

Permalink
rename targets to kebab-case
Browse files Browse the repository at this point in the history
  • Loading branch information
petrduda committed Apr 5, 2023
1 parent 8c554d7 commit 82916b4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
34 changes: 17 additions & 17 deletions tests/CopyFilesTaskIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class CopyFilesTaskIntegrationTest extends \PHPUnit\Framework\TestCase
public function copyFileDataProvider(): Generator
{
yield 'copy file' => [
'target' => 'testCopyFile',
'target' => 'copy-file',
'sourceFileName' => '/foo',
'targetFileName' => '/foo-copy',
'existingSourceFileContents' => 'FOO',
Expand All @@ -31,7 +31,7 @@ public function copyFileDataProvider(): Generator
];

yield 'copy file with absolute path' => [
'target' => 'testCopyFileWithAbsolutePath',
'target' => 'copy-file-with-absolute-path',
'sourceFileName' => '/foo',
'targetFileName' => '/foo-copy',
'existingSourceFileContents' => 'FOO',
Expand All @@ -42,7 +42,7 @@ public function copyFileDataProvider(): Generator
];

yield 'target file exists' => [
'target' => 'testTargetFileExists',
'target' => 'target-file-exists',
'sourceFileName' => '/new',
'targetFileName' => '/existing',
'existingSourceFileContents' => 'NEW',
Expand All @@ -53,7 +53,7 @@ public function copyFileDataProvider(): Generator
];

yield 'target file exists skip' => [
'target' => 'testTargetFileExistsSkip',
'target' => 'target-file-exists-skip',
'sourceFileName' => '/new',
'targetFileName' => '/existing',
'existingSourceFileContents' => 'NEW',
Expand All @@ -64,7 +64,7 @@ public function copyFileDataProvider(): Generator
];

yield 'target file exists replace' => [
'target' => 'testTargetFileExistsReplace',
'target' => 'target-file-exists-replace',
'sourceFileName' => '/new',
'targetFileName' => '/existing',
'existingSourceFileContents' => 'NEW',
Expand Down Expand Up @@ -126,7 +126,7 @@ public function testTargetFileExistsFail(): void
file_put_contents($targetFilePath, 'EXISTING');

$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml', self::TEMP_DIRECTORY_PATH);
$target = __FUNCTION__;
$target = 'target-file-exists-fail';

$tester->expectFailedBuild($target);

Expand All @@ -151,7 +151,7 @@ public function testCopyMultipleFiles(): void
}

$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml', self::TEMP_DIRECTORY_PATH);
$target = __FUNCTION__;
$target = 'copy-multiple-files';
$tester->executeTarget($target);

Assert::assertFileEquals($sourceFooFilePath, $targetFooFilePath);
Expand All @@ -173,7 +173,7 @@ public function testReplaceMultipleFilesWithExistingTargets(): void
file_put_contents($targetBarFilePath, 'BAR-EXISTING');

$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml', self::TEMP_DIRECTORY_PATH);
$target = __FUNCTION__;
$target = 'replace-multiple-files-with-existing-targets';
$tester->executeTarget($target);

Assert::assertFileEquals($sourceFooFilePath, $targetFooFilePath);
Expand Down Expand Up @@ -203,7 +203,7 @@ public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModes(): v
file_put_contents($targetDefaultFilePath, 'DEFAULT-EXISTING');

$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml', self::TEMP_DIRECTORY_PATH);
$target = __FUNCTION__;
$target = 'copy-multiple-files-with-existing-targets-using-different-modes';
$tester->executeTarget($target);

Assert::assertFileExists($targetSkipFilePath);
Expand Down Expand Up @@ -235,7 +235,7 @@ public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModesWithR
file_put_contents($targetDefaultFilePath, 'DEFAULT-EXISTING');

$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml', self::TEMP_DIRECTORY_PATH);
$target = __FUNCTION__;
$target = 'copy-multiple-files-with-existing-targets-using-different-modes-with-replace-fallback';
$tester->executeTarget($target);

Assert::assertFileExists($targetSkipFilePath);
Expand All @@ -253,7 +253,7 @@ public function testCopyMultipleFilesWithExistingTargetsUsingDifferentModesWithR
public function testCopyNonExistentFile(): void
{
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
$target = __FUNCTION__;
$target = 'copy-non-existent-file';

$tester->expectFailedBuild($target);

Expand All @@ -263,7 +263,7 @@ public function testCopyNonExistentFile(): void
public function testCopyMultipleNonExistentFiles(): void
{
$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml');
$target = __FUNCTION__;
$target = 'copy-multiple-non-existent-files';

$tester->expectFailedBuild($target);

Expand All @@ -281,7 +281,7 @@ public function testCopyFileToNonExistingDirectory(): void
}

$tester = new PhingTester(__DIR__ . '/copy-files-task-integration-test.xml', self::TEMP_DIRECTORY_PATH);
$target = __FUNCTION__;
$target = 'copy-file-to-non-existing-directory';

$tester->expectFailedBuild($target);

Expand All @@ -294,22 +294,22 @@ public function testCopyFileToNonExistingDirectory(): void
public function throwBuildExceptionDataProvider(): Generator
{
yield 'missing copy file element' => [
'target' => 'testMissingCopyFileElement',
'target' => 'missing-copy-file-element',
'expectedMessagePatternRegExp' => '~one.+<file>.+expected~',
];

yield 'missing source' => [
'target' => 'testMissingSource',
'target' => 'missing-source',
'expectedMessagePatternRegExp' => '~<file>.+`source`~',
];

yield 'missing target' => [
'target' => 'testMissingTarget',
'target' => 'missing-target',
'expectedMessagePatternRegExp' => '~<file>.+`target`~',
];

yield 'invalid file exists mode' => [
'target' => 'testInvalidFileExistsMode',
'target' => 'invalid-file-exists-mode',
'expectedMessagePatternRegExp' => '~invalid.+mode~i',
];
}
Expand Down
34 changes: 17 additions & 17 deletions tests/copy-files-task-integration-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,109 +3,109 @@

<taskdef name="copy-files" classname="VasekPurchart\Phing\CopyFiles\CopyFilesTask"/>

<target name="testCopyFile">
<target name="copy-file">
<copy-files>
<file source="foo" target="foo-copy"/>
</copy-files>
</target>

<target name="testCopyFileWithAbsolutePath">
<target name="copy-file-with-absolute-path">
<copy-files>
<file source="${project.basedir}/foo" target="${project.basedir}/foo-copy"/>
</copy-files>
</target>

<target name="testTargetFileExists">
<target name="target-file-exists">
<copy-files>
<file source="new" target="existing"/>
</copy-files>
</target>

<target name="testTargetFileExistsSkip">
<target name="target-file-exists-skip">
<copy-files existsmode="skip">
<file source="new" target="existing"/>
</copy-files>
</target>

<target name="testTargetFileExistsReplace">
<target name="target-file-exists-replace">
<copy-files existsmode="replace">
<file source="new" target="existing"/>
</copy-files>
</target>

<target name="testTargetFileExistsFail">
<target name="target-file-exists-fail">
<copy-files existsmode="fail">
<file source="new" target="existing"/>
</copy-files>
</target>

<target name="testCopyMultipleFiles">
<target name="copy-multiple-files">
<copy-files>
<file source="foo" target="foo-copy"/>
<file source="bar" target="bar-copy"/>
</copy-files>
</target>

<target name="testReplaceMultipleFilesWithExistingTargets">
<target name="replace-multiple-files-with-existing-targets">
<copy-files existsmode="replace">
<file source="foo-new" target="foo-existing"/>
<file source="bar-new" target="bar-existing"/>
</copy-files>
</target>

<target name="testCopyMultipleFilesWithExistingTargetsUsingDifferentModes">
<target name="copy-multiple-files-with-existing-targets-using-different-modes">
<copy-files>
<file source="skip-new" target="skip-existing" existsmode="skip"/>
<file source="replace-new" target="replace-existing" existsmode="replace"/>
<file source="default-new" target="default-existing"/>
</copy-files>
</target>

<target name="testCopyMultipleFilesWithExistingTargetsUsingDifferentModesWithReplaceFallback">
<target name="copy-multiple-files-with-existing-targets-using-different-modes-with-replace-fallback">
<copy-files existsmode="replace">
<file source="skip-new" target="skip-existing" existsmode="skip"/>
<file source="replace-new" target="replace-existing" existsmode="replace"/>
<file source="default-new" target="default-existing"/>
</copy-files>
</target>

<target name="testCopyNonExistentFile">
<target name="copy-non-existent-file">
<copy-files>
<file source="XXX" target="YYY"/>
</copy-files>
</target>

<target name="testCopyMultipleNonExistentFiles">
<target name="copy-multiple-non-existent-files">
<copy-files>
<file source="FOO" target="LOREM"/>
<file source="BAR" target="LOREM"/>
</copy-files>
</target>

<target name="testCopyFileToNonExistingDirectory">
<target name="copy-file-to-non-existing-directory">
<copy-files>
<file source="foo" target="non-existing-directory/foo-copy"/>
</copy-files>
</target>

<target name="testMissingCopyFileElement">
<target name="missing-copy-file-element">
<copy-files>
</copy-files>
</target>

<target name="testMissingSource">
<target name="missing-source">
<copy-files>
<file target="BAR"/>
</copy-files>
</target>

<target name="testMissingTarget">
<target name="missing-target">
<copy-files>
<file source="FOO"/>
</copy-files>
</target>

<target name="testInvalidFileExistsMode">
<target name="invalid-file-exists-mode">
<copy-files existsmode="invalid-mode">
<file source="new" target="existing"/>
</copy-files>
Expand Down

0 comments on commit 82916b4

Please sign in to comment.