AbstractEncoderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
getEncoder() 0 1 ?
encodeProvider() 0 1 ?
A testEncode() 0 10 1
1
<?php
2
3
namespace Vectorface\SnappyRouterTests\Encoder;
4
5
use PHPUnit\Framework\TestCase;
6
use Vectorface\SnappyRouter\Response\Response;
7
8
/**
9
 * A base class for testing the various encoders.
10
 * @copyright Copyright (c) 2014, VectorFace, Inc.
11
 * @author Dan Bruce <[email protected]>
12
 */
13
abstract class AbstractEncoderTest extends TestCase
14
{
15
    /**
16
     * Tests the encode method of the encoder.
17
     * @dataProvider encodeProvider
18
     */
19
    public function testEncode($expected, $input)
20
    {
21
        $encoder = $this->getEncoder();
22
        $this->assertEquals(
23
            $expected,
24
            $encoder->encode(
25
                new Response($input)
26
            )
27
        );
28
    }
29
30
    /**
31
     * Returns the encoder to be tested.
32
     * @return \Vectorface\SnappyRouter\Encoder\AbstractEncoder Returns an instance of an encoder.
33
     */
34
    abstract public function getEncoder();
35
36
    /**
37
     * A data provider for the testEncode method.
38
     */
39
    abstract public function encodeProvider();
40
}
41