Passed
Push — master ( 39e51c...ca88cb )
by Alex
03:38
created

CreateButtonUnitTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 8
c 1
b 0
f 1
dl 0
loc 20
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testCreateButtonFromSetting() 0 14 1
1
<?php
2
namespace Mezon\Gui\Tests\Common;
3
4
use Mezon\Gui\ListBuilder;
5
use Mezon\Gui\Tests\ListBuilderTestsBase;
6
use Mezon\Gui\Tests\FakeAdapter;
7
8
class CreateButtonUnitTest extends ListBuilderTestsBase
9
{
10
11
    /**
12
     * Testing generating create button from setting
13
     */
14
    public function testCreateButtonFromSetting(): void
15
    {
16
        // setup
17
        $_GET['create-page-endpoint'] = '/create-endpoint/';
18
        $_GET['create-button'] = 1;
19
        $listBuilder = new ListBuilder\Common($this->getFields(), new FakeAdapter($this->getRecords()));
20
        $listBuilder->createButtonEndpoint = '/create-endpoint-from-setting/';
21
        $listBuilder->listTitle = 'Some list title';
22
23
        // test body
24
        $content = $listBuilder->listingForm();
25
26
        // assertions
27
        $this->assertStringContainsString("/create-endpoint-from-setting/", $content);
28
    }
29
}
30