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

testCreateButtonFromSetting()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 7
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 14
rs 10
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