Passed
Push — master ( 586e6b...5b2592 )
by Alex
03:06
created

CreateButtonUnitTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
use PHPUnit\Framework\TestCase;
8
use Mezon\Conf\Conf;
9
10
/**
11
 *
12
 * @psalm-suppress PropertyNotSetInConstructor
13
 */
14
class CreateButtonUnitTest extends ListBuilderTestsBase
15
{
16
17
    /**
18
     *
19
     * {@inheritdoc}
20
     * @see TestCase::setUp()
21
     * @psalm-suppress RedundantCondition
22
     */
23
    protected function setUp(): void
24
    {
25
        Conf::setConfigStringValue('headers/layer', 'mock');
26
    }
27
28
    /**
29
     * Testing generating create button from setting
30
     */
31
    public function testCreateButtonFromSetting(): void
32
    {
33
        // setup
34
        $_GET['create-page-endpoint'] = '/create-endpoint/';
35
        $_GET['create-button'] = 1;
36
        $listBuilder = new ListBuilder\Common($this->getFields(), new FakeAdapter($this->getRecords()));
37
        $listBuilder->createButtonEndpoint = '/create-endpoint-from-setting/';
38
        $listBuilder->listTitle = 'Some list title';
39
40
        // test body
41
        $content = $listBuilder->listingForm();
42
43
        // assertions
44
        $this->assertStringContainsString("/create-endpoint-from-setting/", $content);
45
    }
46
}
47