Completed
Push — master ( f49f11...eddceb )
by John
02:48
created

ApiTestCaseTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUpBeforeClass() 0 4 1
A notFoundApiCallThrowsException() 0 4 1
A methodNotSupportedReturnsMethodNotAllowed() 0 5 1
1
<?php
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\ApiResponseErrorException;
12
use KleijnWeb\SwaggerBundle\Test\ApiTestCase;
13
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
14
15
/**
16
 * @author John Kleijn <[email protected]>
17
 */
18
class ApiTestCaseTest extends WebTestCase
19
{
20
    use ApiTestCase;
21
22
    /**
23
     * Use config_basic.yml
24
     *
25
     * @var bool
26
     */
27
    protected $env = 'basic';
28
29
    public static function setUpBeforeClass()
30
    {
31
        static::initSchemaManager(__DIR__ . '/PetStore/app/swagger/petstore.yml');
32
    }
33
34
    /**
35
     * @test
36
     * @expectedException \KleijnWeb\SwaggerBundle\Test\ApiResponseErrorException
37
     */
38
    public function notFoundApiCallThrowsException()
39
    {
40
        $this->get('/foo');
41
    }
42
43
    /**
44
     * @test
45
     * @expectedException \KleijnWeb\SwaggerBundle\Test\ApiResponseErrorException
46
     * @expectedExceptionCode 405
47
     */
48
    public function methodNotSupportedReturnsMethodNotAllowed()
49
    {
50
        $this->patch('/v2/pet/findByStatus', []);
51
52
    }
53
}
54