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

RepoTest::checkFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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