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
52 lines (44 loc) · 1.5 KB
/
Copy pathProjectTest.php
File metadata and controls
52 lines (44 loc) · 1.5 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
<?php
declare(strict_types=1);
namespace Tests\PHPCensor\Model;
use PHPCensor\Common\Exception\InvalidArgumentException;
use PHPCensor\DatabaseManager;
use PHPCensor\Model;
use PHPCensor\Model\Project;
use PHPCensor\StoreRegistry;
use PHPUnit\Framework\TestCase;
use PHPCensor\Common\Application\ConfigurationInterface;
/**
* Unit tests for the Project model class.
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class ProjectTest extends TestCase
{
private StoreRegistry $storeRegistry;
protected function setUp(): void
{
$configuration = $this->getMockBuilder(ConfigurationInterface::class)->getMock();
$databaseManager = $this
->getMockBuilder(DatabaseManager::class)
->setConstructorArgs([$configuration])
->getMock();
$this->storeRegistry = $this
->getMockBuilder(StoreRegistry::class)
->setConstructorArgs([$databaseManager])
->getMock();
}
public function testExecute_TestProjectAccessInformation(): void
{
$info = [
'item1' => 'Item One',
'item2' => 2,
];
$project = new Project($this->storeRegistry);
$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());
}
}