Completed
Pull Request — develop (#342)
by Alexander
17:05
created

testDateDesrialization()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 16
rs 9.4286
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
/**
3
 * DatetimeDeserializationControllerTest class file
4
 */
5
6
namespace Graviton\CoreBundle\Tests\Controller;
7
8
use Graviton\TestBundle\Test\RestTestCase;
9
use Symfony\Component\HttpFoundation\Response;
10
use GravitonDyn\TestCaseDatetimeDeserializationBundle\Document\TestCaseDatetimeDeserialization;
11
12
/**
13
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
14
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
15
 * @link     http://swisscom.ch
16
 */
17
class DatetimeDeserializationControllerTest extends RestTestCase
18
{
19
    /**
20
     * Set up the test
21
     *
22
     * @return void
23
     */
24
    public function setUp()
25
    {
26
        if (!class_exists(TestCaseDatetimeDeserialization::class)) {
27
            $this->markTestSkipped(sprintf('%s definition is not loaded', TestCaseDatetimeDeserialization::class));
28
        }
29
    }
30
31
    /**
32
     * Test datetime deserialization and serialization
33
     *
34
     * @return void
35
     */
36
    public function testDateDesrialization()
37
    {
38
        $data = (object) [
39
            'datetime'  => '2015-12-10T12:02:16+0000',
40
            'datetimes' => [
41
                '2015-12-10T10:02:16+0000',
42
                '2015-12-11T11:02:16+0000',
43
                '2015-12-12T12:02:16+0000',
44
            ],
45
        ];
46
47
        $client = static::createRestClient();
48
        $client->post('/testcase/datetime-deserialization/', $data);
49
        $this->assertEquals(Response::HTTP_OK, $client->getResponse()->getStatusCode());
50
        $this->assertEquals($data, $client->getResults());
51
    }
52
}
53