forked from jolicode/castor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(fingerprint): Scope fingerprints to project by default
- Loading branch information
Showing
11 changed files
with
101 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
tests/Examples/Fingerprint/FingerprintTaskWithAFingerprintTest.php.output_runnable.txt
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
tests/Examples/Fingerprint/FingerprintTaskWithAGlobalFingerprintTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
namespace Castor\Tests\Examples\Fingerprint; | ||
|
||
class FingerprintTaskWithAGlobalFingerprintTest extends FingerprintedTestCase | ||
{ | ||
// fingerprint:task-with-a-fingerprint-global | ||
public function test(): void | ||
{ | ||
// Run for the first time, should run | ||
$this->runProcessAndExpect(__FILE__ . '.output_runnable.txt'); | ||
|
||
// should not run because the fingerprint is the same | ||
$this->runProcessAndExpect(__FILE__ . '.output_not_runnable.txt'); | ||
|
||
// change file content, should run | ||
$this->runProcessAndExpect(__FILE__ . '.output_runnable.txt', 'Hello World'); | ||
} | ||
|
||
private function runProcessAndExpect(string $expectedOutputFilePath, string $withFileContent = 'Hello'): void | ||
{ | ||
$filepath = \dirname(__DIR__, 3) . '/examples/fingerprint_file.fingerprint_single'; | ||
if (file_exists($filepath)) { | ||
unlink($filepath); | ||
} | ||
|
||
file_put_contents($filepath, $withFileContent); | ||
|
||
$process = $this->runTask(['fingerprint:task-with-a-fingerprint-global']); | ||
|
||
if (file_exists($expectedOutputFilePath)) { | ||
$this->assertStringEqualsFile($expectedOutputFilePath, $process->getOutput()); | ||
} | ||
|
||
$this->assertSame(0, $process->getExitCode()); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
...xamples/Fingerprint/FingerprintTaskWithAGlobalFingerprintTest.php.output_not_runnable.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Hello Task with Global Fingerprint! | ||
Cool! I finished global! |
3 changes: 3 additions & 0 deletions
3
tests/Examples/Fingerprint/FingerprintTaskWithAGlobalFingerprintTest.php.output_runnable.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Hello Task with Global Fingerprint! | ||
Cool, no global fingerprint! Executing... | ||
Cool! I finished global! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters