Completed
Push — master ( 7f340c...a0843d )
by Mathieu
08:01
created

PageTest::testAddStylesheet()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
1
<?php
2
use PHPUnit\Framework\Assert;
3
use PHPUnit\Framework\TestCase;
4
5
class PageTest extends TestCase
6
{
7
    public function testLanguage()
8
    {
9
        $page = new \Suricate\Page();
10
        $page->setLanguage('fr_FR');
11
        $this->assertAttributeEquals('fr_FR', 'language', $page);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated with message: https://github.com/sebastianbergmann/phpunit/issues/3338

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
12
    }
13
14
    public function testEncoding()
15
    {
16
        $page = new \Suricate\Page();
17
        $page->setEncoding('iso-8859-1');
18
        $this->assertAttributeEquals('iso-8859-1', 'encoding', $page);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated with message: https://github.com/sebastianbergmann/phpunit/issues/3338

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
19
    }
20
21
    public function testTitle()
22
    {
23
        $page = new \Suricate\Page();
24
        $page->setTitle('My great webpage');
25
        $this->assertAttributeEquals('My great webpage', 'title', $page);
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated with message: https://github.com/sebastianbergmann/phpunit/issues/3338

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
26
    }
27
28
    public function testAddStylesheet()
29
    {
30
        $page = new \Suricate\Page();
31
        $page->addStylesheet('stylesheet-ref', '/my.css');
32
33
        $stylesheets = Assert::readAttribute($page, 'stylesheets');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit\Framework\Assert::readAttribute() has been deprecated with message: https://github.com/sebastianbergmann/phpunit/issues/3338

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
34
        
35
36
        $this->assertEquals(
37
            $stylesheets, 
38
            [
39
                'stylesheet-ref' => ['url' => '/my.css', 'media' => 'all'],
40
            ]);
41
        $this->assertNotEquals(
42
            $stylesheets, [
43
                'another-stylesheet' => ['url' => '/my-2.css', 'media' => 'all'],
44
            ]);
45
    }
46
47
}
48