Completed
Push — master ( 866487...6bcace )
by Dorian
04:50
created

BooksListTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 92
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 4
dl 0
loc 92
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testPageStatusCode() 0 4 1
A testPageHeader() 0 5 1
A testEditorsList() 0 22 1
A testCategoriesList() 0 5 1
A testErasList() 0 8 1
A testBooksTable() 0 7 1
1
<?php
2
3
namespace Application\Tests\Functional;
4
5
use Gnutix\Kernel\Tests\Functional\WebTestCase;
6
7
/**
8
 * Books List Tests
9
 *
10
 * @group functional
11
 */
12
final class BooksListTest extends WebTestCase
13
{
14
    /** @var \Symfony\Component\DomCrawler\Crawler */
15
    protected $crawler;
16
17
    /**
18
     * Set up the test client
19
     */
20
    protected function setUp(): void
21
    {
22
        parent::setUp();
23
24
        $this->crawler = $this->httpKernelBrowser->request('GET', '/');
25
    }
26
27
    /**
28
     * Test the page status code
29
     */
30
    public function testPageStatusCode(): void
31
    {
32
        $this->assertSame(200, $this->httpKernelBrowser->getResponse()->getStatusCode());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
33
    }
34
35
    /**
36
     * Tests the page title and description
37
     */
38
    public function testPageHeader(): void
39
    {
40
        $this->assertStringContainsString('Star Wars', $this->crawler->filter('h1')->text());
0 ignored issues
show
Bug introduced by
The method assertStringContainsString() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
41
        $this->assertStringContainsString('list of Star Wars books', $this->crawler->filter('p')->text());
0 ignored issues
show
Bug introduced by
The method assertStringContainsString() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
42
    }
43
44
    /**
45
     * Tests the editors list
46
     */
47
    public function testEditorsList(): void
48
    {
49
        $this->assertCount(3, $this->crawler->filter('#collapseEditors tbody tr'));
0 ignored issues
show
Bug introduced by
The method assertCount() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
50
51
        $this->assertSame(
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
52
            'EN',
53
            $this->crawler->filter('#collapseEditors tbody tr')->first()->filter('img')->attr('alt')
54
        );
55
        $this->assertStringContainsString(
0 ignored issues
show
Bug introduced by
The method assertStringContainsString() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
56
            'English Publisher',
57
            $this->crawler->filter('#collapseEditors tbody tr')->first()->filter('td')->last()->text()
58
        );
59
60
        $this->assertSame(
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
61
            'FR',
62
            $this->crawler->filter('#collapseEditors tbody tr')->eq(1)->filter('img')->attr('alt')
63
        );
64
        $this->assertStringContainsString(
0 ignored issues
show
Bug introduced by
The method assertStringContainsString() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
65
            'French Publisher',
66
            $this->crawler->filter('#collapseEditors tbody tr')->eq(1)->filter('td')->last()->text()
67
        );
68
    }
69
70
    /**
71
     * Tests the categories list
72
     */
73
    public function testCategoriesList(): void
74
    {
75
        $this->assertCount(2, $this->crawler->filter('#collapseTypes li'));
0 ignored issues
show
Bug introduced by
The method assertCount() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
76
        $this->assertStringContainsString('Novel', $this->crawler->filter('#collapseTypes li')->first()->text());
0 ignored issues
show
Bug introduced by
The method assertStringContainsString() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
77
    }
78
79
    /**
80
     * Tests the eras list
81
     */
82
    public function testErasList(): void
83
    {
84
        $this->assertCount(3, $this->crawler->filter('#collapseEras ul li'));
0 ignored issues
show
Bug introduced by
The method assertCount() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
85
        $this->assertStringContainsString(
0 ignored issues
show
Bug introduced by
The method assertStringContainsString() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
86
            'Old Republic',
87
            $this->crawler->filter('#collapseEras a[href="#oldRepublic"]')->text()
88
        );
89
    }
90
91
    /**
92
     * Tests the book table
93
     *
94
     * @todo Complete this test...
95
     */
96
    public function testBooksTable(): void
97
    {
98
        $this->assertCount(1, $this->crawler->filter('table[data-books-list]'));
0 ignored issues
show
Bug introduced by
The method assertCount() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
99
        $this->assertGreaterThan(1, $this->crawler->filter('table[data-books-list] thead')->count());
0 ignored issues
show
Bug introduced by
The method assertGreaterThan() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
100
        $this->assertGreaterThan(1, $this->crawler->filter('table[data-books-list] tbody')->count());
0 ignored issues
show
Bug introduced by
The method assertGreaterThan() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
101
        $this->assertGreaterThan(1, $this->crawler->filter('table[data-books-list] tbody td')->count());
0 ignored issues
show
Bug introduced by
The method assertGreaterThan() does not seem to exist on object<Application\Tests...nctional\BooksListTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
102
    }
103
}
104