Completed
Pull Request — dev (#11)
by
unknown
05:12 queued 01:17
created

JsonpEncoderTest::encodeProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Vectorface\SnappyRouterTests\Encoder;
4
5
use Vectorface\SnappyRouter\Encoder\JsonpEncoder;
6
7
/**
8
 * Tests the JsonpEncoder class.
9
 * @copyright Copyright (c) 2014, VectorFace, Inc.
10
 * @author Dan Bruce <[email protected]>
11
 */
12
class JsonpEncoderTest extends AbstractEncoderTest
13
{
14
    /**
15
     * Returns the encoder to be tested.
16
     * @return \Vectorface\SnappyRouter\Encoder\AbstractEncoder Returns an instance of an encoder.
17
     */
18
    public function getEncoder()
19
    {
20
        $options = array(
21
            'clientMethod' => 'doSomething'
22
        );
23
        return new JsonpEncoder($options);
24
    }
25
26
    /**
27
     * A data provider for the testEncode method.
28
     */
29
    public function encodeProvider()
30
    {
31
        return array(
32
            array(
33
                'doSomething("test1234");',
34
                'test1234'
35
            )
36
        );
37
    }
38
39
    /**
40
     * Tests that an exception is thrown if the client method is missing from
41
     * the options.
42
     * @expectedException Exception
43
     * @expectedExceptionMessage Client method missing from plugin options.
44
     */
45
    public function testMissingClientMethodThrowsException()
46
    {
47
        new JsonpEncoder(array());
48
    }
49
}
50