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

PerformanceRepositoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 23
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testFindAllWithinSeasons() 0 10 1
A allPerformancesHasAtLeastOneSeason() 0 9 1
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