Completed
Push — master ( d43734...ab0406 )
by Tomasz
03:38
created

testJsonEncodeSerializationFailureException()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
namespace Thunder\Serializard\Tests;
3
4
use Thunder\Serializard\Format\ArrayFormat;
5
use Thunder\Serializard\Format\JsonFormat;
6
use Thunder\Serializard\HydratorContainer\FallbackHydratorContainer;
7
use Thunder\Serializard\NormalizerContainer\FallbackNormalizerContainer;
8
9
/**
10
 * @author Tomasz Kowalczyk <[email protected]>
11
 */
12
class FormatTest extends \PHPUnit_Framework_TestCase
13
{
14
    public function testArrayUnserializeInvalidTypeException()
15
    {
16
        $format = new ArrayFormat();
17
        $this->setExpectedException('RuntimeException');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
18
        $format->unserialize(new \stdClass(), 'stdClass', new FallbackHydratorContainer());
19
    }
20
21
    public function testMissingUnserializationHandlerException()
22
    {
23
        $format = new ArrayFormat();
24
        $this->setExpectedException('RuntimeException');
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
25
        $format->unserialize(array(), 'stdClass', new FallbackHydratorContainer());
26
    }
27
28
    public function testJsonEncodeSerializationFailureException()
29
    {
30
        $format = new JsonFormat();
31
        $this->setExpectedException('RuntimeException'); // Inf and NaN cannot be JSON encoded
0 ignored issues
show
Deprecated Code introduced by
The method PHPUnit_Framework_TestCase::setExpectedException() has been deprecated with message: Method deprecated since Release 5.2.0; use expectException() instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
32
        $this->assertSame(INF, $format->serialize(INF, new FallbackNormalizerContainer()));
33
    }
34
}
35