Completed
Push — master ( 533532...ee214c )
by Rafael
04:23
created

DoctrineAssertTrait   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 18
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A assertRepositoryContains() 0 3 1
A assertRepositoryNotContains() 0 3 1
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Test\Assert;
12
13
use Symfony\Bundle\FrameworkBundle\Client;
14
15
/**
16
 * @method Client getClient()
17
 *
18
 * @requires DoctrineHelperTrait
19
 */
20
trait DoctrineAssertTrait
21
{
22
    /**
23
     * @param string $class
24
     * @param array  $criteria
25
     */
26 7
    public static function assertRepositoryContains($class, $criteria)
27
    {
28 7
        static::assertNotNull(static::getRepository($class)->findOneBy($criteria));
29 7
    }
30
31
    /**
32
     * @param string $class
33
     * @param array  $criteria
34
     */
35 2
    public static function assertRepositoryNotContains($class, $criteria)
36
    {
37 2
        static::assertNull(static::getRepository($class)->findOneBy($criteria));
38 2
    }
39
}
40