TestRepository   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A findTestsBySuite() 0 11 1
1
<?php
2
/**
3
 * Copyright (c) 2017 Francois-Xavier Soubirou.
4
 *
5
 * This file is part of ci-report.
6
 *
7
 * ci-report is free software: you can redistribute it and/or modify
8
 * it under the terms of the GNU General Public License as published by
9
 * the Free Software Foundation, either version 3 of the License, or
10
 * (at your option) any later version.
11
 *
12
 * ci-report is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU General Public License
18
 * along with ci-report. If not, see <http://www.gnu.org/licenses/>.
19
 */
20
declare(strict_types=1);
21
22
namespace App\Repository;
23
24
use App\Entity\Suite;
25
use Gedmo\Sortable\Entity\Repository\SortableRepository;
26
27
/**
28
 * Test repository class.
29
 *
30
 * @category  ci-report app
31
 *
32
 * @author    Francois-Xavier Soubirou <[email protected]>
33
 * @copyright 2017 Francois-Xavier Soubirou
34
 * @license   http://www.gnu.org/licenses/   GPLv3
35
 *
36
 * @see      https://www.ci-report.io
37
 */
38
class TestRepository extends SortableRepository
39
{
40
    /**
41
     * Get all tests for a suite.
42
     *
43
     * @param Suite $suite The suite
44
     *
45
     * @return array
46
     */
47
    public function findTestsBySuite(Suite $suite): array
48
    {
49
        $qb = $this->createQueryBuilder('t')
50
            ->innerJoin('t.suite', 's')
51
            ->where('s.id = :suiteId')
52
            ->setParameter('suiteId', $suite->getId())
53
            ->orderBy('t.package', 'ASC', 't.className', 'ASC', 't.name', 'ASC', 't.position', 'ASC');
54
55
        $result = $qb->getQuery()->getResult();
56
57
        return $result;
58
    }
59
}
60