Completed
Push — master ( 6ebd1c...df9bae )
by John
10:14
created

DocumentRepositoryTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A willFailWhenKeyIsEmpty() 0 5 1
A gettingDocumentThatDoestExistWillConstructIt() 0 6 1
A canUsePathPrefix() 0 6 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\Dev\Document;
10
11
use KleijnWeb\SwaggerBundle\Document\DocumentRepository;
12
13
/**
14
 * @author John Kleijn <[email protected]>
15
 */
16
class DocumentRepositoryTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @test
20
     * @expectedException \InvalidArgumentException
21
     */
22
    public function willFailWhenKeyIsEmpty()
23
    {
24
        $repository = new DocumentRepository();
25
        $repository->get('');
26
    }
27
28
    /**
29
     * @test
30
     */
31
    public function gettingDocumentThatDoestExistWillConstructIt()
32
    {
33
        $repository = new DocumentRepository();
34
        $document = $repository->get('src/Tests/Functional/PetStore/app/swagger/petstore.yml');
35
        $this->assertInstanceOf('KleijnWeb\SwaggerBundle\Document\SwaggerDocument', $document);
36
    }
37
38
    /**
39
     * @test
40
     */
41
    public function canUsePathPrefix()
42
    {
43
        $repository = new DocumentRepository('src/Tests/Functional/PetStore');
44
        $document = $repository->get('app/swagger/petstore.yml');
45
        $this->assertInstanceOf('KleijnWeb\SwaggerBundle\Document\SwaggerDocument', $document);
46
    }
47
}
48