-
-
Notifications
You must be signed in to change notification settings - Fork 5
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 #1656 from hydephp/build-task-skip-feature
Add a skip feature to build tasks
- Loading branch information
Showing
6 changed files
with
134 additions
and
4 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
15 changes: 15 additions & 0 deletions
15
packages/framework/src/Framework/Features/BuildTasks/BuildTaskSkippedException.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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hyde\Framework\Features\BuildTasks; | ||
|
||
use RuntimeException; | ||
|
||
class BuildTaskSkippedException extends RuntimeException | ||
{ | ||
public function __construct(string $message = 'Task was skipped', int $code = 0) | ||
{ | ||
parent::__construct($message, $code); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
packages/framework/tests/Unit/BuildTaskSkippedExceptionTest.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,51 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Hyde\Framework\Testing\Unit; | ||
|
||
use Hyde\Framework\Features\BuildTasks\BuildTaskSkippedException; | ||
use Hyde\Testing\UnitTestCase; | ||
|
||
/** | ||
* @covers \Hyde\Framework\Features\BuildTasks\BuildTaskSkippedException | ||
*/ | ||
class BuildTaskSkippedExceptionTest extends UnitTestCase | ||
{ | ||
public function testItCanBeInstantiated() | ||
{ | ||
$exception = new BuildTaskSkippedException(); | ||
|
||
$this->assertInstanceOf(BuildTaskSkippedException::class, $exception); | ||
} | ||
|
||
public function testItThrowsAnExceptionWithDefaultMessage() | ||
{ | ||
$this->expectException(BuildTaskSkippedException::class); | ||
$this->expectExceptionMessage('Task was skipped'); | ||
|
||
throw new BuildTaskSkippedException(); | ||
} | ||
|
||
public function testItThrowsAnExceptionWithCustomMessage() | ||
{ | ||
$this->expectException(BuildTaskSkippedException::class); | ||
$this->expectExceptionMessage('Custom message'); | ||
|
||
throw new BuildTaskSkippedException('Custom message'); | ||
} | ||
|
||
public function testDefaultExceptionCode() | ||
{ | ||
$exception = new BuildTaskSkippedException(); | ||
|
||
$this->assertSame(0, $exception->getCode()); | ||
} | ||
|
||
public function testCustomExceptionCode() | ||
{ | ||
$exception = new BuildTaskSkippedException('Custom message', 123); | ||
|
||
$this->assertSame(123, $exception->getCode()); | ||
} | ||
} |
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