Added status and source build fields validation.
This commit is contained in:
parent
10d41dba81
commit
d3a390d3f8
5 changed files with 59 additions and 2 deletions
|
|
@ -80,6 +80,9 @@ class BuildTest extends TestCase
|
|||
|
||||
$result = $build->setStatus(Build::STATUS_FAILED);
|
||||
self::assertEquals(false, $result);
|
||||
|
||||
self::expectException('\PHPCensor\Exception\HttpException\ValidationException');
|
||||
$build->setStatus(10);
|
||||
}
|
||||
|
||||
public function testLog()
|
||||
|
|
@ -226,6 +229,9 @@ class BuildTest extends TestCase
|
|||
|
||||
$result = $build->setSource(Build::SOURCE_WEBHOOK_PULL_REQUEST);
|
||||
self::assertEquals(false, $result);
|
||||
|
||||
self::expectException('\PHPCensor\Exception\HttpException\ValidationException');
|
||||
$build->setSource(20);
|
||||
}
|
||||
|
||||
public function testUserId()
|
||||
|
|
|
|||
|
|
@ -137,8 +137,10 @@ class ProjectTest extends TestCase
|
|||
|
||||
$result = $project->setType('git');
|
||||
self::assertEquals(false, $result);
|
||||
}
|
||||
|
||||
self::expectException('\PHPCensor\Exception\HttpException\ValidationException');
|
||||
$project->setType('invalid-type');
|
||||
}
|
||||
|
||||
public function testAccessInformation()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Tests\PHPCensor\Model;
|
||||
|
||||
use PHPCensor\Exception\HttpException\ValidationException;
|
||||
use PHPCensor\Model\Project;
|
||||
use PHPCensor\Model;
|
||||
|
||||
|
|
@ -16,6 +17,15 @@ class ProjectTest extends \PHPUnit\Framework\TestCase
|
|||
{
|
||||
$project = new Project();
|
||||
self::assertTrue($project instanceof Model);
|
||||
|
||||
try {
|
||||
$project->setArchived('true');
|
||||
} catch (ValidationException $e) {
|
||||
self::assertEquals(
|
||||
'Column "archived" must be a boolean.',
|
||||
$e->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function testExecute_TestGitDefaultBranch()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue