Completed
Push — master ( a18731...e2e070 )
by
unknown
99:54 queued 47:45
created

OpportunityStatusBoardTest::gridProvider()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 30
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 30
rs 8.8571
c 1
b 0
f 0
cc 1
eloc 19
nc 1
nop 0
1
<?php
2
3
namespace OroCRM\Bundle\SalesBundle\Tests\Functional\Controller;
4
5
use Oro\Bundle\DataGridBundle\Tests\Functional\AbstractDatagridTestCase;
6
7
use OroCRM\Bundle\SalesBundle\Tests\Functional\Fixture\LoadOpportunityStatusBoardFixtures;
8
9
/**
10
 * @outputBuffering enabled
11
 * @dbIsolation
12
 */
13
class OpportunityStatusBoardTest extends AbstractDatagridTestCase
14
{
15
    /** @var bool */
16
    protected $isRealGridRequest = true;
17
18 View Code Duplication
    protected function setUp()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
    {
20
        $this->initClient(
21
            ['debug' => false],
22
            array_merge($this->generateBasicAuthHeader(), array('HTTP_X-CSRF-Header' => 1))
23
        );
24
        $this->client->useHashNavigation(true);
25
        $this->loadFixtures(['OroCRM\Bundle\SalesBundle\Tests\Functional\Fixture\LoadOpportunityStatusBoardFixtures']);
26
    }
27
28
    public function testIndex()
29
    {
30
        $this->client->request('GET', $this->getUrl('orocrm_sales_opportunity_index'));
31
        $result = $this->client->getResponse();
32
        $this->assertHtmlResponseStatusCodeEquals($result, 200);
33
    }
34
35
    /**
36
     * Check that status board loads correct records count based on available statuses
37
     *
38
     * @return array
39
     */
40
    public function gridProvider()
41
    {
42
        $perPage = 4;
43
        return [
44
            'Opportunity grid'                => [
45
                [
46
                    'gridParameters'      => [
47
                        'gridName' => 'sales-opportunity-grid',
48
                        'sales-opportunity-grid[_pager][_per_page]' => $perPage,
49
                    ],
50
                    'gridFilters'         => [],
51
                    'assert'              => [],
52
                    'expectedResultCount' => $perPage
53
                ],
54
            ],
55
            'Opportunity status board' => [
56
                [
57
                    'gridParameters'      => [
58
                        'gridName' => 'sales-opportunity-grid',
59
                        'sales-opportunity-grid[_appearance][_type]' => 'board',
60
                        'sales-opportunity-grid[_appearance][_data][id]' => 'opportunity-by-status',
61
                        'sales-opportunity-grid[_pager][_per_page]' => $perPage,
62
                    ],
63
                    'gridFilters'         => [],
64
                    'assert'              => [],
65
                    'expectedResultCount' => LoadOpportunityStatusBoardFixtures::STATUSES_COUNT * $perPage
66
                ],
67
            ],
68
        ];
69
    }
70
}
71