Passed
Push — master ( f83aa9...a7daae )
by Alex
03:39
created

SetMessageUnitTest::setErrorMessageDataProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
namespace Mezon\Application\Tests;
3
4
use PHPUnit\Framework\TestCase;
5
use Mezon\Application\CommonApplication;
6
use Mezon\HtmlTemplate\HtmlTemplate;
7
8
class SetMessageUnitTest extends TestCase
9
{
10
11
    /**
12
     * Data provider for the test testSetErrorMessage
13
     *
14
     * @return array testing data
15
     */
16
    public function setErrorMessageDataProvider(): array
17
    {
18
        return [
19
            [
20
                'setSuccessMessage'
21
            ],
22
            [
23
                'setErrorMessage'
24
            ]
25
        ];
26
    }
27
28
    /**
29
     * Testing method
30
     *
31
     * @dataProvider setErrorMessageDataProvider
32
     */
33
    public function testSetErrorMessage(string $method): void
34
    {
35
        // setup
36
        $application = new CommonApplication(new HtmlTemplate([
37
            __DIR__ . '/Res/',
38
            __DIR__
39
        ]));
40
41
        // test body
42
        $application->$method('test-error');
43
44
        // assertions
45
        $this->assertStringContainsString('error', $application->getTemplate()
46
            ->getPageVar('action-message'));
47
    }
48
}
49