RepoTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

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