Completed
Push — develop ( 2e1df2...27dbda )
by Mathieu
03:22
created

PageTest::testEncoding()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
rs 10
c 1
b 0
f 1
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 function PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3338 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

11
        /** @scrutinizer ignore-deprecated */ $this->assertAttributeEquals('fr_FR', 'language', $page);

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

The explanatory message should give you some clue as to whether and when the function will be removed and what other function 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 function PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3338 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

18
        /** @scrutinizer ignore-deprecated */ $this->assertAttributeEquals('iso-8859-1', 'encoding', $page);

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

The explanatory message should give you some clue as to whether and when the function will be removed and what other function 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 function PHPUnit\Framework\Assert::assertAttributeEquals() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3338 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

25
        /** @scrutinizer ignore-deprecated */ $this->assertAttributeEquals('My great webpage', 'title', $page);

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

The explanatory message should give you some clue as to whether and when the function will be removed and what other function 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 function PHPUnit\Framework\Assert::readAttribute() has been deprecated: https://github.com/sebastianbergmann/phpunit/issues/3338 ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-deprecated  annotation

33
        $stylesheets = /** @scrutinizer ignore-deprecated */ Assert::readAttribute($page, 'stylesheets');

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

The explanatory message should give you some clue as to whether and when the function will be removed and what other function 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