Completed
Push — master ( 8247ab...4ae4bd )
by Andrii
32:57
created

RepoTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 5
Bugs 0 Features 1
Metric Value
wmc 3
c 5
b 0
f 1
lcom 1
cbo 3
dl 0
loc 22
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testFindByOrganization() 0 5 1
A testFindByUser() 0 5 1
A checkFound() 0 7 1
1
<?php
2
/**
3
 * GitHub API implementation for yii2-hiart
4
 *
5
 * @link      https://github.com/hiqdev/yii2-hiart-github
6
 * @package   yii2-hiart-github
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\hiart\github\tests\functional;
12
13
use hiqdev\hiart\github\models\Repo;
14
15
class RepoTest extends \PHPUnit_Framework_TestCase
16
{
17
    public function testFindByOrganization()
18
    {
19
        $query = Repo::find()->where(['organization' => 'hiqdev']);
20
        $this->checkFound($query);
21
    }
22
23
    public function testFindByUser()
24
    {
25
        $query = Repo::find()->where(['user' => 'hiqsol']);
26
        $this->checkFound($query);
27
    }
28
29
    public function checkFound($query)
30
    {
31
        $models = $query->all();
32
33
        $this->assertGreaterThan(1, count($models));
34
        $this->assertInstanceOf(Repo::class, reset($models));
35
    }
36
}
37