1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace AbterPhp\Contact\Grid\Factory; |
6
|
|
|
|
7
|
|
|
use AbterPhp\Admin\Grid\Factory\GridFactory; |
8
|
|
|
use AbterPhp\Admin\Grid\Factory\PaginationFactory; |
9
|
|
|
use AbterPhp\Contact\Grid\Factory\Table\Form as TableFactory; |
10
|
|
|
use AbterPhp\Contact\Grid\Filters\Form as Filters; |
11
|
|
|
use AbterPhp\Framework\Grid\IGrid; |
12
|
|
|
use Opulence\Routing\Urls\UrlGenerator; |
13
|
|
|
use PHPUnit\Framework\MockObject\MockObject; |
14
|
|
|
use PHPUnit\Framework\TestCase; |
15
|
|
|
|
16
|
|
|
class FormTest extends TestCase |
17
|
|
|
{ |
18
|
|
|
/** @var Form - System Under Test */ |
19
|
|
|
protected $sut; |
20
|
|
|
|
21
|
|
|
/** @var MockObject|UrlGenerator */ |
22
|
|
|
protected $urlGeneratorMock; |
23
|
|
|
|
24
|
|
|
/** @var MockObject|PaginationFactory */ |
25
|
|
|
protected $paginationFactoryMock; |
26
|
|
|
|
27
|
|
|
/** @var MockObject|TableFactory */ |
28
|
|
|
protected $tableFactoryMock; |
29
|
|
|
|
30
|
|
|
/** @var MockObject|GridFactory */ |
31
|
|
|
protected $gridFactoryMock; |
32
|
|
|
|
33
|
|
|
/** @var MockObject|Filters */ |
34
|
|
|
protected $filtersMock; |
35
|
|
|
|
36
|
|
|
public function setUp(): void |
37
|
|
|
{ |
38
|
|
|
$this->urlGeneratorMock = $this->createMock(UrlGenerator::class); |
39
|
|
|
$this->paginationFactoryMock = $this->createMock(PaginationFactory::class); |
40
|
|
|
$this->tableFactoryMock = $this->createMock(TableFactory::class); |
41
|
|
|
$this->gridFactoryMock = $this->createMock(GridFactory::class); |
42
|
|
|
$this->filtersMock = $this->createMock(Filters::class); |
43
|
|
|
|
44
|
|
|
$this->sut = new Form( |
45
|
|
|
$this->urlGeneratorMock, |
46
|
|
|
$this->paginationFactoryMock, |
47
|
|
|
$this->tableFactoryMock, |
48
|
|
|
$this->gridFactoryMock, |
49
|
|
|
$this->filtersMock |
50
|
|
|
); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
public function testCreateGrid() |
54
|
|
|
{ |
55
|
|
|
$params = []; |
56
|
|
|
$baseUrl = ''; |
57
|
|
|
|
58
|
|
|
$actualResult = $this->sut->createGrid($params, $baseUrl); |
59
|
|
|
|
60
|
|
|
$this->assertInstanceOf(IGrid::class, $actualResult); |
61
|
|
|
} |
62
|
|
|
} |
63
|
|
|
|