-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #559 from jolicode/feat/default-task
feat(task): allow to define a default task
- Loading branch information
Showing
12 changed files
with
118 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
namespace Castor\Tests\Generated; | ||
|
||
use Castor\Tests\TaskTestCase; | ||
use Symfony\Component\Process\Exception\ProcessFailedException; | ||
|
||
class DefaultTaskConflictTest extends TaskTestCase | ||
{ | ||
// no task | ||
public function test(): void | ||
{ | ||
$process = $this->runTask([], '{{ base }}/tests/fixtures/broken/default-task-conflict', needRemote: true); | ||
|
||
if (1 !== $process->getExitCode()) { | ||
throw new ProcessFailedException($process); | ||
} | ||
|
||
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); | ||
$this->assertStringEqualsFile(__FILE__ . '.err.txt', $process->getErrorOutput()); | ||
} | ||
} |
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,7 @@ | ||
In FunctionLoader.php line XXXX: | ||
|
||
Function "about2()" is not properly configured: | ||
The task is marked as default, but task "about()" was already marked as default. | ||
Defined in "castor.php" line 11. | ||
|
||
|
Empty file.
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,22 @@ | ||
<?php | ||
|
||
namespace Castor\Tests\Generated; | ||
|
||
use Castor\Tests\TaskTestCase; | ||
use Symfony\Component\Process\Exception\ProcessFailedException; | ||
|
||
class DefaultTaskTest extends TaskTestCase | ||
{ | ||
// no task | ||
public function test(): void | ||
{ | ||
$process = $this->runTask([], '{{ base }}/tests/fixtures/valid/default-task'); | ||
|
||
if (0 !== $process->getExitCode()) { | ||
throw new ProcessFailedException($process); | ||
} | ||
|
||
$this->assertStringEqualsFile(__FILE__ . '.output.txt', $process->getOutput()); | ||
$this->assertSame('', $process->getErrorOutput()); | ||
} | ||
} |
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 @@ | ||
about |
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,13 @@ | ||
<?php | ||
|
||
use Castor\Attribute\AsTask; | ||
|
||
#[AsTask(default: true)] | ||
function about(): void | ||
{ | ||
} | ||
|
||
#[AsTask(default: true)] | ||
function about2(): void | ||
{ | ||
} |
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,11 @@ | ||
<?php | ||
|
||
use Castor\Attribute\AsTask; | ||
|
||
use function Castor\io; | ||
|
||
#[AsTask(default: true)] | ||
function about(): void | ||
{ | ||
io()->writeln('about'); | ||
} |