Completed
Push — master ( 0631c4...d19571 )
by Andrii
02:04
created

ProjectTest::testCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * Libraries.io API implementation for yii2-hiart.
4
 *
5
 * @link      https://github.com/hiqdev/yii2-hiart-librariesio
6
 * @package   yii2-hiart-librariesio
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\hiart\librariesio\tests\functional;
12
13
use hiqdev\hiart\librariesio\models\Project;
14
15
class ProjectTest extends \PHPUnit\Framework\TestCase
16
{
17
    public function testCount()
18
    {
19
        $total = Project::find()->where(['q' => 'jquery'])->count();
20
21
        $this->assertGreaterThan(1, $total);
22
    }
23
24
    public function testFindByName()
25
    {
26
        $query = Project::find()->where(['q' => 'jquery'])->limit(2);
27
        $this->checkFound($query);
28
    }
29
30
    public function checkFound($query)
31
    {
32
        $models = $query->all();
33
34
        $this->assertSame(2, count($models));
35
        $this->assertInstanceOf(Project::class, reset($models));
36
    }
37
}
38