Completed
Pull Request — master (#168)
by
unknown
02:57
created

testSettingsAction()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 21
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
c 5
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 2
eloc 9
nc 2
nop 0
1
<?php
2
3
/*
4
 * This file is part of the ONGR package.
5
 *
6
 * (c) NFQ Technologies UAB <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace ONGR\SettingsBundle\Tests\Functional\Controller;
13
14
use ONGR\ElasticsearchBundle\Test\AbstractElasticsearchTestCase;
15
use ONGR\SettingsBundle\Tests\Fixtures\Security\LoginTestHelper;
16
use Symfony\Bundle\FrameworkBundle\Client;
17
18
/**
19
 * Tests for SettingsController.
20
 */
21
class PersonalSettingsControllerTest extends AbstractElasticsearchTestCase
22
{
23
    /**
24
     * @var Client.
25
     */
26
    private $client;
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    protected function setUp()
32
    {
33
        parent::setUp();
34
        $this->client = static::createClient();
35
    }
36
37
    /**
38
     * Test settings page ability to set values to cookie.
39
     */
40
    public function testSettingsAction()
41
    {
42
        $this->getManager();
43
        /** @var Client $client */
44
        $client = $this->client;
45
46
        // Visit settings page.
47
        $crawler = $client->request('GET', '/settings/settings');
0 ignored issues
show
Unused Code introduced by
$crawler is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
48
49
        // Assert categories are rendered.
50
        /** @var array $categories */
51
        $categories = $client->getContainer()->getParameter('ongr_settings.settings.categories');
52
        $content = $client->getResponse()->getContent();
53
        unset($categories['ongr_settings_profiles']);
54
55
        // Print $content.
56
        foreach ($categories as $category) {
57
            $this->assertContains($category['name'], $content);
58
        }
59
60
    }
61
}
62