Completed
Push — master ( f88f6e...5d85cb )
by Pavel
03:14
created

AbstractNormalizerTest::getValidSubjects()

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 1
c 0
b 0
f 0
nc 1
1
<?php
2
3
namespace Bankiru\Seo\Tests\Unit\Normalizer;
4
5
use Bankiru\Seo\Destination\DestinationNormalizer;
6
use Bankiru\Seo\Exception\DestinationException;
7
8
abstract class AbstractNormalizerTest extends \PHPUnit_Framework_TestCase
9
{
10
    /**
11
     * @dataProvider getValidSubjects
12
     *
13
     * @param string $expected
14
     * @param mixed  $subject
15
     */
16
    public function testValidObjectNormalization($expected, $subject)
17
    {
18
        $normalizer = $this->createNormalizer();
19
20
        self::assertTrue($normalizer->supports($subject));
21
        self::assertEquals($expected, $normalizer->normalize($subject));
22
    }
23
24
    /**
25
     * @dataProvider getInvalidSubjects
26
     *
27
     * @param mixed $subject
28
     */
29
    public function testUnsupportedNormalizerThrowsException($subject)
30
    {
31
        $normalizer = $this->createNormalizer();
32
        self::assertFalse($normalizer->supports($subject));
33
34
        try {
35
            $normalizer->normalize($subject);
36
        } catch (DestinationException $exception) {
37
            return;
38
        }
39
40
        self::fail('DestinationException is not thrown on invalid normalization');
41
    }
42
43
    abstract public function getValidSubjects();
44
45
    abstract public function getInvalidSubjects();
46
47
    /** @return DestinationNormalizer */
48
    abstract protected function createNormalizer();
49
}
50