Completed
Push — master ( 011345...c3bf1d )
by Andrii
02:59
created

ConnectionTest::testFixedBaseUri()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * ActiveRecord for API
4
 *
5
 * @link      https://github.com/hiqdev/yii2-hiart
6
 * @package   yii2-hiart
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\hiart\tests\unit;
12
13
use hiqdev\hiart\rest\Connection;
14
15
/**
16
 * Connection test class.
17
 */
18
class ConnectionTest extends \PHPUnit_Framework_TestCase
19
{
20
    protected $shortUri = 'http://api.dev';
21
22
    protected $fixedUri = 'http://api.dev/';
23
24
    protected function setUp()
25
    {
26
        $this->db = new Connection();
0 ignored issues
show
Bug introduced by
The property db does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
27
    }
28
29
    protected function tearDown()
30
    {
31
    }
32
33
    public function testShortBaseUri()
34
    {
35
        $this->db->baseUri = $this->shortUri;
36
        $this->assertSame($this->fixedUri, $this->db->getBaseUri());
37
    }
38
39
    public function testFixedBaseUri()
40
    {
41
        $this->db->baseUri = $this->fixedUri;
42
        $this->assertSame($this->fixedUri, $this->db->getBaseUri());
43
    }
44
}
45