Completed
Pull Request — develop (#15)
by Narcotic
13:08
created

SchemaFactoryTest::testCreateSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 18
rs 9.4285
cc 1
eloc 13
nc 1
nop 0
1
<?php
2
/**
3
 * SchemaFactoryTest class file
4
 */
5
6
namespace Graviton\JsonSchemaBundle\Tests\Schema;
7
8
use Graviton\JsonSchemaBundle\Schema\SchemaFactory;
9
10
/**
11
 * Test SchemaFactory
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 SchemaFactoryTest extends \PHPUnit_Framework_TestCase
18
{
19
    /**
20
     * Test SchemaFactory::createSchema()
21
     *
22
     * @return void
23
     */
24
    public function testCreateSchema()
25
    {
26
        $uri = __METHOD__;
27
        $schema = (object) [__METHOD__ => __LINE__];
28
29
        $resolver = $this->getMockBuilder('JsonSchema\RefResolver')
30
            ->disableOriginalConstructor()
31
            ->getMock();
32
        $resolver->expects($this->once())
33
            ->method('resolve')
34
            ->with($uri)
35
            ->willReturn($schema);
36
37
        $this->assertEquals(
38
            $schema,
39
            (new SchemaFactory($resolver))->createSchema($uri)
40
        );
41
    }
42
}
43