RepoTest::testFindByUser()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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