-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathActionCategoryManagerTest.php
73 lines (51 loc) · 1.95 KB
/
ActionCategoryManagerTest.php
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
<?php
declare(strict_types=1);
namespace App\Tests\Manager;
use App\Entity\Action;
use App\Entity\ActionCategory;
use App\Entity\Category;
use App\Manager\ActionCategoryManager;
use App\Manager\ActionManager;
use App\Manager\CategoryManager;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
class ActionCategoryManagerTest extends KernelTestCase
{
protected ActionManager $actionManager;
protected CategoryManager $categoryManager;
protected ActionCategoryManager $actionCategoryManager;
protected function setUp(): void
{
self::bootKernel();
$this->actionManager = static::getContainer()->get('App\Manager\ActionManager');
$this->categoryManager = static::getContainer()->get('App\Manager\CategoryManager');
$this->actionCategoryManager = static::getContainer()->get('App\Manager\ActionCategoryManager');
}
public function testPersist(): void
{
$action = new Action();
$action->setTitle(uniqid('phpunit-'));
$this->actionManager->persist($action);
$category = new Category();
$category->setTitle(uniqid('phpunit-'));
$this->categoryManager->persist($category);
$actionCategory = new ActionCategory();
$actionCategory->setAction($action);
$actionCategory->setCategory($category);
$this->actionCategoryManager->persist($actionCategory);
$this->assertIsInt($actionCategory->getId());
$this->actionCategoryManager->remove($actionCategory);
$this->categoryManager->remove($category);
$this->actionManager->remove($action);
}
public function testGetOne(): void
{
$test = $this->actionCategoryManager->getOne(['id' => 0]);
$this->assertNull($test);
}
public function testGetList(): void
{
$test = $this->actionCategoryManager->getList(['id' => 0])->getResult();
$this->assertIsArray($test);
$this->assertCount(0, $test);
}
}