Completed
Pull Request — master (#80)
by John
02:58
created

JmsSerializationPetStoreApiTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 38
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpBeforeClass() 0 4 1
A canPlaceOrder() 0 15 1
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\SwaggerBundle\Tests\Functional;
10
11
use KleijnWeb\SwaggerBundle\Test\ApiTestCase;
12
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
13
14
/**
15
 * @author John Kleijn <[email protected]>
16
 */
17
class JmsSerializationPetStoreApiTest extends WebTestCase
18
{
19
    use ApiTestCase;
20
21
    /**
22
     * Use config_jms.yml
23
     *
24
     * @var bool
25
     */
26
    protected $env = 'jms';
27
28
    /**
29
     * Initialize SwaggerAssertions Schema Manager
30
     */
31
    public static function setUpBeforeClass()
32
    {
33
        static::initSchemaManager(__DIR__ . '/PetStore/app/swagger/petstore.yml');
34
    }
35
36
    /**
37
     * @test
38
     */
39
    public function canPlaceOrder()
40
    {
41
        $content = [
42
            'petId'    => 987654321,
43
            'quantity' => 10,
44
            'shipDate' => '2016-01-01T01:00:00Z',
45
            'complete' => false
46
        ];
47
48
        $actual = $this->post('/v2/store/order', $content);
49
        $this->assertSame('placed', $actual->status);
50
        $this->assertSame($content['petId'], $actual->petId);
51
        $this->assertSame($content['quantity'], $actual->quantity);
52
        $this->assertInternalType('integer', $actual->id);
53
    }
54
}
55