-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move validation of value in TaskType
- Loading branch information
1 parent
74ed055
commit 646ddc6
Showing
4 changed files
with
39 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PrestaShop\Module\AutoUpgrade\Task\TaskType; | ||
|
||
class TaskTypeTest extends TestCase | ||
{ | ||
public function testFromStringReturnsValidTaskType() | ||
{ | ||
$this->assertSame(TaskType::TASK_TYPE_BACKUP, TaskType::fromString('backup')); | ||
$this->assertSame(TaskType::TASK_TYPE_UPDATE, TaskType::fromString('update')); | ||
$this->assertSame(TaskType::TASK_TYPE_RESTORE, TaskType::fromString('restore')); | ||
} | ||
|
||
public function testFromStringThrowsExceptionForInvalidTaskType() | ||
{ | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('Unknown log type invalid_task'); | ||
|
||
TaskType::fromString('invalid_task'); | ||
} | ||
} |