Completed
Push — l10n_master ( 1196b3...ae29fe )
by Ruud
167:23 queued 153:15
created

testFindAllNotDisabled()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace Kunstmaan\TranslatorBundle\Tests\Service\Importer;
3
4
use Kunstmaan\TranslatorBundle\Repository\TranslationRepository;
5
use Kunstmaan\TranslatorBundle\Tests\BaseTestCase;
6
7
class TranslationRepositoryTest extends BaseTestCase
8
{
9
    /** @var TranslationRepository */
10
    private $translationRepository;
11
12
    public function setUp()
13
    {
14
        parent::setUp();
15
        $this->translationRepository = $this->getContainer()->get('kunstmaan_translator.repository.translation');
16
    }
17
18
    /**
19
     * @group translation-repository
20
     */
21
    public function testGetAllDomainsByLocale()
22
    {
23
        $result = $this->translationRepository->getAllDomainsByLocale();
24
        $firstItem = reset($result);
25
        $this->assertArrayHasKey('locale', $firstItem);
26
        $this->assertArrayHasKey('name', $firstItem);
27
    }
28
29
    /**
30
     * @group translation-repository
31
     */
32
    public function testGetLastChangedTranslationDate()
33
    {
34
        $date = $this->translationRepository->getLastChangedTranslationDate();
35
        $this->assertInstanceOf('\DateTime', $date);
36
    }
37
38
    /**
39
     * @group translation-repository
40
     */
41
    public function testGetTranslationsByLocalesAndDomains()
42
    {
43
        $result = $this->translationRepository->getTranslationsByLocalesAndDomains(array('nl'), array('messages'));
44
        $this->assertInstanceOf('Kunstmaan\TranslatorBundle\Entity\Translation', $result[0]);
45
        $this->assertGreaterThan(0, count($result));
46
    }
47
48
    /**
49
     * @group translation-repository
50
     */
51
    public function testFindAllNotDisabled()
52
    {
53
        $result = $this->translationRepository->findAllNotDisabled('nl');
54
        $this->assertInstanceOf('Kunstmaan\TranslatorBundle\Entity\Translation', $result[0]);
55
        $this->assertGreaterThan(0, count($result));
56
    }
57
58
    /**
59
     * @group translation-repository
60
     */
61
    public function testFindAllDeprecated()
62
    {
63
        $result = $this->translationRepository->findDeprecatedTranslationsBeforeDate(new \DateTime(), 'messages');
64
        $this->assertInstanceOf('Kunstmaan\TranslatorBundle\Entity\Translation', $result[0]);
65
        $this->assertGreaterThan(0, count($result));
66
    }
67
}
68