Completed
Push — master ( ba73f2...e6d5b5 )
by Martijn
27s
created
SwaggerGen/Swagger/ResponseReference.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -13,25 +13,25 @@
 block discarded – undo
13 13
 class ResponseReference extends AbstractObject
14 14
 {
15 15
 
16
-    private $reference;
17
-
18
-    public function __construct(AbstractObject $parent, $reference)
19
-    {
20
-        parent::__construct($parent);
21
-
22
-        $this->reference = $reference;
23
-    }
24
-
25
-    public function toArray(): array
26
-    {
27
-        return self::arrayFilterNull(array(
28
-            '$ref' => '#/responses/' . $this->reference,
29
-        ));
30
-    }
31
-
32
-    public function __toString()
33
-    {
34
-        return __CLASS__ . ' `' . $this->reference . '`';
35
-    }
16
+	private $reference;
17
+
18
+	public function __construct(AbstractObject $parent, $reference)
19
+	{
20
+		parent::__construct($parent);
21
+
22
+		$this->reference = $reference;
23
+	}
24
+
25
+	public function toArray(): array
26
+	{
27
+		return self::arrayFilterNull(array(
28
+			'$ref' => '#/responses/' . $this->reference,
29
+		));
30
+	}
31
+
32
+	public function __toString()
33
+	{
34
+		return __CLASS__ . ' `' . $this->reference . '`';
35
+	}
36 36
 
37 37
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/License.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -14,94 +14,94 @@
 block discarded – undo
14 14
 class License extends AbstractObject
15 15
 {
16 16
 
17
-    // @todo make this a separate resource file? (licenseUrls.json)
18
-    private static $licenses = array(
19
-        'artistic-1.0' => 'http://opensource.org/licenses/artistic-license-1.0',
20
-        'artistic-1' => 'http://opensource.org/licenses/artistic-license-1.0',
21
-        'artistic-2.0' => 'http://opensource.org/licenses/artistic-license-2.0',
22
-        'artistic-2' => 'http://opensource.org/licenses/artistic-license-2.0',
23
-        'artistic' => 'http://opensource.org/licenses/artistic-license-2.0',
24
-        'bsd-new' => 'https://opensource.org/licenses/BSD-3-Clause',
25
-        'bsd-3' => 'https://opensource.org/licenses/BSD-3-Clause',
26
-        'bsd-2' => 'https://opensource.org/licenses/BSD-2-Clause',
27
-        'bsd' => 'https://opensource.org/licenses/BSD-2-Clause',
28
-        'epl-1.0' => 'http://www.eclipse.org/legal/epl-v10.html',
29
-        'epl-1' => 'http://www.eclipse.org/legal/epl-v10.html',
30
-        'epl' => 'http://www.eclipse.org/legal/epl-v10.html',
31
-        'apache-2.0' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
32
-        'apache-2' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
33
-        'apache' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
34
-        'gpl-1.0' => 'https://www.gnu.org/licenses/gpl-1.0.html',
35
-        'gpl-1' => 'https://www.gnu.org/licenses/gpl-1.0.html',
36
-        'gpl-2.0' => 'https://www.gnu.org/licenses/gpl-2.0.html',
37
-        'gpl-2' => 'https://www.gnu.org/licenses/gpl-2.0.html',
38
-        'gpl-3.0' => 'http://www.gnu.org/licenses/gpl-3.0.html',
39
-        'gpl-3' => 'http://www.gnu.org/licenses/gpl-3.0.html',
40
-        'gpl' => 'http://www.gnu.org/licenses/gpl-3.0.html',
41
-        'lgpl-2.0' => 'http://www.gnu.org/licenses/lgpl-2.0.html',
42
-        'lgpl-2.1' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
43
-        'lgpl-2' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
44
-        'lgpl-3.0' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
45
-        'lgpl-3' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
46
-        'lgpl' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
47
-        'mit' => 'http://opensource.org/licenses/MIT',
48
-        'mpl-1.1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
49
-        'mpl-1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
50
-        'mpl-2.0' => 'https://www.mozilla.org/en-US/MPL/',
51
-        'mpl-2' => 'https://www.mozilla.org/en-US/MPL/',
52
-        'mpl' => 'https://www.mozilla.org/en-US/MPL/',
53
-        'mspl' => 'https://msdn.microsoft.com/en-us/library/ff648068.aspx',
54
-    );
55
-    private $name;
56
-    private $url;
17
+	// @todo make this a separate resource file? (licenseUrls.json)
18
+	private static $licenses = array(
19
+		'artistic-1.0' => 'http://opensource.org/licenses/artistic-license-1.0',
20
+		'artistic-1' => 'http://opensource.org/licenses/artistic-license-1.0',
21
+		'artistic-2.0' => 'http://opensource.org/licenses/artistic-license-2.0',
22
+		'artistic-2' => 'http://opensource.org/licenses/artistic-license-2.0',
23
+		'artistic' => 'http://opensource.org/licenses/artistic-license-2.0',
24
+		'bsd-new' => 'https://opensource.org/licenses/BSD-3-Clause',
25
+		'bsd-3' => 'https://opensource.org/licenses/BSD-3-Clause',
26
+		'bsd-2' => 'https://opensource.org/licenses/BSD-2-Clause',
27
+		'bsd' => 'https://opensource.org/licenses/BSD-2-Clause',
28
+		'epl-1.0' => 'http://www.eclipse.org/legal/epl-v10.html',
29
+		'epl-1' => 'http://www.eclipse.org/legal/epl-v10.html',
30
+		'epl' => 'http://www.eclipse.org/legal/epl-v10.html',
31
+		'apache-2.0' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
32
+		'apache-2' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
33
+		'apache' => 'http://www.apache.org/licenses/LICENSE-2.0.html',
34
+		'gpl-1.0' => 'https://www.gnu.org/licenses/gpl-1.0.html',
35
+		'gpl-1' => 'https://www.gnu.org/licenses/gpl-1.0.html',
36
+		'gpl-2.0' => 'https://www.gnu.org/licenses/gpl-2.0.html',
37
+		'gpl-2' => 'https://www.gnu.org/licenses/gpl-2.0.html',
38
+		'gpl-3.0' => 'http://www.gnu.org/licenses/gpl-3.0.html',
39
+		'gpl-3' => 'http://www.gnu.org/licenses/gpl-3.0.html',
40
+		'gpl' => 'http://www.gnu.org/licenses/gpl-3.0.html',
41
+		'lgpl-2.0' => 'http://www.gnu.org/licenses/lgpl-2.0.html',
42
+		'lgpl-2.1' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
43
+		'lgpl-2' => 'http://www.gnu.org/licenses/lgpl-2.1.html',
44
+		'lgpl-3.0' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
45
+		'lgpl-3' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
46
+		'lgpl' => 'http://www.gnu.org/licenses/lgpl-3.0.html',
47
+		'mit' => 'http://opensource.org/licenses/MIT',
48
+		'mpl-1.1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
49
+		'mpl-1' => 'https://www.mozilla.org/en-US/MPL/1.1/',
50
+		'mpl-2.0' => 'https://www.mozilla.org/en-US/MPL/',
51
+		'mpl-2' => 'https://www.mozilla.org/en-US/MPL/',
52
+		'mpl' => 'https://www.mozilla.org/en-US/MPL/',
53
+		'mspl' => 'https://msdn.microsoft.com/en-us/library/ff648068.aspx',
54
+	);
55
+	private $name;
56
+	private $url;
57 57
 
58
-    public function __construct(AbstractObject $parent, $name, $url = null)
59
-    {
60
-        parent::__construct($parent);
58
+	public function __construct(AbstractObject $parent, $name, $url = null)
59
+	{
60
+		parent::__construct($parent);
61 61
 
62
-        $this->name = empty($name) ? null : $name;
62
+		$this->name = empty($name) ? null : $name;
63 63
 
64
-        if (!empty($url)) {
65
-            $this->url = $url;
66
-        } elseif (!empty(self::$licenses[strtolower($name)])) {
67
-            $this->url = self::$licenses[strtolower($name)];
68
-        }
69
-    }
64
+		if (!empty($url)) {
65
+			$this->url = $url;
66
+		} elseif (!empty(self::$licenses[strtolower($name)])) {
67
+			$this->url = self::$licenses[strtolower($name)];
68
+		}
69
+	}
70 70
 
71
-    /**
72
-     * @param string $command
73
-     * @param string $data
74
-     * @return AbstractObject|boolean
75
-     */
76
-    public function handleCommand($command, $data = null)
77
-    {
78
-        switch (strtolower($command)) {
79
-            case 'name':
80
-                $this->name = $data;
81
-                if (empty($this->url) && !empty(self::$licenses[strtolower($data)])) {
82
-                    $this->url = self::$licenses[strtolower($data)];
83
-                }
84
-                return $this;
71
+	/**
72
+	 * @param string $command
73
+	 * @param string $data
74
+	 * @return AbstractObject|boolean
75
+	 */
76
+	public function handleCommand($command, $data = null)
77
+	{
78
+		switch (strtolower($command)) {
79
+			case 'name':
80
+				$this->name = $data;
81
+				if (empty($this->url) && !empty(self::$licenses[strtolower($data)])) {
82
+					$this->url = self::$licenses[strtolower($data)];
83
+				}
84
+				return $this;
85 85
 
86
-            case 'url':
87
-                $this->url = $data;
88
-                return $this;
89
-        }
86
+			case 'url':
87
+				$this->url = $data;
88
+				return $this;
89
+		}
90 90
 
91
-        return parent::handleCommand($command, $data);
92
-    }
91
+		return parent::handleCommand($command, $data);
92
+	}
93 93
 
94
-    public function toArray(): array
95
-    {
96
-        return self::arrayFilterNull(array_merge(array(
97
-            'name' => $this->name,
98
-            'url' => $this->url,
99
-        ), parent::toArray()));
100
-    }
94
+	public function toArray(): array
95
+	{
96
+		return self::arrayFilterNull(array_merge(array(
97
+			'name' => $this->name,
98
+			'url' => $this->url,
99
+		), parent::toArray()));
100
+	}
101 101
 
102
-    public function __toString()
103
-    {
104
-        return __CLASS__ . " {$this->name}, {$this->url}";
105
-    }
102
+	public function __toString()
103
+	{
104
+		return __CLASS__ . " {$this->name}, {$this->url}";
105
+	}
106 106
 
107 107
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/ParameterReference.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -13,30 +13,30 @@
 block discarded – undo
13 13
 class ParameterReference extends AbstractObject implements IParameter
14 14
 {
15 15
 
16
-    private $reference;
17
-
18
-    public function __construct(AbstractObject $parent, $reference)
19
-    {
20
-        parent::__construct($parent);
21
-
22
-        $this->reference = $reference;
23
-    }
24
-
25
-    public function toArray(): array
26
-    {
27
-        return self::arrayFilterNull(array(
28
-            '$ref' => '#/parameters/' . $this->reference,
29
-        ));
30
-    }
31
-
32
-    public function __toString()
33
-    {
34
-        return __CLASS__ . ' `' . $this->reference . '`';
35
-    }
36
-
37
-    public function getName()
38
-    {
39
-        return $this->reference;
40
-    }
16
+	private $reference;
17
+
18
+	public function __construct(AbstractObject $parent, $reference)
19
+	{
20
+		parent::__construct($parent);
21
+
22
+		$this->reference = $reference;
23
+	}
24
+
25
+	public function toArray(): array
26
+	{
27
+		return self::arrayFilterNull(array(
28
+			'$ref' => '#/parameters/' . $this->reference,
29
+		));
30
+	}
31
+
32
+	public function __toString()
33
+	{
34
+		return __CLASS__ . ' `' . $this->reference . '`';
35
+	}
36
+
37
+	public function getName()
38
+	{
39
+		return $this->reference;
40
+	}
41 41
 
42 42
 }
Please login to merge, or discard this patch.
SwaggerGen/Swagger/Contact.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -14,49 +14,49 @@
 block discarded – undo
14 14
 class Contact extends AbstractObject
15 15
 {
16 16
 
17
-    private $name;
18
-    private $url;
19
-    private $email;
20
-
21
-    public function __construct(AbstractObject $parent, $name = null, $url = null, $email = null)
22
-    {
23
-        parent::__construct($parent);
24
-
25
-        $this->name = empty($name) ? null : $name;
26
-        $this->url = empty($url) ? null : $url;
27
-        $this->email = empty($email) ? null : $email;
28
-    }
29
-
30
-    /**
31
-     * @param string $command
32
-     * @param string $data
33
-     * @return AbstractObject|boolean
34
-     */
35
-    public function handleCommand($command, $data = null)
36
-    {
37
-        switch (strtolower($command)) {
38
-            case 'name':
39
-            case 'url':
40
-            case 'email':
41
-                $this->$command = $data;
42
-                return $this;
43
-        }
44
-
45
-        return parent::handleCommand($command, $data);
46
-    }
47
-
48
-    public function toArray(): array
49
-    {
50
-        return self::arrayFilterNull(array_merge(array(
51
-            'name' => $this->name,
52
-            'url' => $this->url,
53
-            'email' => $this->email,
54
-        ), parent::toArray()));
55
-    }
56
-
57
-    public function __toString()
58
-    {
59
-        return __CLASS__ . " {$this->name} <{$this->email}>, {$this->url}";
60
-    }
17
+	private $name;
18
+	private $url;
19
+	private $email;
20
+
21
+	public function __construct(AbstractObject $parent, $name = null, $url = null, $email = null)
22
+	{
23
+		parent::__construct($parent);
24
+
25
+		$this->name = empty($name) ? null : $name;
26
+		$this->url = empty($url) ? null : $url;
27
+		$this->email = empty($email) ? null : $email;
28
+	}
29
+
30
+	/**
31
+	 * @param string $command
32
+	 * @param string $data
33
+	 * @return AbstractObject|boolean
34
+	 */
35
+	public function handleCommand($command, $data = null)
36
+	{
37
+		switch (strtolower($command)) {
38
+			case 'name':
39
+			case 'url':
40
+			case 'email':
41
+				$this->$command = $data;
42
+				return $this;
43
+		}
44
+
45
+		return parent::handleCommand($command, $data);
46
+	}
47
+
48
+	public function toArray(): array
49
+	{
50
+		return self::arrayFilterNull(array_merge(array(
51
+			'name' => $this->name,
52
+			'url' => $this->url,
53
+			'email' => $this->email,
54
+		), parent::toArray()));
55
+	}
56
+
57
+	public function __toString()
58
+	{
59
+		return __CLASS__ . " {$this->name} <{$this->email}>, {$this->url}";
60
+	}
61 61
 
62 62
 }
Please login to merge, or discard this patch.
tests/Parser/Php/PreprocessorTest.php 1 patch
Indentation   +274 added lines, -274 removed lines patch added patch discarded remove patch
@@ -6,42 +6,42 @@  discard block
 block discarded – undo
6 6
 class PreprocessorTest extends TestCase
7 7
 {
8 8
 
9
-    /**
10
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
11
-     */
12
-    public function testConstructor_Empty()
13
-    {
14
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
15
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
16
-    }
17
-
18
-    /**
19
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
20
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::getPrefix
21
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::setPrefix
22
-     */
23
-    public function testConstructor_Prefix()
24
-    {
25
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
26
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
27
-        $this->assertEquals('rest', $object->getPrefix());
28
-
29
-        $object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
30
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
31
-        $this->assertEquals('foo', $object->getPrefix());
32
-
33
-        $object->setPrefix('bar');
34
-        $this->assertEquals('bar', $object->getPrefix());
35
-    }
36
-
37
-    /**
38
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
39
-     */
40
-    public function testPreprocess_Ifdef_NotDefined()
41
-    {
42
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
43
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
44
-        $out = $object->preprocess('<?php
9
+	/**
10
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
11
+	 */
12
+	public function testConstructor_Empty()
13
+	{
14
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
15
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
16
+	}
17
+
18
+	/**
19
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::__construct
20
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::getPrefix
21
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::setPrefix
22
+	 */
23
+	public function testConstructor_Prefix()
24
+	{
25
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
26
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
27
+		$this->assertEquals('rest', $object->getPrefix());
28
+
29
+		$object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
30
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
31
+		$this->assertEquals('foo', $object->getPrefix());
32
+
33
+		$object->setPrefix('bar');
34
+		$this->assertEquals('bar', $object->getPrefix());
35
+	}
36
+
37
+	/**
38
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
39
+	 */
40
+	public function testPreprocess_Ifdef_NotDefined()
41
+	{
42
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
43
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
44
+		$out = $object->preprocess('<?php
45 45
 			/**
46 46
 			 * @rest\ifdef test
47 47
 			 * @rest\whatever
@@ -49,25 +49,25 @@  discard block
 block discarded – undo
49 49
 			 */
50 50
 		');
51 51
 
52
-        $this->assertEquals('<?php
52
+		$this->assertEquals('<?php
53 53
 			/**
54 54
 			 * @!rest\ifdef test
55 55
 			 * @!rest\whatever
56 56
 			 * @!rest\endif
57 57
 			 */
58 58
 		', $out);
59
-    }
60
-
61
-    /**
62
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
63
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
64
-     */
65
-    public function testPreprocess_Ifdef_Defined()
66
-    {
67
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
68
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
69
-        $object->define('test');
70
-        $out = $object->preprocess('<?php
59
+	}
60
+
61
+	/**
62
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
63
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
64
+	 */
65
+	public function testPreprocess_Ifdef_Defined()
66
+	{
67
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
68
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
69
+		$object->define('test');
70
+		$out = $object->preprocess('<?php
71 71
 			/**
72 72
 			 * @rest\ifdef test
73 73
 			 * @rest\whatever
@@ -75,23 +75,23 @@  discard block
 block discarded – undo
75 75
 			 */
76 76
 		');
77 77
 
78
-        $this->assertEquals('<?php
78
+		$this->assertEquals('<?php
79 79
 			/**
80 80
 			 * @!rest\ifdef test
81 81
 			 * @rest\whatever
82 82
 			 * @!rest\endif
83 83
 			 */
84 84
 		', $out);
85
-    }
85
+	}
86 86
 
87
-    /**
88
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
89
-     */
90
-    public function testPreprocess_Ifndef_NotDefined()
91
-    {
92
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
93
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
94
-        $out = $object->preprocess('<?php
87
+	/**
88
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
89
+	 */
90
+	public function testPreprocess_Ifndef_NotDefined()
91
+	{
92
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
93
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
94
+		$out = $object->preprocess('<?php
95 95
 			/**
96 96
 			 * @rest\ifndef test
97 97
 			 * @rest\whatever
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
 			 */
100 100
 		');
101 101
 
102
-        $this->assertEquals('<?php
102
+		$this->assertEquals('<?php
103 103
 			/**
104 104
 			 * @!rest\ifndef test
105 105
 			 * @rest\whatever
106 106
 			 * @!rest\endif
107 107
 			 */
108 108
 		', $out);
109
-    }
110
-
111
-    /**
112
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
113
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
114
-     */
115
-    public function testPreprocess_Ifndef_Defined()
116
-    {
117
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
118
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
119
-        $object->define('test');
120
-        $out = $object->preprocess('<?php
109
+	}
110
+
111
+	/**
112
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
113
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
114
+	 */
115
+	public function testPreprocess_Ifndef_Defined()
116
+	{
117
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
118
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
119
+		$object->define('test');
120
+		$out = $object->preprocess('<?php
121 121
 			/**
122 122
 			 * @rest\ifndef test
123 123
 			 * @rest\whatever
@@ -125,23 +125,23 @@  discard block
 block discarded – undo
125 125
 			 */
126 126
 		');
127 127
 
128
-        $this->assertEquals('<?php
128
+		$this->assertEquals('<?php
129 129
 			/**
130 130
 			 * @!rest\ifndef test
131 131
 			 * @!rest\whatever
132 132
 			 * @!rest\endif
133 133
 			 */
134 134
 		', $out);
135
-    }
135
+	}
136 136
 
137
-    /**
138
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
139
-     */
140
-    public function testPreprocess_Define()
141
-    {
142
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
143
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
144
-        $out = $object->preprocess('<?php
137
+	/**
138
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
139
+	 */
140
+	public function testPreprocess_Define()
141
+	{
142
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
143
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
144
+		$out = $object->preprocess('<?php
145 145
 			/**
146 146
 			 * @rest\define test
147 147
 			 * @rest\ifndef test
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			 */
151 151
 		');
152 152
 
153
-        $this->assertEquals('<?php
153
+		$this->assertEquals('<?php
154 154
 			/**
155 155
 			 * @!rest\define test
156 156
 			 * @!rest\ifndef test
@@ -158,16 +158,16 @@  discard block
 block discarded – undo
158 158
 			 * @!rest\endif
159 159
 			 */
160 160
 		', $out);
161
-    }
161
+	}
162 162
 
163
-    /**
164
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
165
-     */
166
-    public function testPreprocess_Undef()
167
-    {
168
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
169
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
170
-        $out = $object->preprocess('<?php
163
+	/**
164
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
165
+	 */
166
+	public function testPreprocess_Undef()
167
+	{
168
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
169
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
170
+		$out = $object->preprocess('<?php
171 171
 			/**
172 172
 			 * @rest\define test
173 173
 			 * @rest\undef test
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 			 */
178 178
 		');
179 179
 
180
-        $this->assertEquals('<?php
180
+		$this->assertEquals('<?php
181 181
 			/**
182 182
 			 * @!rest\define test
183 183
 			 * @!rest\undef test
@@ -186,16 +186,16 @@  discard block
 block discarded – undo
186 186
 			 * @!rest\endif
187 187
 			 */
188 188
 		', $out);
189
-    }
189
+	}
190 190
 
191
-    /**
192
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
193
-     */
194
-    public function testPreprocess_If_NotDefined()
195
-    {
196
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
197
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
198
-        $out = $object->preprocess('<?php
191
+	/**
192
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
193
+	 */
194
+	public function testPreprocess_If_NotDefined()
195
+	{
196
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
197
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
198
+		$out = $object->preprocess('<?php
199 199
 			/**
200 200
 			 * @rest\if test red
201 201
 			 * @rest\whatever
@@ -203,25 +203,25 @@  discard block
 block discarded – undo
203 203
 			 */
204 204
 		');
205 205
 
206
-        $this->assertEquals('<?php
206
+		$this->assertEquals('<?php
207 207
 			/**
208 208
 			 * @!rest\if test red
209 209
 			 * @!rest\whatever
210 210
 			 * @!rest\endif
211 211
 			 */
212 212
 		', $out);
213
-    }
214
-
215
-    /**
216
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
217
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
218
-     */
219
-    public function testPreprocess_If_AnyValue()
220
-    {
221
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
222
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
223
-        $object->define('test', 'green');
224
-        $out = $object->preprocess('<?php
213
+	}
214
+
215
+	/**
216
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
217
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
218
+	 */
219
+	public function testPreprocess_If_AnyValue()
220
+	{
221
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
222
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
223
+		$object->define('test', 'green');
224
+		$out = $object->preprocess('<?php
225 225
 			/**
226 226
 			 * @rest\if test
227 227
 			 * @rest\whatever
@@ -229,25 +229,25 @@  discard block
 block discarded – undo
229 229
 			 */
230 230
 		');
231 231
 
232
-        $this->assertEquals('<?php
232
+		$this->assertEquals('<?php
233 233
 			/**
234 234
 			 * @!rest\if test
235 235
 			 * @rest\whatever
236 236
 			 * @!rest\endif
237 237
 			 */
238 238
 		', $out);
239
-    }
240
-
241
-    /**
242
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
243
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
244
-     */
245
-    public function testPreprocess_If_NoValue()
246
-    {
247
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
248
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
249
-        $object->define('test');
250
-        $out = $object->preprocess('<?php
239
+	}
240
+
241
+	/**
242
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
243
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
244
+	 */
245
+	public function testPreprocess_If_NoValue()
246
+	{
247
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
248
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
249
+		$object->define('test');
250
+		$out = $object->preprocess('<?php
251 251
 			/**
252 252
 			 * @rest\if test red
253 253
 			 * @rest\whatever
@@ -255,25 +255,25 @@  discard block
 block discarded – undo
255 255
 			 */
256 256
 		');
257 257
 
258
-        $this->assertEquals('<?php
258
+		$this->assertEquals('<?php
259 259
 			/**
260 260
 			 * @!rest\if test red
261 261
 			 * @!rest\whatever
262 262
 			 * @!rest\endif
263 263
 			 */
264 264
 		', $out);
265
-    }
266
-
267
-    /**
268
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
269
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
270
-     */
271
-    public function testPreprocess_If_Mismatch()
272
-    {
273
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
274
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
275
-        $object->define('test', 'green');
276
-        $out = $object->preprocess('<?php
265
+	}
266
+
267
+	/**
268
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
269
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
270
+	 */
271
+	public function testPreprocess_If_Mismatch()
272
+	{
273
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
274
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
275
+		$object->define('test', 'green');
276
+		$out = $object->preprocess('<?php
277 277
 			/**
278 278
 			 * @rest\if test red
279 279
 			 * @rest\whatever
@@ -281,25 +281,25 @@  discard block
 block discarded – undo
281 281
 			 */
282 282
 		');
283 283
 
284
-        $this->assertEquals('<?php
284
+		$this->assertEquals('<?php
285 285
 			/**
286 286
 			 * @!rest\if test red
287 287
 			 * @!rest\whatever
288 288
 			 * @!rest\endif
289 289
 			 */
290 290
 		', $out);
291
-    }
292
-
293
-    /**
294
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
295
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
296
-     */
297
-    public function testPreprocess_If_Match()
298
-    {
299
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
300
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
301
-        $object->define('test', 'red');
302
-        $out = $object->preprocess('<?php
291
+	}
292
+
293
+	/**
294
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
295
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
296
+	 */
297
+	public function testPreprocess_If_Match()
298
+	{
299
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
300
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
301
+		$object->define('test', 'red');
302
+		$out = $object->preprocess('<?php
303 303
 			/**
304 304
 			 * @rest\if test red
305 305
 			 * @rest\whatever
@@ -307,25 +307,25 @@  discard block
 block discarded – undo
307 307
 			 */
308 308
 		');
309 309
 
310
-        $this->assertEquals('<?php
310
+		$this->assertEquals('<?php
311 311
 			/**
312 312
 			 * @!rest\if test red
313 313
 			 * @rest\whatever
314 314
 			 * @!rest\endif
315 315
 			 */
316 316
 		', $out);
317
-    }
318
-
319
-    /**
320
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
321
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
322
-     */
323
-    public function testPreprocess_Else_Match()
324
-    {
325
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
326
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
327
-        $object->define('test', 'blue');
328
-        $out = $object->preprocess('<?php
317
+	}
318
+
319
+	/**
320
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
321
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
322
+	 */
323
+	public function testPreprocess_Else_Match()
324
+	{
325
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
326
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
327
+		$object->define('test', 'blue');
328
+		$out = $object->preprocess('<?php
329 329
 			/**
330 330
 			 * @rest\if test red
331 331
 			 * @rest\whatever
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 			 */
336 336
 		');
337 337
 
338
-        $this->assertEquals('<?php
338
+		$this->assertEquals('<?php
339 339
 			/**
340 340
 			 * @!rest\if test red
341 341
 			 * @!rest\whatever
@@ -344,18 +344,18 @@  discard block
 block discarded – undo
344 344
 			 * @!rest\endif
345 345
 			 */
346 346
 		', $out);
347
-    }
348
-
349
-    /**
350
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
351
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
352
-     */
353
-    public function testPreprocess_Elif_Match()
354
-    {
355
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
356
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
357
-        $object->define('test', 'blue');
358
-        $out = $object->preprocess('<?php
347
+	}
348
+
349
+	/**
350
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
351
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
352
+	 */
353
+	public function testPreprocess_Elif_Match()
354
+	{
355
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
356
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
357
+		$object->define('test', 'blue');
358
+		$out = $object->preprocess('<?php
359 359
 			/**
360 360
 			 * @rest\if test red
361 361
 			 * @rest\whatever
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 			 */
368 368
 		');
369 369
 
370
-        $this->assertEquals('<?php
370
+		$this->assertEquals('<?php
371 371
 			/**
372 372
 			 * @!rest\if test red
373 373
 			 * @!rest\whatever
@@ -378,18 +378,18 @@  discard block
 block discarded – undo
378 378
 			 * @!rest\endif
379 379
 			 */
380 380
 		', $out);
381
-    }
382
-
383
-    /**
384
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
385
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
386
-     */
387
-    public function testPreprocess_Elif_NoValue()
388
-    {
389
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
390
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
391
-        $object->define('test', 'blue');
392
-        $out = $object->preprocess('<?php
381
+	}
382
+
383
+	/**
384
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
385
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
386
+	 */
387
+	public function testPreprocess_Elif_NoValue()
388
+	{
389
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
390
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
391
+		$object->define('test', 'blue');
392
+		$out = $object->preprocess('<?php
393 393
 			/**
394 394
 			 * @rest\if test red
395 395
 			 * @rest\whatever
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 			 */
402 402
 		');
403 403
 
404
-        $this->assertEquals('<?php
404
+		$this->assertEquals('<?php
405 405
 			/**
406 406
 			 * @!rest\if test red
407 407
 			 * @!rest\whatever
@@ -412,16 +412,16 @@  discard block
 block discarded – undo
412 412
 			 * @!rest\endif
413 413
 			 */
414 414
 		', $out);
415
-    }
415
+	}
416 416
 
417
-    /**
418
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
419
-     */
420
-    public function testPreprocess_Ifdef_AffectPrefixedOnly()
421
-    {
422
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
423
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
424
-        $out = $object->preprocess('<?php
417
+	/**
418
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
419
+	 */
420
+	public function testPreprocess_Ifdef_AffectPrefixedOnly()
421
+	{
422
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
423
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
424
+		$out = $object->preprocess('<?php
425 425
 			/**
426 426
 			 * @rest\ifdef test
427 427
 			 * @rest\whatever
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			 */
433 433
 		');
434 434
 
435
-        $this->assertEquals('<?php
435
+		$this->assertEquals('<?php
436 436
 			/**
437 437
 			 * @!rest\ifdef test
438 438
 			 * @!rest\whatever
@@ -442,20 +442,20 @@  discard block
 block discarded – undo
442 442
 			 * @!rest\endif
443 443
 			 */
444 444
 		', $out);
445
-    }
446
-
447
-    /**
448
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
449
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::undefine
450
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
451
-     */
452
-    public function testPreprocess_Undefine()
453
-    {
454
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
455
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
456
-        $object->define('test');
457
-        $object->undefine('test');
458
-        $out = $object->preprocess('<?php
445
+	}
446
+
447
+	/**
448
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
449
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::undefine
450
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
451
+	 */
452
+	public function testPreprocess_Undefine()
453
+	{
454
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
455
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
456
+		$object->define('test');
457
+		$object->undefine('test');
458
+		$out = $object->preprocess('<?php
459 459
 			/**
460 460
 			 * @rest\ifdef test
461 461
 			 * @rest\whatever
@@ -463,27 +463,27 @@  discard block
 block discarded – undo
463 463
 			 */
464 464
 		');
465 465
 
466
-        $this->assertEquals('<?php
466
+		$this->assertEquals('<?php
467 467
 			/**
468 468
 			 * @!rest\ifdef test
469 469
 			 * @!rest\whatever
470 470
 			 * @!rest\endif
471 471
 			 */
472 472
 		', $out);
473
-    }
474
-
475
-    /**
476
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
477
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::resetDefines
478
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
479
-     */
480
-    public function testPreprocess_ResetDefines()
481
-    {
482
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
483
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
484
-        $object->define('test');
485
-        $object->resetDefines();
486
-        $out = $object->preprocess('<?php
473
+	}
474
+
475
+	/**
476
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
477
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::resetDefines
478
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
479
+	 */
480
+	public function testPreprocess_ResetDefines()
481
+	{
482
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
483
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
484
+		$object->define('test');
485
+		$object->resetDefines();
486
+		$out = $object->preprocess('<?php
487 487
 			/**
488 488
 			 * @rest\ifdef test
489 489
 			 * @rest\whatever
@@ -491,25 +491,25 @@  discard block
 block discarded – undo
491 491
 			 */
492 492
 		');
493 493
 
494
-        $this->assertEquals('<?php
494
+		$this->assertEquals('<?php
495 495
 			/**
496 496
 			 * @!rest\ifdef test
497 497
 			 * @!rest\whatever
498 498
 			 * @!rest\endif
499 499
 			 */
500 500
 		', $out);
501
-    }
502
-
503
-    /**
504
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::addDefines
505
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
506
-     */
507
-    public function testPreprocess_AddDefines()
508
-    {
509
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
510
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
511
-        $object->addDefines(array('test' => true));
512
-        $out = $object->preprocess('<?php
501
+	}
502
+
503
+	/**
504
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::addDefines
505
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
506
+	 */
507
+	public function testPreprocess_AddDefines()
508
+	{
509
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
510
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
511
+		$object->addDefines(array('test' => true));
512
+		$out = $object->preprocess('<?php
513 513
 			/**
514 514
 			 * @rest\ifdef test
515 515
 			 * @rest\whatever
@@ -517,23 +517,23 @@  discard block
 block discarded – undo
517 517
 			 */
518 518
 		');
519 519
 
520
-        $this->assertEquals('<?php
520
+		$this->assertEquals('<?php
521 521
 			/**
522 522
 			 * @!rest\ifdef test
523 523
 			 * @rest\whatever
524 524
 			 * @!rest\endif
525 525
 			 */
526 526
 		', $out);
527
-    }
527
+	}
528 528
 
529
-    /**
530
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
531
-     */
532
-    public function testPreprocess_AlternativePrefix()
533
-    {
534
-        $object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
535
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
536
-        $out = $object->preprocess('<?php
529
+	/**
530
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocess
531
+	 */
532
+	public function testPreprocess_AlternativePrefix()
533
+	{
534
+		$object = new \SwaggerGen\Parser\Php\Preprocessor('foo');
535
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
536
+		$out = $object->preprocess('<?php
537 537
 			/**
538 538
 			 * @foo\ifdef test
539 539
 			 * @foo\whatever
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 			 */
543 543
 		');
544 544
 
545
-        $this->assertEquals('<?php
545
+		$this->assertEquals('<?php
546 546
 			/**
547 547
 			 * @!foo\ifdef test
548 548
 			 * @!foo\whatever
@@ -550,31 +550,31 @@  discard block
 block discarded – undo
550 550
 			 * @!foo\endif
551 551
 			 */
552 552
 		', $out);
553
-    }
553
+	}
554 554
 
555
-    /**
556
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::define
557
-     * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocessFile
558
-     */
559
-    public function testPreprocessFile()
560
-    {
561
-        $object = new \SwaggerGen\Parser\Php\Preprocessor();
562
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
563
-        $object->define('test');
555
+	/**
556
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::define
557
+	 * @covers \SwaggerGen\Parser\Php\Preprocessor::preprocessFile
558
+	 */
559
+	public function testPreprocessFile()
560
+	{
561
+		$object = new \SwaggerGen\Parser\Php\Preprocessor();
562
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Preprocessor', $object);
563
+		$object->define('test');
564 564
 
565
-        $out = $object->preprocessFile(__DIR__ . '/PreprocessorTest/testPreprocessFile.php');
565
+		$out = $object->preprocessFile(__DIR__ . '/PreprocessorTest/testPreprocessFile.php');
566 566
 
567
-        $this->assertEquals('<?php
567
+		$this->assertEquals('<?php
568 568
 
569 569
 /**
570 570
  * @!rest\ifdef test
571 571
  * @rest\whatever
572 572
  * @!rest\endif
573 573
  */', $out);
574
-    }
574
+	}
575 575
 
576
-    //@todo  preprocess($content) -> mingle with other PHP code
577
-    //@todo  preprocess($content) -> Condition within comment
578
-    //@todo  preprocess($content) -> Condition over comments
579
-    //@todo  preprocess($content) -> Condition over code
576
+	//@todo  preprocess($content) -> mingle with other PHP code
577
+	//@todo  preprocess($content) -> Condition within comment
578
+	//@todo  preprocess($content) -> Condition over comments
579
+	//@todo  preprocess($content) -> Condition over code
580 580
 }
Please login to merge, or discard this patch.
tests/Parser/Php/ParserTest.php 1 patch
Indentation   +510 added lines, -510 removed lines patch added patch discarded remove patch
@@ -8,515 +8,515 @@
 block discarded – undo
8 8
 class ParserTest extends TestCase
9 9
 {
10 10
 
11
-    /**
12
-     * @covers \SwaggerGen\Parser\Php\Parser::__construct
13
-     */
14
-    public function testConstructor_Empty()
15
-    {
16
-        $object = new Parser();
17
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
18
-    }
19
-
20
-    /**
21
-     * @covers \SwaggerGen\Parser\Php\Parser::__construct
22
-     */
23
-    public function testConstructor_Dirs()
24
-    {
25
-        $this->markTestIncomplete('Not yet implemented.');
26
-    }
27
-
28
-    /**
29
-     * @covers \SwaggerGen\Parser\Php\Parser::addDirs
30
-     */
31
-    public function testAddDirs()
32
-    {
33
-        $this->markTestIncomplete('Not yet implemented.');
34
-    }
35
-
36
-    /**
37
-     * Test all open-curlies are (ac-)counted for in functions
38
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
39
-     */
40
-    public function testParse_CurlyBraceFunction()
41
-    {
42
-        $object = new Parser();
43
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
44
-
45
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_CurlyBraceFunction.php');
46
-        $this->assertCount(6, $statements);
47
-        $this->assertStatement($statements[0], 'title', 'CurlyBraceFunction');
48
-    }
49
-
50
-    /**
51
-     * Test if the statement matches the expected values
52
-     * @param Statement $statement
53
-     * @param string $command
54
-     * @param string $data
55
-     */
56
-    private function assertStatement($statement, $command, $data = '')
57
-    {
58
-        $this->assertInstanceOf('\SwaggerGen\Statement', $statement);
59
-        $this->assertSame($command, $statement->getCommand());
60
-        $this->assertSame($data, $statement->getData());
61
-    }
62
-
63
-    /**
64
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
65
-     */
66
-    public function testParse_NoMethods()
67
-    {
68
-        $object = new Parser();
69
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
70
-
71
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_NoMethods.php');
72
-
73
-        $this->assertCount(2, $statements);
74
-
75
-        $this->assertStatement($statements[0], 'title', 'Some words');
76
-        $this->assertStatement($statements[1], 'version', '2');
77
-    }
78
-
79
-    /**
80
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
81
-     */
82
-    public function testParse_WithMethod()
83
-    {
84
-        $object = new Parser();
85
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
86
-
87
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_WithMethod.php');
88
-
89
-        $this->assertCount(4, $statements);
90
-
91
-        $this->assertStatement($statements[0], 'title', 'Some words');
92
-        $this->assertStatement($statements[1], 'version', '2');
93
-        $this->assertStatement($statements[2], 'description', 'some description');
94
-        $this->assertStatement($statements[3], 'method', 'get something');
95
-    }
96
-
97
-    /**
98
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
99
-     */
100
-    public function testParse_LineContinuation()
101
-    {
102
-        $object = new Parser();
103
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
104
-
105
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_LineContinuation.php');
106
-
107
-        $this->assertCount(2, $statements);
108
-
109
-        $this->assertStatement($statements[0], 'title', 'Some words');
110
-        $this->assertStatement($statements[1], 'description', 'About this strange little class');
111
-    }
112
-
113
-    /**
114
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
115
-     */
116
-    public function testParse_InClass()
117
-    {
118
-        $object = new Parser();
119
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
120
-
121
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_InClass.php');
122
-
123
-        $this->assertCount(3, $statements);
124
-
125
-        $this->assertStatement($statements[0], 'title', 'Some words');
126
-        $this->assertStatement($statements[1], 'description', 'Some description');
127
-        $this->assertStatement($statements[2], 'license', 'mit');
128
-    }
129
-
130
-    /**
131
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
132
-     */
133
-    public function testParse_CommentsTypes()
134
-    {
135
-        $object = new Parser();
136
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
137
-
138
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_CommentsTypes.php');
139
-
140
-        $this->assertCount(3, $statements);
141
-
142
-        $this->assertStatement($statements[0], 'title', 'Some words');
143
-        $this->assertStatement($statements[1], 'version', '2');
144
-        $this->assertStatement($statements[2], 'license', 'mit');
145
-    }
146
-
147
-    /**
148
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
149
-     */
150
-    public function testParse_MethodNonDoc()
151
-    {
152
-        $object = new Parser();
153
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
154
-
155
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_MethodNonDoc.php');
156
-
157
-        $this->assertCount(3, $statements);
158
-
159
-        $this->assertStatement($statements[0], 'title', 'Some words');
160
-        $this->assertStatement($statements[1], 'version', '2');
161
-        $this->assertStatement($statements[2], 'method', 'get something');
162
-    }
163
-
164
-    /**
165
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
166
-     */
167
-    public function testParse_InMethod()
168
-    {
169
-        $object = new Parser();
170
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
171
-
172
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_InMethod.php');
173
-
174
-        $this->assertCount(4, $statements);
175
-
176
-        $this->assertStatement($statements[0], 'title', 'Some words');
177
-        $this->assertStatement($statements[1], 'version', '2');
178
-        $this->assertStatement($statements[2], 'description', 'some description');
179
-        $this->assertStatement($statements[3], 'method', 'get something');
180
-    }
181
-
182
-    /**
183
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
184
-     */
185
-    public function testParse_AfterClass()
186
-    {
187
-        $object = new Parser();
188
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
189
-
190
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_AfterClass.php');
191
-
192
-        $this->assertCount(2, $statements);
193
-
194
-        $this->assertStatement($statements[0], 'license', 'mit');
195
-        $this->assertStatement($statements[1], 'title', 'Some words');
196
-    }
197
-
198
-    /**
199
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
200
-     */
201
-    public function testParse_Prefix()
202
-    {
203
-        $object = new Parser();
204
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
205
-
206
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Prefix.php');
207
-
208
-        $this->assertCount(1, $statements);
209
-
210
-        $this->assertStatement($statements[0], 'title', 'Some words');
211
-    }
212
-
213
-    /**
214
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
215
-     */
216
-    public function testParse_PropertyReadOnly()
217
-    {
218
-        $object = new Parser();
219
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
220
-
221
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyReadOnly.php');
222
-
223
-        $this->assertCount(4, $statements);
224
-
225
-        $this->assertStatement($statements[0], 'title', 'Some words');
226
-        $this->assertStatement($statements[1], 'version', '2');
227
-        $this->assertStatement($statements[2], 'definition', 'Foo');
228
-        $this->assertStatement($statements[3], 'property!', 'string bar');
229
-    }
230
-
231
-    /**
232
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
233
-     */
234
-    public function testParse_PropertyOptional()
235
-    {
236
-        $object = new Parser();
237
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
238
-
239
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyOptional.php');
240
-
241
-        $this->assertCount(4, $statements);
242
-
243
-        $this->assertStatement($statements[0], 'title', 'Some words');
244
-        $this->assertStatement($statements[1], 'version', '2');
245
-        $this->assertStatement($statements[2], 'definition', 'Foo');
246
-        $this->assertStatement($statements[3], 'property?', 'string bar');
247
-    }
248
-
249
-    /**
250
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
251
-     */
252
-    public function testParse_Minimal()
253
-    {
254
-        $object = new Parser();
255
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
256
-
257
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Minimal.php');
258
-
259
-        $this->assertCount(4, $statements);
260
-
261
-        $this->assertStatement($statements[0], 'title', 'Minimal');
262
-        $this->assertStatement($statements[1], 'api', 'MyApi Example');
263
-        $this->assertStatement($statements[2], 'endpoint', '/endpoint');
264
-        $this->assertStatement($statements[3], 'method', 'GET Something');
265
-    }
266
-
267
-    /**
268
-     * Tests FunctionName
269
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
270
-     */
271
-    public function testParse_SeeFunction()
272
-    {
273
-        $object = new Parser();
274
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
275
-
276
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeFunction.php');
277
-
278
-        $this->assertStatements(array(
279
-            array('api', 'MyApi Example'),
280
-            array('endpoint', '/endpoint'),
281
-            array('method', 'GET Something'),
282
-            array('error', '400'),
283
-        ), $statements);
284
-    }
285
-
286
-    /**
287
-     * Test if the statement matches the expected values
288
-     * @param array[] $expected
289
-     * @param SwaggerGen\Parser\Php\Statement[] $statements
290
-     */
291
-    private function assertStatements(array $expected, array $statements)
292
-    {
293
-        $this->assertCount(count($expected), $statements, join("\n", $statements));
294
-        foreach ($expected as $index => $command) {
295
-            $statement = $statements[$index];
296
-            $this->assertInstanceOf('\SwaggerGen\Statement', $statement);
297
-            $this->assertSame($command[0], $statement->getCommand());
298
-            $this->assertSame($command[1], $statement->getData());
299
-        }
300
-    }
301
-
302
-    /**
303
-     * Tests $this->MethodName
304
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
305
-     */
306
-    public function testParse_SeeThisMethod()
307
-    {
308
-        $object = new Parser();
309
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
310
-
311
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeThisMethod.php');
312
-
313
-        $this->assertStatements(array(
314
-            array('api', 'MyApi Example'),
315
-            array('endpoint', '/endpoint'),
316
-            array('method', 'GET Something'),
317
-            array('error', '400'),
318
-        ), $statements);
319
-    }
320
-
321
-    /**
322
-     * Tests Class->MethodName
323
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
324
-     */
325
-    public function testParse_SeeObjectMethod()
326
-    {
327
-        $object = new Parser();
328
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
329
-
330
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeObjectMethod.php');
331
-
332
-        $this->assertStatements(array(
333
-            array('api', 'MyApi Example'),
334
-            array('endpoint', '/endpoint'),
335
-            array('method', 'GET Something'),
336
-            array('error', '400'),
337
-        ), $statements);
338
-    }
339
-
340
-    /**
341
-     * Tests self::MethodName
342
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
343
-     */
344
-    public function testParse_SeeSelfMethod()
345
-    {
346
-        $object = new Parser();
347
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
348
-
349
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeSelfMethod.php');
350
-
351
-        $this->assertStatements(array(
352
-            array('api', 'MyApi Example'),
353
-            array('endpoint', '/endpoint'),
354
-            array('method', 'GET Something'),
355
-            array('error', '400'),
356
-        ), $statements);
357
-    }
358
-
359
-    /**
360
-     * Tests Class::MethodName
361
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
362
-     */
363
-    public function testParse_SeeClassMethod()
364
-    {
365
-        $object = new Parser();
366
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
367
-
368
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeClassMethod.php');
369
-
370
-        $this->assertStatements(array(
371
-            array('api', 'MyApi Example'),
372
-            array('endpoint', '/endpoint'),
373
-            array('method', 'GET Something'),
374
-            array('error', '400'),
375
-        ), $statements);
376
-    }
377
-
378
-    /**
379
-     * Tests static::MethodName
380
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
381
-     */
382
-    public function testParse_StaticMethod()
383
-    {
384
-        $object = new Parser();
385
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
386
-
387
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_StaticMethod.php');
388
-
389
-        $this->assertStatements(array(
390
-            array('api', 'MyApi Example'),
391
-            array('endpoint', '/endpoint'),
392
-            array('method', 'GET Something'),
393
-            array('error', '400'),
394
-        ), $statements);
395
-    }
396
-
397
-    /**
398
-     * Tests $this->MethodName with inheritance
399
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
400
-     */
401
-    public function testParse_SeeInheritedThisMethod()
402
-    {
403
-        $object = new Parser();
404
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
405
-
406
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedThisMethod.php');
407
-
408
-        $this->assertStatements(array(
409
-            array('api', 'MyApi Example'),
410
-            array('endpoint', '/endpoint'),
411
-            array('method', 'GET Something'),
412
-            array('error', '400'),
413
-        ), $statements);
414
-    }
415
-
416
-    /**
417
-     * Tests Class->MethodName with inheritance
418
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
419
-     */
420
-    public function testParse_SeeInheritedObjectMethod()
421
-    {
422
-        $object = new Parser();
423
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
424
-
425
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedObjectMethod.php');
426
-
427
-        $this->assertStatements(array(
428
-            array('api', 'MyApi Example'),
429
-            array('endpoint', '/endpoint'),
430
-            array('method', 'GET Something'),
431
-            array('error', '400'),
432
-        ), $statements);
433
-    }
434
-
435
-    /**
436
-     * Tests Autoloading other class when referenced
437
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
438
-     */
439
-    public function testParse_Autoload_Parse()
440
-    {
441
-        $object = new Parser();
442
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
443
-
444
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php', array(
445
-            __DIR__ . '/ParserTest',
446
-        ));
447
-
448
-        $this->assertStatements(array(
449
-            array('api', 'MyApi Example'),
450
-            array('endpoint', '/endpoint'),
451
-            array('method', 'GET Something'),
452
-            array('error', '400'),
453
-        ), $statements);
454
-    }
455
-
456
-    /**
457
-     * Tests Autoloading other class when referenced
458
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
459
-     */
460
-    public function testParse_Autoload_Construct()
461
-    {
462
-        $object = new Parser(array(
463
-            __DIR__ . '/ParserTest',
464
-        ));
465
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
466
-
467
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
468
-
469
-        $this->assertStatements(array(
470
-            array('api', 'MyApi Example'),
471
-            array('endpoint', '/endpoint'),
472
-            array('method', 'GET Something'),
473
-            array('error', '400'),
474
-        ), $statements);
475
-    }
476
-
477
-    /**
478
-     * Tests Autoloading other class when referenced
479
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
480
-     */
481
-    public function testParse_Autoload_AddDirs()
482
-    {
483
-        $object = new Parser();
484
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
485
-
486
-        $object->addDirs(array(
487
-            __DIR__ . '/ParserTest',
488
-        ));
489
-
490
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
491
-
492
-        $this->assertStatements(array(
493
-            array('api', 'MyApi Example'),
494
-            array('endpoint', '/endpoint'),
495
-            array('method', 'GET Something'),
496
-            array('error', '400'),
497
-        ), $statements);
498
-    }
499
-
500
-    /**
501
-     * @covers \SwaggerGen\Parser\Php\Parser::parse
502
-     */
503
-    public function testParse_XTag()
504
-    {
505
-        $object = new Parser();
506
-        $this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
507
-
508
-        $object->addDirs(array(
509
-            __DIR__ . '/ParserTest',
510
-        ));
511
-
512
-        $statements = $object->parse(__DIR__ . '/ParserTest/testParse_XTag.php');
513
-
514
-        $this->assertStatements(array(
515
-            array('api', 'MyApi Example'),
516
-            array('endpoint', '/endpoint'),
517
-            array('x-something', 'else'),
518
-            array('method', 'GET Something'),
519
-        ), $statements);
520
-    }
11
+	/**
12
+	 * @covers \SwaggerGen\Parser\Php\Parser::__construct
13
+	 */
14
+	public function testConstructor_Empty()
15
+	{
16
+		$object = new Parser();
17
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
18
+	}
19
+
20
+	/**
21
+	 * @covers \SwaggerGen\Parser\Php\Parser::__construct
22
+	 */
23
+	public function testConstructor_Dirs()
24
+	{
25
+		$this->markTestIncomplete('Not yet implemented.');
26
+	}
27
+
28
+	/**
29
+	 * @covers \SwaggerGen\Parser\Php\Parser::addDirs
30
+	 */
31
+	public function testAddDirs()
32
+	{
33
+		$this->markTestIncomplete('Not yet implemented.');
34
+	}
35
+
36
+	/**
37
+	 * Test all open-curlies are (ac-)counted for in functions
38
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
39
+	 */
40
+	public function testParse_CurlyBraceFunction()
41
+	{
42
+		$object = new Parser();
43
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
44
+
45
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_CurlyBraceFunction.php');
46
+		$this->assertCount(6, $statements);
47
+		$this->assertStatement($statements[0], 'title', 'CurlyBraceFunction');
48
+	}
49
+
50
+	/**
51
+	 * Test if the statement matches the expected values
52
+	 * @param Statement $statement
53
+	 * @param string $command
54
+	 * @param string $data
55
+	 */
56
+	private function assertStatement($statement, $command, $data = '')
57
+	{
58
+		$this->assertInstanceOf('\SwaggerGen\Statement', $statement);
59
+		$this->assertSame($command, $statement->getCommand());
60
+		$this->assertSame($data, $statement->getData());
61
+	}
62
+
63
+	/**
64
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
65
+	 */
66
+	public function testParse_NoMethods()
67
+	{
68
+		$object = new Parser();
69
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
70
+
71
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_NoMethods.php');
72
+
73
+		$this->assertCount(2, $statements);
74
+
75
+		$this->assertStatement($statements[0], 'title', 'Some words');
76
+		$this->assertStatement($statements[1], 'version', '2');
77
+	}
78
+
79
+	/**
80
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
81
+	 */
82
+	public function testParse_WithMethod()
83
+	{
84
+		$object = new Parser();
85
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
86
+
87
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_WithMethod.php');
88
+
89
+		$this->assertCount(4, $statements);
90
+
91
+		$this->assertStatement($statements[0], 'title', 'Some words');
92
+		$this->assertStatement($statements[1], 'version', '2');
93
+		$this->assertStatement($statements[2], 'description', 'some description');
94
+		$this->assertStatement($statements[3], 'method', 'get something');
95
+	}
96
+
97
+	/**
98
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
99
+	 */
100
+	public function testParse_LineContinuation()
101
+	{
102
+		$object = new Parser();
103
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
104
+
105
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_LineContinuation.php');
106
+
107
+		$this->assertCount(2, $statements);
108
+
109
+		$this->assertStatement($statements[0], 'title', 'Some words');
110
+		$this->assertStatement($statements[1], 'description', 'About this strange little class');
111
+	}
112
+
113
+	/**
114
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
115
+	 */
116
+	public function testParse_InClass()
117
+	{
118
+		$object = new Parser();
119
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
120
+
121
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_InClass.php');
122
+
123
+		$this->assertCount(3, $statements);
124
+
125
+		$this->assertStatement($statements[0], 'title', 'Some words');
126
+		$this->assertStatement($statements[1], 'description', 'Some description');
127
+		$this->assertStatement($statements[2], 'license', 'mit');
128
+	}
129
+
130
+	/**
131
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
132
+	 */
133
+	public function testParse_CommentsTypes()
134
+	{
135
+		$object = new Parser();
136
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
137
+
138
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_CommentsTypes.php');
139
+
140
+		$this->assertCount(3, $statements);
141
+
142
+		$this->assertStatement($statements[0], 'title', 'Some words');
143
+		$this->assertStatement($statements[1], 'version', '2');
144
+		$this->assertStatement($statements[2], 'license', 'mit');
145
+	}
146
+
147
+	/**
148
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
149
+	 */
150
+	public function testParse_MethodNonDoc()
151
+	{
152
+		$object = new Parser();
153
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
154
+
155
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_MethodNonDoc.php');
156
+
157
+		$this->assertCount(3, $statements);
158
+
159
+		$this->assertStatement($statements[0], 'title', 'Some words');
160
+		$this->assertStatement($statements[1], 'version', '2');
161
+		$this->assertStatement($statements[2], 'method', 'get something');
162
+	}
163
+
164
+	/**
165
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
166
+	 */
167
+	public function testParse_InMethod()
168
+	{
169
+		$object = new Parser();
170
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
171
+
172
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_InMethod.php');
173
+
174
+		$this->assertCount(4, $statements);
175
+
176
+		$this->assertStatement($statements[0], 'title', 'Some words');
177
+		$this->assertStatement($statements[1], 'version', '2');
178
+		$this->assertStatement($statements[2], 'description', 'some description');
179
+		$this->assertStatement($statements[3], 'method', 'get something');
180
+	}
181
+
182
+	/**
183
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
184
+	 */
185
+	public function testParse_AfterClass()
186
+	{
187
+		$object = new Parser();
188
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
189
+
190
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_AfterClass.php');
191
+
192
+		$this->assertCount(2, $statements);
193
+
194
+		$this->assertStatement($statements[0], 'license', 'mit');
195
+		$this->assertStatement($statements[1], 'title', 'Some words');
196
+	}
197
+
198
+	/**
199
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
200
+	 */
201
+	public function testParse_Prefix()
202
+	{
203
+		$object = new Parser();
204
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
205
+
206
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Prefix.php');
207
+
208
+		$this->assertCount(1, $statements);
209
+
210
+		$this->assertStatement($statements[0], 'title', 'Some words');
211
+	}
212
+
213
+	/**
214
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
215
+	 */
216
+	public function testParse_PropertyReadOnly()
217
+	{
218
+		$object = new Parser();
219
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
220
+
221
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyReadOnly.php');
222
+
223
+		$this->assertCount(4, $statements);
224
+
225
+		$this->assertStatement($statements[0], 'title', 'Some words');
226
+		$this->assertStatement($statements[1], 'version', '2');
227
+		$this->assertStatement($statements[2], 'definition', 'Foo');
228
+		$this->assertStatement($statements[3], 'property!', 'string bar');
229
+	}
230
+
231
+	/**
232
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
233
+	 */
234
+	public function testParse_PropertyOptional()
235
+	{
236
+		$object = new Parser();
237
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
238
+
239
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_PropertyOptional.php');
240
+
241
+		$this->assertCount(4, $statements);
242
+
243
+		$this->assertStatement($statements[0], 'title', 'Some words');
244
+		$this->assertStatement($statements[1], 'version', '2');
245
+		$this->assertStatement($statements[2], 'definition', 'Foo');
246
+		$this->assertStatement($statements[3], 'property?', 'string bar');
247
+	}
248
+
249
+	/**
250
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
251
+	 */
252
+	public function testParse_Minimal()
253
+	{
254
+		$object = new Parser();
255
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
256
+
257
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Minimal.php');
258
+
259
+		$this->assertCount(4, $statements);
260
+
261
+		$this->assertStatement($statements[0], 'title', 'Minimal');
262
+		$this->assertStatement($statements[1], 'api', 'MyApi Example');
263
+		$this->assertStatement($statements[2], 'endpoint', '/endpoint');
264
+		$this->assertStatement($statements[3], 'method', 'GET Something');
265
+	}
266
+
267
+	/**
268
+	 * Tests FunctionName
269
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
270
+	 */
271
+	public function testParse_SeeFunction()
272
+	{
273
+		$object = new Parser();
274
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
275
+
276
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeFunction.php');
277
+
278
+		$this->assertStatements(array(
279
+			array('api', 'MyApi Example'),
280
+			array('endpoint', '/endpoint'),
281
+			array('method', 'GET Something'),
282
+			array('error', '400'),
283
+		), $statements);
284
+	}
285
+
286
+	/**
287
+	 * Test if the statement matches the expected values
288
+	 * @param array[] $expected
289
+	 * @param SwaggerGen\Parser\Php\Statement[] $statements
290
+	 */
291
+	private function assertStatements(array $expected, array $statements)
292
+	{
293
+		$this->assertCount(count($expected), $statements, join("\n", $statements));
294
+		foreach ($expected as $index => $command) {
295
+			$statement = $statements[$index];
296
+			$this->assertInstanceOf('\SwaggerGen\Statement', $statement);
297
+			$this->assertSame($command[0], $statement->getCommand());
298
+			$this->assertSame($command[1], $statement->getData());
299
+		}
300
+	}
301
+
302
+	/**
303
+	 * Tests $this->MethodName
304
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
305
+	 */
306
+	public function testParse_SeeThisMethod()
307
+	{
308
+		$object = new Parser();
309
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
310
+
311
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeThisMethod.php');
312
+
313
+		$this->assertStatements(array(
314
+			array('api', 'MyApi Example'),
315
+			array('endpoint', '/endpoint'),
316
+			array('method', 'GET Something'),
317
+			array('error', '400'),
318
+		), $statements);
319
+	}
320
+
321
+	/**
322
+	 * Tests Class->MethodName
323
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
324
+	 */
325
+	public function testParse_SeeObjectMethod()
326
+	{
327
+		$object = new Parser();
328
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
329
+
330
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeObjectMethod.php');
331
+
332
+		$this->assertStatements(array(
333
+			array('api', 'MyApi Example'),
334
+			array('endpoint', '/endpoint'),
335
+			array('method', 'GET Something'),
336
+			array('error', '400'),
337
+		), $statements);
338
+	}
339
+
340
+	/**
341
+	 * Tests self::MethodName
342
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
343
+	 */
344
+	public function testParse_SeeSelfMethod()
345
+	{
346
+		$object = new Parser();
347
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
348
+
349
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeSelfMethod.php');
350
+
351
+		$this->assertStatements(array(
352
+			array('api', 'MyApi Example'),
353
+			array('endpoint', '/endpoint'),
354
+			array('method', 'GET Something'),
355
+			array('error', '400'),
356
+		), $statements);
357
+	}
358
+
359
+	/**
360
+	 * Tests Class::MethodName
361
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
362
+	 */
363
+	public function testParse_SeeClassMethod()
364
+	{
365
+		$object = new Parser();
366
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
367
+
368
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeClassMethod.php');
369
+
370
+		$this->assertStatements(array(
371
+			array('api', 'MyApi Example'),
372
+			array('endpoint', '/endpoint'),
373
+			array('method', 'GET Something'),
374
+			array('error', '400'),
375
+		), $statements);
376
+	}
377
+
378
+	/**
379
+	 * Tests static::MethodName
380
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
381
+	 */
382
+	public function testParse_StaticMethod()
383
+	{
384
+		$object = new Parser();
385
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
386
+
387
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_StaticMethod.php');
388
+
389
+		$this->assertStatements(array(
390
+			array('api', 'MyApi Example'),
391
+			array('endpoint', '/endpoint'),
392
+			array('method', 'GET Something'),
393
+			array('error', '400'),
394
+		), $statements);
395
+	}
396
+
397
+	/**
398
+	 * Tests $this->MethodName with inheritance
399
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
400
+	 */
401
+	public function testParse_SeeInheritedThisMethod()
402
+	{
403
+		$object = new Parser();
404
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
405
+
406
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedThisMethod.php');
407
+
408
+		$this->assertStatements(array(
409
+			array('api', 'MyApi Example'),
410
+			array('endpoint', '/endpoint'),
411
+			array('method', 'GET Something'),
412
+			array('error', '400'),
413
+		), $statements);
414
+	}
415
+
416
+	/**
417
+	 * Tests Class->MethodName with inheritance
418
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
419
+	 */
420
+	public function testParse_SeeInheritedObjectMethod()
421
+	{
422
+		$object = new Parser();
423
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
424
+
425
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_SeeInheritedObjectMethod.php');
426
+
427
+		$this->assertStatements(array(
428
+			array('api', 'MyApi Example'),
429
+			array('endpoint', '/endpoint'),
430
+			array('method', 'GET Something'),
431
+			array('error', '400'),
432
+		), $statements);
433
+	}
434
+
435
+	/**
436
+	 * Tests Autoloading other class when referenced
437
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
438
+	 */
439
+	public function testParse_Autoload_Parse()
440
+	{
441
+		$object = new Parser();
442
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
443
+
444
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php', array(
445
+			__DIR__ . '/ParserTest',
446
+		));
447
+
448
+		$this->assertStatements(array(
449
+			array('api', 'MyApi Example'),
450
+			array('endpoint', '/endpoint'),
451
+			array('method', 'GET Something'),
452
+			array('error', '400'),
453
+		), $statements);
454
+	}
455
+
456
+	/**
457
+	 * Tests Autoloading other class when referenced
458
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
459
+	 */
460
+	public function testParse_Autoload_Construct()
461
+	{
462
+		$object = new Parser(array(
463
+			__DIR__ . '/ParserTest',
464
+		));
465
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
466
+
467
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
468
+
469
+		$this->assertStatements(array(
470
+			array('api', 'MyApi Example'),
471
+			array('endpoint', '/endpoint'),
472
+			array('method', 'GET Something'),
473
+			array('error', '400'),
474
+		), $statements);
475
+	}
476
+
477
+	/**
478
+	 * Tests Autoloading other class when referenced
479
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
480
+	 */
481
+	public function testParse_Autoload_AddDirs()
482
+	{
483
+		$object = new Parser();
484
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
485
+
486
+		$object->addDirs(array(
487
+			__DIR__ . '/ParserTest',
488
+		));
489
+
490
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_Autoload.php');
491
+
492
+		$this->assertStatements(array(
493
+			array('api', 'MyApi Example'),
494
+			array('endpoint', '/endpoint'),
495
+			array('method', 'GET Something'),
496
+			array('error', '400'),
497
+		), $statements);
498
+	}
499
+
500
+	/**
501
+	 * @covers \SwaggerGen\Parser\Php\Parser::parse
502
+	 */
503
+	public function testParse_XTag()
504
+	{
505
+		$object = new Parser();
506
+		$this->assertInstanceOf('\SwaggerGen\Parser\Php\Parser', $object);
507
+
508
+		$object->addDirs(array(
509
+			__DIR__ . '/ParserTest',
510
+		));
511
+
512
+		$statements = $object->parse(__DIR__ . '/ParserTest/testParse_XTag.php');
513
+
514
+		$this->assertStatements(array(
515
+			array('api', 'MyApi Example'),
516
+			array('endpoint', '/endpoint'),
517
+			array('x-something', 'else'),
518
+			array('method', 'GET Something'),
519
+		), $statements);
520
+	}
521 521
 
522 522
 }
Please login to merge, or discard this patch.
tests/Swagger/SchemaTest.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -6,138 +6,138 @@
 block discarded – undo
6 6
 class SchemaTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Schema::__construct
13
-     */
14
-    public function testConstructorEmpty()
15
-    {
16
-        $object = new \SwaggerGen\Swagger\Schema($this->parent);
17
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
18
-
19
-        $this->assertSame(array(
20
-            'type' => 'object',
21
-        ), $object->toArray());
22
-    }
23
-
24
-    /**
25
-     * @covers \SwaggerGen\Swagger\Schema::__construct
26
-     */
27
-    public function testConstructorType()
28
-    {
29
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
30
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
31
-
32
-        $this->assertSame(array(
33
-            'type' => 'integer',
34
-            'format' => 'int32',
35
-        ), $object->toArray());
36
-    }
37
-
38
-    /**
39
-     * @covers \SwaggerGen\Swagger\Schema::__construct
40
-     */
41
-    public function testConstructorReference()
42
-    {
43
-        $this->parent->handleCommand('model', 'User');
44
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'User');
45
-
46
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
47
-
48
-        $this->assertSame(array(
49
-            '$ref' => '#/definitions/User',
50
-        ), $object->toArray());
51
-    }
52
-
53
-    /**
54
-     * @covers \SwaggerGen\Swagger\Schema::__construct
55
-     */
56
-    public function testConstructorEmptyDescription()
57
-    {
58
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', '');
59
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
60
-
61
-        $this->assertSame(array(
62
-            'type' => 'integer',
63
-            'format' => 'int32',
64
-        ), $object->toArray());
65
-    }
66
-
67
-    /**
68
-     * @covers \SwaggerGen\Swagger\Schema::__construct
69
-     */
70
-    public function testConstructorDescription()
71
-    {
72
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', 'Some more words');
73
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
74
-
75
-        $this->assertSame(array(
76
-            'type' => 'integer',
77
-            'format' => 'int32',
78
-            'description' => 'Some more words',
79
-        ), $object->toArray());
80
-    }
81
-
82
-    /**
83
-     * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
84
-     */
85
-    public function testCommandPassing()
86
-    {
87
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
88
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
89
-
90
-        $object->handleCommand('default', '123');
91
-
92
-        $this->assertSame(array(
93
-            'type' => 'integer',
94
-            'format' => 'int32',
95
-            'default' => 123,
96
-        ), $object->toArray());
97
-    }
98
-
99
-    /**
100
-     * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
101
-     */
102
-    public function testCommand_Description()
103
-    {
104
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
105
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
106
-
107
-        $object->handleCommand('description', 'Some words');
108
-
109
-        $this->assertSame(array(
110
-            'type' => 'integer',
111
-            'format' => 'int32',
112
-            'description' => 'Some words',
113
-        ), $object->toArray());
114
-    }
115
-
116
-    /**
117
-     * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
118
-     */
119
-    public function testCommand_Title()
120
-    {
121
-        $object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
122
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
123
-
124
-        $object->handleCommand('title', 'Title words');
125
-
126
-        $this->assertSame(array(
127
-            'type' => 'integer',
128
-            'format' => 'int32',
129
-            'title' => 'Title words',
130
-        ), $object->toArray());
131
-    }
132
-
133
-    protected function setUp(): void
134
-    {
135
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
136
-    }
137
-
138
-    protected function assertPreConditions(): void
139
-    {
140
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
141
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
13
+	 */
14
+	public function testConstructorEmpty()
15
+	{
16
+		$object = new \SwaggerGen\Swagger\Schema($this->parent);
17
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
18
+
19
+		$this->assertSame(array(
20
+			'type' => 'object',
21
+		), $object->toArray());
22
+	}
23
+
24
+	/**
25
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
26
+	 */
27
+	public function testConstructorType()
28
+	{
29
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
30
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
31
+
32
+		$this->assertSame(array(
33
+			'type' => 'integer',
34
+			'format' => 'int32',
35
+		), $object->toArray());
36
+	}
37
+
38
+	/**
39
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
40
+	 */
41
+	public function testConstructorReference()
42
+	{
43
+		$this->parent->handleCommand('model', 'User');
44
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'User');
45
+
46
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
47
+
48
+		$this->assertSame(array(
49
+			'$ref' => '#/definitions/User',
50
+		), $object->toArray());
51
+	}
52
+
53
+	/**
54
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
55
+	 */
56
+	public function testConstructorEmptyDescription()
57
+	{
58
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', '');
59
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
60
+
61
+		$this->assertSame(array(
62
+			'type' => 'integer',
63
+			'format' => 'int32',
64
+		), $object->toArray());
65
+	}
66
+
67
+	/**
68
+	 * @covers \SwaggerGen\Swagger\Schema::__construct
69
+	 */
70
+	public function testConstructorDescription()
71
+	{
72
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int', 'Some more words');
73
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
74
+
75
+		$this->assertSame(array(
76
+			'type' => 'integer',
77
+			'format' => 'int32',
78
+			'description' => 'Some more words',
79
+		), $object->toArray());
80
+	}
81
+
82
+	/**
83
+	 * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
84
+	 */
85
+	public function testCommandPassing()
86
+	{
87
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
88
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
89
+
90
+		$object->handleCommand('default', '123');
91
+
92
+		$this->assertSame(array(
93
+			'type' => 'integer',
94
+			'format' => 'int32',
95
+			'default' => 123,
96
+		), $object->toArray());
97
+	}
98
+
99
+	/**
100
+	 * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
101
+	 */
102
+	public function testCommand_Description()
103
+	{
104
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
105
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
106
+
107
+		$object->handleCommand('description', 'Some words');
108
+
109
+		$this->assertSame(array(
110
+			'type' => 'integer',
111
+			'format' => 'int32',
112
+			'description' => 'Some words',
113
+		), $object->toArray());
114
+	}
115
+
116
+	/**
117
+	 * @covers \SwaggerGen\Swagger\Type\Schema->handleCommand
118
+	 */
119
+	public function testCommand_Title()
120
+	{
121
+		$object = new \SwaggerGen\Swagger\Schema($this->parent, 'int');
122
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Schema', $object);
123
+
124
+		$object->handleCommand('title', 'Title words');
125
+
126
+		$this->assertSame(array(
127
+			'type' => 'integer',
128
+			'format' => 'int32',
129
+			'title' => 'Title words',
130
+		), $object->toArray());
131
+	}
132
+
133
+	protected function setUp(): void
134
+	{
135
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
136
+	}
137
+
138
+	protected function assertPreConditions(): void
139
+	{
140
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
141
+	}
142 142
 
143 143
 }
Please login to merge, or discard this patch.
tests/Swagger/HeaderTest.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -7,99 +7,99 @@
 block discarded – undo
7 7
 class HeaderTest extends TestCase
8 8
 {
9 9
 
10
-    protected $parent;
11
-
12
-    /**
13
-     * @covers \SwaggerGen\Swagger\Header::__construct
14
-     */
15
-    public function testConstructorType(): void
16
-    {
17
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
18
-
19
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
20
-
21
-        $this->assertSame(array(
22
-            'type' => 'integer',
23
-        ), $object->toArray());
24
-    }
25
-
26
-    /**
27
-     * @covers \SwaggerGen\Swagger\Header::__construct
28
-     */
29
-    public function testConstructorInvalidType()
30
-    {
31
-        $this->expectException('\SwaggerGen\Exception', "Header type not valid: 'BadType'");
32
-
33
-        new \SwaggerGen\Swagger\Header($this->parent, 'BadType');
34
-    }
35
-
36
-    /**
37
-     * @covers \SwaggerGen\Swagger\Header::__construct
38
-     */
39
-    public function testConstructorNoDescription()
40
-    {
41
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
42
-
43
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
44
-
45
-        $this->assertSame(array(
46
-            'type' => 'integer',
47
-        ), $object->toArray());
48
-    }
49
-
50
-    /**
51
-     * @covers \SwaggerGen\Swagger\Header::__construct
52
-     */
53
-    public function testConstructorBlankDescription()
54
-    {
55
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', '');
56
-
57
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
58
-
59
-        $this->assertSame(array(
60
-            'type' => 'integer',
61
-        ), $object->toArray());
62
-    }
63
-
64
-    /**
65
-     * @covers \SwaggerGen\Swagger\Header::__construct
66
-     */
67
-    public function testConstructorFull()
68
-    {
69
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
70
-
71
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
72
-
73
-        $this->assertSame(array(
74
-            'type' => 'integer',
75
-            'description' => 'descriptive text',
76
-        ), $object->toArray());
77
-    }
78
-
79
-    /**
80
-     * @covers \SwaggerGen\Swagger\Header->handleCommand
81
-     */
82
-    public function testCommandDescription()
83
-    {
84
-        $object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
85
-
86
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
87
-
88
-        $object->handleCommand('description', 'Some other lines');
89
-
90
-        $this->assertSame(array(
91
-            'type' => 'integer',
92
-            'description' => 'Some other lines',
93
-        ), $object->toArray());
94
-    }
95
-
96
-    protected function setUp(): void
97
-    {
98
-        $this->parent = $this->getMockForAbstractClass(AbstractObject::class);
99
-    }
100
-
101
-    protected function assertPreConditions(): void
102
-    {
103
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
104
-    }
10
+	protected $parent;
11
+
12
+	/**
13
+	 * @covers \SwaggerGen\Swagger\Header::__construct
14
+	 */
15
+	public function testConstructorType(): void
16
+	{
17
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
18
+
19
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
20
+
21
+		$this->assertSame(array(
22
+			'type' => 'integer',
23
+		), $object->toArray());
24
+	}
25
+
26
+	/**
27
+	 * @covers \SwaggerGen\Swagger\Header::__construct
28
+	 */
29
+	public function testConstructorInvalidType()
30
+	{
31
+		$this->expectException('\SwaggerGen\Exception', "Header type not valid: 'BadType'");
32
+
33
+		new \SwaggerGen\Swagger\Header($this->parent, 'BadType');
34
+	}
35
+
36
+	/**
37
+	 * @covers \SwaggerGen\Swagger\Header::__construct
38
+	 */
39
+	public function testConstructorNoDescription()
40
+	{
41
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer');
42
+
43
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
44
+
45
+		$this->assertSame(array(
46
+			'type' => 'integer',
47
+		), $object->toArray());
48
+	}
49
+
50
+	/**
51
+	 * @covers \SwaggerGen\Swagger\Header::__construct
52
+	 */
53
+	public function testConstructorBlankDescription()
54
+	{
55
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', '');
56
+
57
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
58
+
59
+		$this->assertSame(array(
60
+			'type' => 'integer',
61
+		), $object->toArray());
62
+	}
63
+
64
+	/**
65
+	 * @covers \SwaggerGen\Swagger\Header::__construct
66
+	 */
67
+	public function testConstructorFull()
68
+	{
69
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
70
+
71
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
72
+
73
+		$this->assertSame(array(
74
+			'type' => 'integer',
75
+			'description' => 'descriptive text',
76
+		), $object->toArray());
77
+	}
78
+
79
+	/**
80
+	 * @covers \SwaggerGen\Swagger\Header->handleCommand
81
+	 */
82
+	public function testCommandDescription()
83
+	{
84
+		$object = new \SwaggerGen\Swagger\Header($this->parent, 'integer', 'descriptive text');
85
+
86
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Header', $object);
87
+
88
+		$object->handleCommand('description', 'Some other lines');
89
+
90
+		$this->assertSame(array(
91
+			'type' => 'integer',
92
+			'description' => 'Some other lines',
93
+		), $object->toArray());
94
+	}
95
+
96
+	protected function setUp(): void
97
+	{
98
+		$this->parent = $this->getMockForAbstractClass(AbstractObject::class);
99
+	}
100
+
101
+	protected function assertPreConditions(): void
102
+	{
103
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
104
+	}
105 105
 }
Please login to merge, or discard this patch.
tests/Swagger/TagTest.php 1 patch
Indentation   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -6,108 +6,108 @@
 block discarded – undo
6 6
 class TagTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Tag::__construct
13
-     * @covers \SwaggerGen\Swagger\License::toArray
14
-     */
15
-    public function testConstructor2()
16
-    {
17
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
18
-
19
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
20
-
21
-        $this->assertSame(array(
22
-            'name' => 'Name',
23
-        ), $object->toArray());
24
-    }
25
-
26
-    /**
27
-     * @covers \SwaggerGen\Swagger\Tag::__construct
28
-     * @covers \SwaggerGen\Swagger\License::toArray
29
-     */
30
-    public function testConstructor_Description_Empty()
31
-    {
32
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', '');
33
-
34
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
35
-
36
-        $this->assertSame(array(
37
-            'name' => 'Name',
38
-        ), $object->toArray());
39
-    }
40
-
41
-    /**
42
-     * @covers \SwaggerGen\Swagger\Tag::__construct
43
-     * @covers \SwaggerGen\Swagger\License::toArray
44
-     */
45
-    public function testConstructor3()
46
-    {
47
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
48
-
49
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
50
-
51
-        $this->assertSame(array(
52
-            'name' => 'Name',
53
-            'description' => 'Description',
54
-        ), $object->toArray());
55
-    }
56
-
57
-    /**
58
-     * @covers \SwaggerGen\Swagger\Tag::getName
59
-     */
60
-    public function testGetName()
61
-    {
62
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
63
-
64
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
65
-
66
-        $this->assertSame('Name', $object->getName());
67
-    }
68
-
69
-    /**
70
-     * @covers \SwaggerGen\Swagger\Tag::handleCommand
71
-     */
72
-    public function testCommandDescription()
73
-    {
74
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
75
-
76
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
77
-
78
-        $object->handleCommand('description', 'Command Description');
79
-
80
-        $this->assertSame(array(
81
-            'name' => 'Name',
82
-            'description' => 'Command Description',
83
-        ), $object->toArray());
84
-    }
85
-
86
-    /**
87
-     * @covers \SwaggerGen\Swagger\Tag::handleCommand
88
-     */
89
-    public function testCommandDescriptionOverwrite()
90
-    {
91
-        $object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
92
-
93
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
94
-
95
-        $object->handleCommand('description', 'Command Description');
96
-
97
-        $this->assertSame(array(
98
-            'name' => 'Name',
99
-            'description' => 'Command Description',
100
-        ), $object->toArray());
101
-    }
102
-
103
-    protected function setUp(): void
104
-    {
105
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
106
-    }
107
-
108
-    protected function assertPreConditions(): void
109
-    {
110
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
111
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
13
+	 * @covers \SwaggerGen\Swagger\License::toArray
14
+	 */
15
+	public function testConstructor2()
16
+	{
17
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
18
+
19
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
20
+
21
+		$this->assertSame(array(
22
+			'name' => 'Name',
23
+		), $object->toArray());
24
+	}
25
+
26
+	/**
27
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
28
+	 * @covers \SwaggerGen\Swagger\License::toArray
29
+	 */
30
+	public function testConstructor_Description_Empty()
31
+	{
32
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', '');
33
+
34
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
35
+
36
+		$this->assertSame(array(
37
+			'name' => 'Name',
38
+		), $object->toArray());
39
+	}
40
+
41
+	/**
42
+	 * @covers \SwaggerGen\Swagger\Tag::__construct
43
+	 * @covers \SwaggerGen\Swagger\License::toArray
44
+	 */
45
+	public function testConstructor3()
46
+	{
47
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
48
+
49
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
50
+
51
+		$this->assertSame(array(
52
+			'name' => 'Name',
53
+			'description' => 'Description',
54
+		), $object->toArray());
55
+	}
56
+
57
+	/**
58
+	 * @covers \SwaggerGen\Swagger\Tag::getName
59
+	 */
60
+	public function testGetName()
61
+	{
62
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
63
+
64
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
65
+
66
+		$this->assertSame('Name', $object->getName());
67
+	}
68
+
69
+	/**
70
+	 * @covers \SwaggerGen\Swagger\Tag::handleCommand
71
+	 */
72
+	public function testCommandDescription()
73
+	{
74
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name');
75
+
76
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
77
+
78
+		$object->handleCommand('description', 'Command Description');
79
+
80
+		$this->assertSame(array(
81
+			'name' => 'Name',
82
+			'description' => 'Command Description',
83
+		), $object->toArray());
84
+	}
85
+
86
+	/**
87
+	 * @covers \SwaggerGen\Swagger\Tag::handleCommand
88
+	 */
89
+	public function testCommandDescriptionOverwrite()
90
+	{
91
+		$object = new \SwaggerGen\Swagger\Tag($this->parent, 'Name', 'Description');
92
+
93
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Tag', $object);
94
+
95
+		$object->handleCommand('description', 'Command Description');
96
+
97
+		$this->assertSame(array(
98
+			'name' => 'Name',
99
+			'description' => 'Command Description',
100
+		), $object->toArray());
101
+	}
102
+
103
+	protected function setUp(): void
104
+	{
105
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
106
+	}
107
+
108
+	protected function assertPreConditions(): void
109
+	{
110
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
111
+	}
112 112
 
113 113
 }
Please login to merge, or discard this patch.