FallbackExtensionTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 39
rs 10
c 0
b 0
f 0
wmc 3
lcom 2
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A tearDown() 0 5 1
A testIndex() 0 7 1
1
<?php
2
/**
3
 * Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
4
 *
5
 * Licensed under The MIT License
6
 * Redistributions of files must retain the above copyright notice.
7
 *
8
 * @copyright Copyright 2016 - 2018, Cake Development Corporation (http://cakedc.com)
9
 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
10
 */
11
12
namespace CakeDC\Api\Test\TestCase\Integration\Service\Action\Extension;
13
14
use CakeDC\Api\TestSuite\IntegrationTestCase;
15
use CakeDC\Api\Test\ConfigTrait;
16
use CakeDC\Api\Test\FixturesTrait;
17
use CakeDC\Api\Test\Settings;
18
use Cake\Core\Configure;
19
20
class FallbackExtensionTest extends IntegrationTestCase
21
{
22
23
    use ConfigTrait;
24
    use FixturesTrait;
25
26
    /**
27
     * setUp
28
     *
29
     * @return void
30
     */
31
    public function setUp()
32
    {
33
        parent::setUp();
34
        Configure::write('App.fullBaseUrl', 'http://example.com');
35
        $this->_tokenAccess();
36
        $this->_loadDefaultExtensions([]);
37
        $this->getDefaultUser(Settings::USER1);
38
    }
39
40
    /**
41
     * tearDown
42
     *
43
     * @return void
44
     */
45
    public function tearDown()
46
    {
47
        parent::tearDown();
48
        Configure::write('Test.Api.Extension', null);
49
    }
50
51
    public function testIndex()
52
    {
53
        $this->sendRequest('/articles', 'GET');
54
        $result = $this->getJsonResponse();
55
        $this->assertSuccess($result);
56
        $this->assertEquals(15, count($result['data']));
57
    }
58
}
59