Completed
Push — master ( 18696f...4ea9b4 )
by Serhii
04:47 queued 11s
created

testFindAllWithinSeasons()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace App\Tests\Functional\Repository;
4
5
use App\Entity\Performance;
6
use App\Repository\PerformanceRepository;
7
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
8
9
class PerformanceRepositoryTest extends WebTestCase
10
{
11
    public function testFindAllWithinSeasons()
12
    {
13
        self::bootKernel();
14
        $performances = self::$container
15
            ->get(PerformanceRepository::class)
16
            ->findAllWithinSeasons();
17
18
        $this->assertNotEmpty($performances);
19
        $this->allPerformancesHasAtLeastOneSeason($performances);
20
    }
21
22
    private function allPerformancesHasAtLeastOneSeason(array $performances)
23
    {
24
        $this->assertNotEmpty(array_filter($performances, function (Performance $performance) {
25
            return !$performance->getSeasons()->isEmpty();
26
        }));
27
        $this->assertEmpty(array_filter($performances, function (Performance $performance) {
28
            return $performance->getSeasons()->isEmpty();
29
        }));
30
    }
31
}
32