Completed
Push — master ( 088bf6...a47832 )
by Martijn
02:41
created

testCommandDocWithDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 20
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 20
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
class AbstractDocumentableObjectTest extends SwaggerGen_TestCase
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
4
{
5
6
	protected $parent;
7
8
	protected function setUp()
9
	{
10
		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
11
	}
12
13
	protected function assertPreConditions()
14
	{
15
		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
16
	}
17
18
	/**
19
	 * @covers \SwaggerGen\Swagger\Tag::__construct
20
	 * @covers \SwaggerGen\Swagger\AbstractDocumentableObject->handleCommand
21
	 */
22
	public function testCommandDocWithoutDescription()
23
	{
24
		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
25
26
		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
27
28
		$this->assertSame(array(
29
			'name' => 'Name',
30
				), $object->toArray());
31
32
		$object->handleCommand('doc', 'http://example.test');
33
34
		$this->assertSame(array(
35
			'name' => 'Name',
36
			'externalDocs' => array(
37
				'url' => 'http://example.test',
38
			),
39
				), $object->toArray());
40
	}
41
42
	/**
43
	 * @covers \SwaggerGen\Swagger\Tag::__construct
44
	 * @covers \SwaggerGen\Swagger\AbstractDocumentableObject->handleCommand
45
	 */
46
	public function testCommandDocWithDescription()
47
	{
48
		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
49
50
		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
51
52
		$this->assertSame(array(
53
			'name' => 'Name',
54
				), $object->toArray());
55
56
		$object->handleCommand('doc', 'http://example.test Some words here');
57
58
		$this->assertSame(array(
59
			'name' => 'Name',
60
			'externalDocs' => array(
61
				'url' => 'http://example.test',
62
				'description' => 'Some words here',
63
			),
64
				), $object->toArray());
65
	}
66
67
}
68