forked from php-censor/php-censor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProjectTest.php
More file actions
86 lines (69 loc) · 2.25 KB
/
Copy pathProjectTest.php
File metadata and controls
86 lines (69 loc) · 2.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
namespace Tests\PHPCensor\Model;
use PHPCensor\Exception\InvalidArgumentException;
use PHPCensor\Model\Project;
use PHPCensor\Model;
/**
* Unit tests for the Project model class.
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class ProjectTest extends \PHPUnit\Framework\TestCase
{
public function testExecute_TestIsAValidModel()
{
$project = new Project();
self::assertTrue($project instanceof Model);
try {
$project->setArchived('true');
} catch (InvalidArgumentException $e) {
self::assertEquals(
'Column "archived" must be a boolean.',
$e->getMessage()
);
}
}
public function testExecute_TestGitDefaultBranch()
{
$project = new Project();
$project->setType('git');
self::assertEquals('master', $project->getBranch());
}
public function testExecute_TestGithubDefaultBranch()
{
$project = new Project();
$project->setType(Project::TYPE_GITHUB);
self::assertEquals('master', $project->getBranch());
}
public function testExecute_TestGitlabDefaultBranch()
{
$project = new Project();
$project->setType(Project::TYPE_GITLAB);
self::assertEquals('master', $project->getBranch());
}
public function testExecute_TestBitbucketDefaultBranch()
{
$project = new Project();
$project->setType(Project::TYPE_BITBUCKET);
self::assertEquals('master', $project->getBranch());
}
public function testExecute_TestMercurialDefaultBranch()
{
$project = new Project();
$project->setType(Project::TYPE_HG);
self::assertEquals('default', $project->getBranch());
}
public function testExecute_TestProjectAccessInformation()
{
$info = [
'item1' => 'Item One',
'item2' => 2,
];
$project = new Project();
$project->setAccessInformation($info);
self::assertEquals('Item One', $project->getAccessInformation('item1'));
self::assertEquals(2, $project->getAccessInformation('item2'));
self::assertNull($project->getAccessInformation('item3'));
self::assertEquals($info, $project->getAccessInformation());
}
}