testAccessTokenToDatabase()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * CakePHPify : CakePHP Plugin for Shopify API Authentication
4
 * Copyright (c) Multidimension.al (http://multidimension.al)
5
 * Github : https://github.com/multidimension-al/cakephpify
6
 *
7
 * Licensed under The MIT License
8
 * For full copyright and license information, please see the LICENSE file
9
 * Redistributions of files must retain the above copyright notice.
10
 *
11
 * @copyright (c) Multidimension.al (http://multidimension.al)
12
 * @link      https://github.com/multidimension-al/cakephpify CakePHPify Github
13
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
14
 */
15
16
namespace Multidimensional\Cakephpify\Test\TestCase\Controller\Component;
17
18
use Cake\Controller\ComponentRegistry;
19
use Cake\Controller\Controller;
20
use Cake\Event\Event;
21
use Cake\Network\Request;
22
use Cake\Network\Response;
23
use Cake\TestSuite\TestCase;
24
use Multidimensional\Cakephpify\Controller\Component\ShopifyDatabaseComponent;
25
use Multidimensional\Cakephpify\Test\Fixture\AccessTokensFixture;
26
use Multidimensional\Cakephpify\Test\Fixture\ShopsFixture;
27
28
class ShopifyDatabaseComponentTest extends TestCase
29
{
30
31
    public $component = null;
32
    public $controller = null;
33
34
    public $fixtures = ['plugin.Multidimensional/Cakephpify.Shops',
35
                            'plugin.Multidimensional/Cakephpify.AccessTokens'];
36
37
    public function setUp()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
38
    {
39
        parent::setUp();
40
        $request = new Request();
41
        $response = new Response();
42
        $this->controller = $this->getMockBuilder('Cake\Controller\Controller')
43
            ->setConstructorArgs([$request, $response])
44
            ->setMethods(null)
45
            ->getMock();
46
        $registry = new ComponentRegistry($this->controller);
47
        $this->component = new ShopifyDatabaseComponent($registry);
48
        $event = new Event('Controller.startup', $this->controller);
49
        $this->component->startup($event);
50
    }
51
52
    public function tearDown()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
53
    {
54
        parent::tearDown();
55
        unset($this->component, $this->controller);
56
    }
57
58
    public function testShopDataToDatabase()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
59
    {
60
        $this->markTestIncomplete('Not implemented yet.');
61
    }
62
63
    public function testAccessTokenToDatabase()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
64
    {
65
        $this->markTestIncomplete('Not implemented yet.');
66
    }
67
68
    public function testGetShopIdFromDomain()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
69
    {
70
        //$return = $this->component->getShopIdFromDomain('test.myshopify.com');
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
71
        //$this->assertSame($return, 8675309);
0 ignored issues
show
Unused Code Comprehensibility introduced by
80% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
72
        //$this->assertEquals($return, 8675309);
0 ignored issues
show
Unused Code Comprehensibility introduced by
80% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
73
74
        $return = $this->component->getShopIdFromDomain('false.myshopify.com');
75
        $this->assertFalse($return);
76
        
77
        $return = $this->component->getShopIdFromDomain('not-a-domain.com');
78
        $this->assertFalse($return);
79
        
80
        $return = $this->component->getShopIdFromDomain(null);
81
        $this->assertFalse($return);
82
        
83
        $return = $this->component->getShopIdFromDomain(true);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
84
        $this->assertFalse($return);
85
        
86
        $return = $this->component->getShopIdFromDomain(false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
87
        $this->assertFalse($return);
88
    }
89
90
    public function testGetShopDataFromAccessToken()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
91
    {
92
        $return = $this->component->getShopDataFromAccessToken(null, null);
93
        $this->assertFalse($return);
94
        
95
        $return = $this->component->getShopDataFromAccessToken(null, true);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
96
        $this->assertFalse($return);
97
        
98
        $return = $this->component->getShopDataFromAccessToken(true, null);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
99
        $this->assertFalse($return);
100
        
101
        $return = $this->component->getShopDataFromAccessToken(null, false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
102
        $this->assertFalse($return);
103
        
104
        $return = $this->component->getShopDataFromAccessToken(false, null);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
105
        $this->assertFalse($return);
106
        
107
        $return = $this->component->getShopDataFromAccessToken(false, false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
108
        $this->assertFalse($return);
109
        
110
        $return = $this->component->getShopDataFromAccessToken(true, true);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
111
        $this->assertFalse($return);
112
    }
113
114
    public function testGetAccessTokenFromShopDomain()
0 ignored issues
show
introduced by
Missing function doc comment
Loading history...
115
    {
116
        $return = $this->component->getAccessTokenFromShopDomain(null, null);
117
        $this->assertFalse($return);
118
        
119
        $return = $this->component->getAccessTokenFromShopDomain(null, true);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
120
        $this->assertFalse($return);
121
        
122
        $return = $this->component->getAccessTokenFromShopDomain(true, null);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
123
        $this->assertFalse($return);
124
        
125
        $return = $this->component->getAccessTokenFromShopDomain(null, false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
126
        $this->assertFalse($return);
127
        
128
        $return = $this->component->getAccessTokenFromShopDomain(false, null);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
129
        $this->assertFalse($return);
130
        
131
        $return = $this->component->getAccessTokenFromShopDomain(false, false);
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
132
        $this->assertFalse($return);
133
        
134
        $return = $this->component->getAccessTokenFromShopDomain(true, true);
0 ignored issues
show
Documentation introduced by
true is of type boolean, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
135
        $this->assertFalse($return);        
0 ignored issues
show
introduced by
Double space found
Loading history...
136
    }
137
}
138