GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#99)
by
unknown
11:15 queued 01:14
created

SearchTest::testMaximumPriceGetterAndSetter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
/*
3
 * Copyright 2013 Jan Eichhorn <[email protected]>
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 */
17
18
namespace ApaiIO\Test\Operations\Types;
19
20
use ApaiIO\Operations\Search;
21
22
class SearchTest extends \PHPUnit_Framework_TestCase
23
{
24
    /**
25
     * @expectedException InvalidArgumentException
26
     */
27
    public function testSearchException()
28
    {
29
        $search = new Search();
30
        $search->setPage(11);
31
    }
32
33
    /**
34
     * @expectedException InvalidArgumentException
35
     */
36
    public function testMaximumPriceException()
37
    {
38
        $search = new Search();
39
        $search->setMaximumPrice(-1);
40
    }
41
42
    public function testMaximumPriceGetterAndSetter()
43
    {
44
        $search = new Search();
45
46
        $object = $search->setMaximumPrice(100);
47
48
        static::assertSame($search, $object);
49
        static::assertEquals(100, $search->getMaximumPrice());
50
    }
51
52
    public function testMinimumPriceGetterAndSetter()
53
    {
54
        $search = new Search();
55
56
        $object = $search->setMinimumPrice(100);
57
58
        static::assertSame($search, $object);
59
        static::assertEquals(100, $search->getMinimumPrice());
60
    }
61
62
    /**
63
     * @expectedException InvalidArgumentException
64
     */
65
    public function testMinimumPriceException()
66
    {
67
        $search = new Search();
68
        $search->setMinimumPrice('helloworld');
69
    }
70
71
    public function testSearchValidPage()
72
    {
73
        $search = new Search();
74
        $search->setPage(1);
75
76
        static::assertEquals(1, $search->getItemPage());
0 ignored issues
show
Documentation Bug introduced by
The method getItemPage does not exist on object<ApaiIO\Operations\Search>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
77
    }
78
79
    public function testConditionGetterAndSetter()
80
    {
81
        $search = new Search();
82
        $search->setCondition('All');
83
        static::assertEquals('All', $search->getCondition());
84
    }
85
86
    public function testAvailabilityGetterAndSetter()
87
    {
88
        $search = new Search();
89
        $search->setAvailability('Available');
90
        static::assertEquals('Available', $search->getAvailability());
91
    }
92
93
    public function testNodeGetterAndSetter()
94
    {
95
        $search = new Search();
96
        static::assertEquals(null, $search->getBrowseNode());
97
        $search->setBrowseNode(10967581);
98
        static::assertEquals(10967581, $search->getBrowseNode());
99
    }
100
101
    public function testGetCategory()
102
    {
103
        $search = new Search();
104
        static::assertEquals(null, $search->getCategory());
105
        $search->setCategory('All');
106
        static::assertEquals('All', $search->getCategory());
107
    }
108
109
    public function testGetKeywords()
110
    {
111
        $search = new Search();
112
        static::assertEquals(null, $search->getKeywords());
113
        $search->setKeywords('4k tv');
114
        static::assertEquals('4k tv', $search->getKeywords());
115
    }
116
117
    public function testGetPage()
118
    {
119
        $search = new Search();
120
        static::assertEquals(null, $search->getPage());
121
        $search->setPage(3);
122
        static::assertEquals(3, $search->getPage());
123
    }
124
125
    public function testGetMinimumPrice()
126
    {
127
        $search = new Search();
128
        static::assertEquals(null, $search->getMinimumPrice());
129
        $search->setMinimumPrice(899);
130
        static::assertEquals(899, $search->getMinimumPrice());
131
    }
132
133
    public function testGetMaximumPrice()
134
    {
135
        $search = new Search();
136
        static::assertEquals(null, $search->getMaximumPrice());
137
        $search->setMaximumPrice(899);
138
        static::assertEquals(899, $search->getMaximumPrice());
139
    }
140
141
    public function testGetCondition()
142
    {
143
        $search = new Search();
144
        static::assertEquals(null, $search->getCondition());
145
        $search->setCondition('Collectible');
146
        static::assertEquals('Collectible', $search->getCondition());
147
    }
148
149
    public function testGetAvailability()
150
    {
151
        $search = new Search();
152
        static::assertEquals(null, $search->getAvailability());
153
        $search->setAvailability('Available');
154
        static::assertEquals('Available', $search->getAvailability());
155
    }
156
157
    public function testGetBrowseNode()
158
    {
159
        $search = new Search();
160
        static::assertEquals(null, $search->getBrowseNode());
161
        $search->setBrowseNode(123);
162
        static::assertEquals(123, $search->getBrowseNode());
163
    }
164
165
    public function testGetCategory()
166
    {
167
        $search = new Search();
168
        $search->setCategory('All');
169
        $this->assertEquals('All', $search->getCategory());
170
    }
171
172
    public function testGetKeywords()
173
    {
174
        $search = new Search();
175
        $search->setKeywords('4k tv');
176
        $this->assertEquals('4k tv', $search->getKeywords());
177
    }
178
179
    public function testGetPage()
180
    {
181
        $search = new Search();
182
        $search->setPage(3);
183
        $this->assertEquals(3, $search->getPage());
184
    }
185
186
    public function testGetMinimumPrice()
187
    {
188
        $search = new Search();
189
        $search->setMinimumPrice(899);
190
        $this->assertEquals(899, $search->getMinimumPrice());
191
    }
192
193
    public function testGetMaximumPrice()
194
    {
195
        $search = new Search();
196
        $search->setMaximumPrice(899);
197
        $this->assertEquals(899, $search->getMaximumPrice());
198
    }
199
200
    public function testGetCondition()
201
    {
202
        $search = new Search();
203
        $search->setCondition('Collectible');
204
        $this->assertEquals('Collectible', $search->getCondition());
205
    }
206
207
    public function testGetAvailability()
208
    {
209
        $search = new Search();
210
        $search->setAvailability('Available');
211
        $this->assertEquals('Available', $search->getAvailability());
212
    }
213
214
    public function testGetBrowseNode()
215
    {
216
        $search = new Search();
217
        $search->setBrowseNode(123);
218
        $this->assertEquals(123, $search->getBrowseNode());
219
    }
220
}
221