Completed
Push — master ( fcb010...ba73f2 )
by Martijn
19s
created
tests/Swagger/Type/Custom/Ipv6TypeTest.php 1 patch
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -6,154 +6,154 @@
 block discarded – undo
6 6
 class Ipv6TypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
13
-     */
14
-    public function testConstructNotAnIpv6()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not an IPv6: 'wrong'");
17
-
18
-        new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
23
-     */
24
-    public function testConstruct()
25
-    {
26
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6');
27
-
28
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
29
-
30
-        $this->assertSame(array(
31
-            'type' => 'string',
32
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
33
-        ), $object->toArray());
34
-    }
35
-
36
-    /**
37
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
38
-     */
39
-    public function testConstructEmptyDefault()
40
-    {
41
-        $this->expectException('\SwaggerGen\Exception', "Unparseable IPv6 definition: 'ipv6='");
42
-
43
-        new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6= ');
44
-    }
45
-
46
-    /**
47
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
48
-     */
49
-    public function testConstructDefaultTooManyDigits()
50
-    {
51
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: '12001:0db8:85a3:0000:1319:8a2e:0370:7344'");
52
-
53
-        new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=12001:0db8:85a3:0000:1319:8a2e:0370:7344');
54
-    }
55
-
56
-    /**
57
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
58
-     */
59
-    public function testConstructDefaultTooFewParts()
60
-    {
61
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: '0db8:85a3:0000:1319:8a2e:0370:7344'");
62
-
63
-        new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=0db8:85a3:0000:1319:8a2e:0370:7344');
64
-    }
65
-
66
-    /**
67
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
68
-     */
69
-    public function testConstructDefaultTooManyParts()
70
-    {
71
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: '2001:2001:0db8:85a3:0000:1319:8a2e:0370:7344'");
72
-
73
-        new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=2001:2001:0db8:85a3:0000:1319:8a2e:0370:7344');
74
-    }
75
-
76
-    /**
77
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
78
-     */
79
-    public function testConstructDefaultUntrimmed()
80
-    {
81
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: ' 2001:0db8:85a3:0000:1319:8a2e:0370:7344'");
82
-
83
-        new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6= 2001:0db8:85a3:0000:1319:8a2e:0370:7344');
84
-    }
85
-
86
-    /**
87
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
88
-     */
89
-    public function testConstructDefault()
90
-    {
91
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=2001:0db8:85a3:0000:1319:8a2e:0370:7344');
92
-
93
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
94
-
95
-        $this->assertSame(array(
96
-            'type' => 'string',
97
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
98
-            'default' => '2001:0db8:85a3:0000:1319:8a2e:0370:7344',
99
-        ), $object->toArray());
100
-    }
101
-
102
-    /**
103
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
104
-     */
105
-    public function testConstructDefaultNoZeroes()
106
-    {
107
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=2001:0db8:85a3::1319:8a2e:0370:7344');
108
-
109
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
110
-
111
-        $this->assertSame(array(
112
-            'type' => 'string',
113
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
114
-            'default' => '2001:0db8:85a3::1319:8a2e:0370:7344',
115
-        ), $object->toArray());
116
-    }
117
-
118
-    /**
119
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type->handleCommand
120
-     */
121
-    public function testCommandDefaultNoValue()
122
-    {
123
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6');
124
-
125
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
126
-
127
-        $this->expectException('\SwaggerGen\Exception', "Empty IPv6 default");
128
-        $object->handleCommand('default', '');
129
-    }
130
-
131
-    /**
132
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type->handleCommand
133
-     */
134
-    public function testCommandDefault()
135
-    {
136
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6');
137
-
138
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
139
-
140
-        $object->handleCommand('default', '2001:0db8:85a3:0000:1319:8a2e:0370:7344');
141
-
142
-        $this->assertSame(array(
143
-            'type' => 'string',
144
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
145
-            'default' => '2001:0db8:85a3:0000:1319:8a2e:0370:7344',
146
-        ), $object->toArray());
147
-    }
148
-
149
-    protected function setUp(): void
150
-    {
151
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
152
-    }
153
-
154
-    protected function assertPreConditions(): void
155
-    {
156
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
157
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
13
+	 */
14
+	public function testConstructNotAnIpv6()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not an IPv6: 'wrong'");
17
+
18
+		new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
23
+	 */
24
+	public function testConstruct()
25
+	{
26
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6');
27
+
28
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
29
+
30
+		$this->assertSame(array(
31
+			'type' => 'string',
32
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
33
+		), $object->toArray());
34
+	}
35
+
36
+	/**
37
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
38
+	 */
39
+	public function testConstructEmptyDefault()
40
+	{
41
+		$this->expectException('\SwaggerGen\Exception', "Unparseable IPv6 definition: 'ipv6='");
42
+
43
+		new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6= ');
44
+	}
45
+
46
+	/**
47
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
48
+	 */
49
+	public function testConstructDefaultTooManyDigits()
50
+	{
51
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: '12001:0db8:85a3:0000:1319:8a2e:0370:7344'");
52
+
53
+		new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=12001:0db8:85a3:0000:1319:8a2e:0370:7344');
54
+	}
55
+
56
+	/**
57
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
58
+	 */
59
+	public function testConstructDefaultTooFewParts()
60
+	{
61
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: '0db8:85a3:0000:1319:8a2e:0370:7344'");
62
+
63
+		new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=0db8:85a3:0000:1319:8a2e:0370:7344');
64
+	}
65
+
66
+	/**
67
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
68
+	 */
69
+	public function testConstructDefaultTooManyParts()
70
+	{
71
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: '2001:2001:0db8:85a3:0000:1319:8a2e:0370:7344'");
72
+
73
+		new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=2001:2001:0db8:85a3:0000:1319:8a2e:0370:7344');
74
+	}
75
+
76
+	/**
77
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
78
+	 */
79
+	public function testConstructDefaultUntrimmed()
80
+	{
81
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv6 default value: ' 2001:0db8:85a3:0000:1319:8a2e:0370:7344'");
82
+
83
+		new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6= 2001:0db8:85a3:0000:1319:8a2e:0370:7344');
84
+	}
85
+
86
+	/**
87
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
88
+	 */
89
+	public function testConstructDefault()
90
+	{
91
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=2001:0db8:85a3:0000:1319:8a2e:0370:7344');
92
+
93
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
94
+
95
+		$this->assertSame(array(
96
+			'type' => 'string',
97
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
98
+			'default' => '2001:0db8:85a3:0000:1319:8a2e:0370:7344',
99
+		), $object->toArray());
100
+	}
101
+
102
+	/**
103
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type::__construct
104
+	 */
105
+	public function testConstructDefaultNoZeroes()
106
+	{
107
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6=2001:0db8:85a3::1319:8a2e:0370:7344');
108
+
109
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
110
+
111
+		$this->assertSame(array(
112
+			'type' => 'string',
113
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
114
+			'default' => '2001:0db8:85a3::1319:8a2e:0370:7344',
115
+		), $object->toArray());
116
+	}
117
+
118
+	/**
119
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type->handleCommand
120
+	 */
121
+	public function testCommandDefaultNoValue()
122
+	{
123
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6');
124
+
125
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
126
+
127
+		$this->expectException('\SwaggerGen\Exception', "Empty IPv6 default");
128
+		$object->handleCommand('default', '');
129
+	}
130
+
131
+	/**
132
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv6Type->handleCommand
133
+	 */
134
+	public function testCommandDefault()
135
+	{
136
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv6Type($this->parent, 'ipv6');
137
+
138
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv6Type', $object);
139
+
140
+		$object->handleCommand('default', '2001:0db8:85a3:0000:1319:8a2e:0370:7344');
141
+
142
+		$this->assertSame(array(
143
+			'type' => 'string',
144
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv6Type::PATTERN,
145
+			'default' => '2001:0db8:85a3:0000:1319:8a2e:0370:7344',
146
+		), $object->toArray());
147
+	}
148
+
149
+	protected function setUp(): void
150
+	{
151
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
152
+	}
153
+
154
+	protected function assertPreConditions(): void
155
+	{
156
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
157
+	}
158 158
 
159 159
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/Custom/MacTypeTest.php 1 patch
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -6,148 +6,148 @@
 block discarded – undo
6 6
 class MacTypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
13
-     */
14
-    public function testConstructNotAnMac()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not a MAC: 'wrong'");
17
-
18
-        new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
23
-     */
24
-    public function testConstruct()
25
-    {
26
-        $object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac');
27
-
28
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
29
-
30
-        $this->assertSame(array(
31
-            'type' => 'string',
32
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\MacType::PATTERN,
33
-        ), $object->toArray());
34
-    }
35
-
36
-    /**
37
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
38
-     */
39
-    public function testConstructEmptyDefault()
40
-    {
41
-        $this->expectException('\SwaggerGen\Exception', "Unparseable MAC definition: 'mac='");
42
-
43
-        new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac= ');
44
-    }
45
-
46
-    /**
47
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
48
-     */
49
-    public function testConstructDefaultTooFewBytes()
50
-    {
51
-        $this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'FF:FF:FF:FF:FF'");
52
-
53
-        new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FF:FF:FF:FF:FF');
54
-    }
55
-
56
-    /**
57
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
58
-     */
59
-    public function testConstructDefaultTooManyBytes()
60
-    {
61
-        $this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'FF:FF:FF:FF:FF:FF:FF'");
62
-
63
-        new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FF:FF:FF:FF:FF:FF:FF');
64
-    }
65
-
66
-    /**
67
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
68
-     */
69
-    public function testConstructDefaultTooFewDigits()
70
-    {
71
-        $this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'F:FF:FF:FF:FF:FF'");
72
-
73
-        new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=F:FF:FF:FF:FF:FF');
74
-    }
75
-
76
-    /**
77
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
78
-     */
79
-    public function testConstructDefaultTooManyDigits()
80
-    {
81
-        $this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'FFF:FF:FF:FF:FF:FF'");
82
-
83
-        new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FFF:FF:FF:FF:FF:FF');
84
-    }
85
-
86
-    /**
87
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
88
-     */
89
-    public function testConstructDefaultUntrimmed()
90
-    {
91
-        $this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: ' FF:FF:FF:FF:FF:FF'");
92
-
93
-        new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac= FF:FF:FF:FF:FF:FF');
94
-    }
95
-
96
-    /**
97
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
98
-     */
99
-    public function testConstructDefault()
100
-    {
101
-        $object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FF:FF:FF:FF:FF:FF');
102
-
103
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
104
-
105
-        $this->assertSame(array(
106
-            'type' => 'string',
107
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\MacType::PATTERN,
108
-            'default' => 'FF:FF:FF:FF:FF:FF',
109
-        ), $object->toArray());
110
-    }
111
-
112
-    /**
113
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType->handleCommand
114
-     */
115
-    public function testCommandDefaultNoValue()
116
-    {
117
-        $object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac');
118
-
119
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
120
-
121
-        $this->expectException('\SwaggerGen\Exception', "Empty MAC default");
122
-        $object->handleCommand('default', '');
123
-    }
124
-
125
-    /**
126
-     * @covers \SwaggerGen\Swagger\Type\Custom\MacType->handleCommand
127
-     */
128
-    public function testCommandDefault()
129
-    {
130
-        $object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac');
131
-
132
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
133
-
134
-        $object->handleCommand('default', 'FF:FF:FF:FF:FF:FF');
135
-
136
-        $this->assertSame(array(
137
-            'type' => 'string',
138
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\MacType::PATTERN,
139
-            'default' => 'FF:FF:FF:FF:FF:FF',
140
-        ), $object->toArray());
141
-    }
142
-
143
-    protected function setUp(): void
144
-    {
145
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
146
-    }
147
-
148
-    protected function assertPreConditions(): void
149
-    {
150
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
151
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
13
+	 */
14
+	public function testConstructNotAnMac()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not a MAC: 'wrong'");
17
+
18
+		new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
23
+	 */
24
+	public function testConstruct()
25
+	{
26
+		$object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac');
27
+
28
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
29
+
30
+		$this->assertSame(array(
31
+			'type' => 'string',
32
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\MacType::PATTERN,
33
+		), $object->toArray());
34
+	}
35
+
36
+	/**
37
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
38
+	 */
39
+	public function testConstructEmptyDefault()
40
+	{
41
+		$this->expectException('\SwaggerGen\Exception', "Unparseable MAC definition: 'mac='");
42
+
43
+		new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac= ');
44
+	}
45
+
46
+	/**
47
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
48
+	 */
49
+	public function testConstructDefaultTooFewBytes()
50
+	{
51
+		$this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'FF:FF:FF:FF:FF'");
52
+
53
+		new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FF:FF:FF:FF:FF');
54
+	}
55
+
56
+	/**
57
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
58
+	 */
59
+	public function testConstructDefaultTooManyBytes()
60
+	{
61
+		$this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'FF:FF:FF:FF:FF:FF:FF'");
62
+
63
+		new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FF:FF:FF:FF:FF:FF:FF');
64
+	}
65
+
66
+	/**
67
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
68
+	 */
69
+	public function testConstructDefaultTooFewDigits()
70
+	{
71
+		$this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'F:FF:FF:FF:FF:FF'");
72
+
73
+		new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=F:FF:FF:FF:FF:FF');
74
+	}
75
+
76
+	/**
77
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
78
+	 */
79
+	public function testConstructDefaultTooManyDigits()
80
+	{
81
+		$this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: 'FFF:FF:FF:FF:FF:FF'");
82
+
83
+		new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FFF:FF:FF:FF:FF:FF');
84
+	}
85
+
86
+	/**
87
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
88
+	 */
89
+	public function testConstructDefaultUntrimmed()
90
+	{
91
+		$this->expectException('\SwaggerGen\Exception', "Invalid MAC default value: ' FF:FF:FF:FF:FF:FF'");
92
+
93
+		new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac= FF:FF:FF:FF:FF:FF');
94
+	}
95
+
96
+	/**
97
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType::__construct
98
+	 */
99
+	public function testConstructDefault()
100
+	{
101
+		$object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac=FF:FF:FF:FF:FF:FF');
102
+
103
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
104
+
105
+		$this->assertSame(array(
106
+			'type' => 'string',
107
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\MacType::PATTERN,
108
+			'default' => 'FF:FF:FF:FF:FF:FF',
109
+		), $object->toArray());
110
+	}
111
+
112
+	/**
113
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType->handleCommand
114
+	 */
115
+	public function testCommandDefaultNoValue()
116
+	{
117
+		$object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac');
118
+
119
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
120
+
121
+		$this->expectException('\SwaggerGen\Exception', "Empty MAC default");
122
+		$object->handleCommand('default', '');
123
+	}
124
+
125
+	/**
126
+	 * @covers \SwaggerGen\Swagger\Type\Custom\MacType->handleCommand
127
+	 */
128
+	public function testCommandDefault()
129
+	{
130
+		$object = new SwaggerGen\Swagger\Type\Custom\MacType($this->parent, 'mac');
131
+
132
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\MacType', $object);
133
+
134
+		$object->handleCommand('default', 'FF:FF:FF:FF:FF:FF');
135
+
136
+		$this->assertSame(array(
137
+			'type' => 'string',
138
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\MacType::PATTERN,
139
+			'default' => 'FF:FF:FF:FF:FF:FF',
140
+		), $object->toArray());
141
+	}
142
+
143
+	protected function setUp(): void
144
+	{
145
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
146
+	}
147
+
148
+	protected function assertPreConditions(): void
149
+	{
150
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
151
+	}
152 152
 
153 153
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/Custom/EmailTypeTest.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -6,118 +6,118 @@
 block discarded – undo
6 6
 class EmailTypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
13
-     */
14
-    public function testConstructNotAnEmail()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not an email: 'wrong'");
17
-
18
-        new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
23
-     */
24
-    public function testConstruct()
25
-    {
26
-        $object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email');
27
-
28
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
29
-
30
-        $this->assertSame(array(
31
-            'type' => 'string',
32
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\EmailType::PATTERN,
33
-        ), $object->toArray());
34
-    }
35
-
36
-    /**
37
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
38
-     */
39
-    public function testConstructEmptyDefault()
40
-    {
41
-        $this->expectException('\SwaggerGen\Exception', "Unparseable email definition: 'email='");
42
-
43
-        new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email= ');
44
-    }
45
-
46
-    /**
47
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
48
-     */
49
-    public function testConstructDefaultDoubleAt()
50
-    {
51
-        $this->expectException('\SwaggerGen\Exception', "Invalid email default value: 'test@[email protected]'");
52
-
53
-        new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email=test@[email protected]');
54
-    }
55
-
56
-    /**
57
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
58
-     */
59
-    public function testConstructDefaultUntrimmed()
60
-    {
61
-        $this->expectException('\SwaggerGen\Exception', "Invalid email default value: ' [email protected]'");
62
-
63
-        new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email= [email protected]');
64
-    }
65
-
66
-    /**
67
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
68
-     */
69
-    public function testConstructDefault()
70
-    {
71
-        $object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, '[email protected]');
72
-
73
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
74
-
75
-        $this->assertSame(array(
76
-            'type' => 'string',
77
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\EmailType::PATTERN,
78
-            'default' => '[email protected]',
79
-        ), $object->toArray());
80
-    }
81
-
82
-    /**
83
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType->handleCommand
84
-     */
85
-    public function testCommandDefaultNoValue()
86
-    {
87
-        $object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email');
88
-
89
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
90
-
91
-        $this->expectException('\SwaggerGen\Exception', "Empty email default");
92
-        $object->handleCommand('default', '');
93
-    }
94
-
95
-    /**
96
-     * @covers \SwaggerGen\Swagger\Type\Custom\EmailType->handleCommand
97
-     */
98
-    public function testCommandDefault()
99
-    {
100
-        $object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email');
101
-
102
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
103
-
104
-        $object->handleCommand('default', '[email protected]');
105
-
106
-        $this->assertSame(array(
107
-            'type' => 'string',
108
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\EmailType::PATTERN,
109
-            'default' => '[email protected]',
110
-        ), $object->toArray());
111
-    }
112
-
113
-    protected function setUp(): void
114
-    {
115
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
116
-    }
117
-
118
-    protected function assertPreConditions(): void
119
-    {
120
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
121
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
13
+	 */
14
+	public function testConstructNotAnEmail()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not an email: 'wrong'");
17
+
18
+		new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
23
+	 */
24
+	public function testConstruct()
25
+	{
26
+		$object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email');
27
+
28
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
29
+
30
+		$this->assertSame(array(
31
+			'type' => 'string',
32
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\EmailType::PATTERN,
33
+		), $object->toArray());
34
+	}
35
+
36
+	/**
37
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
38
+	 */
39
+	public function testConstructEmptyDefault()
40
+	{
41
+		$this->expectException('\SwaggerGen\Exception', "Unparseable email definition: 'email='");
42
+
43
+		new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email= ');
44
+	}
45
+
46
+	/**
47
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
48
+	 */
49
+	public function testConstructDefaultDoubleAt()
50
+	{
51
+		$this->expectException('\SwaggerGen\Exception', "Invalid email default value: 'test@[email protected]'");
52
+
53
+		new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email=test@[email protected]');
54
+	}
55
+
56
+	/**
57
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
58
+	 */
59
+	public function testConstructDefaultUntrimmed()
60
+	{
61
+		$this->expectException('\SwaggerGen\Exception', "Invalid email default value: ' [email protected]'");
62
+
63
+		new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email= [email protected]');
64
+	}
65
+
66
+	/**
67
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType::__construct
68
+	 */
69
+	public function testConstructDefault()
70
+	{
71
+		$object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, '[email protected]');
72
+
73
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
74
+
75
+		$this->assertSame(array(
76
+			'type' => 'string',
77
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\EmailType::PATTERN,
78
+			'default' => '[email protected]',
79
+		), $object->toArray());
80
+	}
81
+
82
+	/**
83
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType->handleCommand
84
+	 */
85
+	public function testCommandDefaultNoValue()
86
+	{
87
+		$object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email');
88
+
89
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
90
+
91
+		$this->expectException('\SwaggerGen\Exception', "Empty email default");
92
+		$object->handleCommand('default', '');
93
+	}
94
+
95
+	/**
96
+	 * @covers \SwaggerGen\Swagger\Type\Custom\EmailType->handleCommand
97
+	 */
98
+	public function testCommandDefault()
99
+	{
100
+		$object = new SwaggerGen\Swagger\Type\Custom\EmailType($this->parent, 'email');
101
+
102
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\EmailType', $object);
103
+
104
+		$object->handleCommand('default', '[email protected]');
105
+
106
+		$this->assertSame(array(
107
+			'type' => 'string',
108
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\EmailType::PATTERN,
109
+			'default' => '[email protected]',
110
+		), $object->toArray());
111
+	}
112
+
113
+	protected function setUp(): void
114
+	{
115
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
116
+	}
117
+
118
+	protected function assertPreConditions(): void
119
+	{
120
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
121
+	}
122 122
 
123 123
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/FileTypeTest.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -6,112 +6,112 @@
 block discarded – undo
6 6
 class FileTypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
13
-     */
14
-    public function testConstructNotAFile()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not a file: 'wrong'");
17
-
18
-        $object = new SwaggerGen\Swagger\Type\FileType($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
23
-     */
24
-    public function testConstructNotParameter()
25
-    {
26
-        $this->expectException('\SwaggerGen\Exception', "File type 'file' only allowed on form parameter");
27
-
28
-        $object = new SwaggerGen\Swagger\Type\FileType($this->parent, 'file');
29
-    }
30
-
31
-    /**
32
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
33
-     */
34
-    public function testConstructNotFormParameter()
35
-    {
36
-        $this->expectException('\SwaggerGen\Exception', "File type 'file' only allowed on form parameter");
37
-
38
-        $parameter = new SwaggerGen\Swagger\Parameter($this->parent, 'query', 'long whatever');
39
-        $object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
40
-    }
41
-
42
-    /**
43
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
44
-     */
45
-    public function testConstructNoFormConsumes()
46
-    {
47
-        $this->expectException('\SwaggerGen\Exception', "File type 'file' without valid consume");
48
-
49
-        $operation = new SwaggerGen\Swagger\Operation($this->parent);
50
-        $operation->handleCommand('consumes', 'text');
51
-        $parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
52
-        $object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
53
-    }
54
-
55
-    /**
56
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
57
-     */
58
-    public function testConstructNotExclusiveFormConsumes()
59
-    {
60
-        $this->expectException('\SwaggerGen\Exception', "File type 'file' without valid consume");
61
-
62
-        $operation = new SwaggerGen\Swagger\Operation($this->parent);
63
-        $operation->handleCommand('consumes', 'text file');
64
-        $parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
65
-        $object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
66
-    }
67
-
68
-    /**
69
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
70
-     */
71
-    public function testConstructFormConsumes()
72
-    {
73
-        $operation = new SwaggerGen\Swagger\Operation($this->parent);
74
-        $operation->handleCommand('consumes', 'form');
75
-        $parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
76
-        $object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
77
-    }
78
-
79
-    /**
80
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
81
-     */
82
-    public function testConstructFileformConsumes()
83
-    {
84
-        $operation = new SwaggerGen\Swagger\Operation($this->parent);
85
-        $operation->handleCommand('consumes', 'fileform');
86
-        $parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
87
-        $object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
88
-    }
89
-
90
-    /**
91
-     * @covers \SwaggerGen\Swagger\Type\FileType::__construct
92
-     */
93
-    public function testConstructBothConsumes()
94
-    {
95
-        $operation = new SwaggerGen\Swagger\Operation($this->parent);
96
-        $operation->handleCommand('consumes', 'fileform form');
97
-        $parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
98
-        $object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
99
-
100
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\FileType', $object);
101
-
102
-        $this->assertSame(array(
103
-            'type' => 'file',
104
-        ), $object->toArray());
105
-    }
106
-
107
-    protected function setUp(): void
108
-    {
109
-        $this->parent = new \SwaggerGen\Swagger\Swagger;
110
-    }
111
-
112
-    protected function assertPreConditions(): void
113
-    {
114
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
115
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
13
+	 */
14
+	public function testConstructNotAFile()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not a file: 'wrong'");
17
+
18
+		$object = new SwaggerGen\Swagger\Type\FileType($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
23
+	 */
24
+	public function testConstructNotParameter()
25
+	{
26
+		$this->expectException('\SwaggerGen\Exception', "File type 'file' only allowed on form parameter");
27
+
28
+		$object = new SwaggerGen\Swagger\Type\FileType($this->parent, 'file');
29
+	}
30
+
31
+	/**
32
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
33
+	 */
34
+	public function testConstructNotFormParameter()
35
+	{
36
+		$this->expectException('\SwaggerGen\Exception', "File type 'file' only allowed on form parameter");
37
+
38
+		$parameter = new SwaggerGen\Swagger\Parameter($this->parent, 'query', 'long whatever');
39
+		$object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
40
+	}
41
+
42
+	/**
43
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
44
+	 */
45
+	public function testConstructNoFormConsumes()
46
+	{
47
+		$this->expectException('\SwaggerGen\Exception', "File type 'file' without valid consume");
48
+
49
+		$operation = new SwaggerGen\Swagger\Operation($this->parent);
50
+		$operation->handleCommand('consumes', 'text');
51
+		$parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
52
+		$object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
53
+	}
54
+
55
+	/**
56
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
57
+	 */
58
+	public function testConstructNotExclusiveFormConsumes()
59
+	{
60
+		$this->expectException('\SwaggerGen\Exception', "File type 'file' without valid consume");
61
+
62
+		$operation = new SwaggerGen\Swagger\Operation($this->parent);
63
+		$operation->handleCommand('consumes', 'text file');
64
+		$parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
65
+		$object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
66
+	}
67
+
68
+	/**
69
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
70
+	 */
71
+	public function testConstructFormConsumes()
72
+	{
73
+		$operation = new SwaggerGen\Swagger\Operation($this->parent);
74
+		$operation->handleCommand('consumes', 'form');
75
+		$parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
76
+		$object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
77
+	}
78
+
79
+	/**
80
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
81
+	 */
82
+	public function testConstructFileformConsumes()
83
+	{
84
+		$operation = new SwaggerGen\Swagger\Operation($this->parent);
85
+		$operation->handleCommand('consumes', 'fileform');
86
+		$parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
87
+		$object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
88
+	}
89
+
90
+	/**
91
+	 * @covers \SwaggerGen\Swagger\Type\FileType::__construct
92
+	 */
93
+	public function testConstructBothConsumes()
94
+	{
95
+		$operation = new SwaggerGen\Swagger\Operation($this->parent);
96
+		$operation->handleCommand('consumes', 'fileform form');
97
+		$parameter = new SwaggerGen\Swagger\Parameter($operation, 'form', 'long whatever');
98
+		$object = new SwaggerGen\Swagger\Type\FileType($parameter, 'file');
99
+
100
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\FileType', $object);
101
+
102
+		$this->assertSame(array(
103
+			'type' => 'file',
104
+		), $object->toArray());
105
+	}
106
+
107
+	protected function setUp(): void
108
+	{
109
+		$this->parent = new \SwaggerGen\Swagger\Swagger;
110
+	}
111
+
112
+	protected function assertPreConditions(): void
113
+	{
114
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
115
+	}
116 116
 
117 117
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/StringUuidTypeTest.php 1 patch
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -6,124 +6,124 @@
 block discarded – undo
6 6
 class StringUuidTypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
13
-     */
14
-    public function testConstructNotAUuid()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not a uuid: 'wrong'");
17
-
18
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
23
-     */
24
-    public function testConstructUuid()
25
-    {
26
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
27
-
28
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
29
-
30
-        $this->assertSame(array(
31
-            'type' => 'string',
32
-            'format' => 'uuid',
33
-            'pattern' => '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$',
34
-        ), $object->toArray());
35
-    }
36
-
37
-    /**
38
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
39
-     */
40
-    public function testConstructUuidEmptyDefault()
41
-    {
42
-        $this->expectException('\SwaggerGen\Exception', "Unparseable uuid definition: 'uuid='");
43
-
44
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid= ');
45
-    }
46
-
47
-    /**
48
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
49
-     */
50
-    public function testConstructUuidBadDefault()
51
-    {
52
-        $this->expectException('\SwaggerGen\Exception', "Unparseable uuid definition: 'uuid=123'");
53
-
54
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid=123');
55
-    }
56
-
57
-    /**
58
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
59
-     */
60
-    public function testConstructUuidDefault()
61
-    {
62
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid=123e4567-e89b-12d3-a456-426655440000');
63
-
64
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
65
-
66
-        $this->assertSame(array(
67
-            'type' => 'string',
68
-            'format' => 'uuid',
69
-            'pattern' => '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$',
70
-            'default' => '123e4567-e89b-12d3-a456-426655440000',
71
-        ), $object->toArray());
72
-    }
73
-
74
-    /**
75
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType->handleCommand
76
-     */
77
-    public function testCommandDefaultNoValue()
78
-    {
79
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
80
-
81
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
82
-
83
-        $this->expectException('\SwaggerGen\Exception', "Empty uuid default");
84
-        $object->handleCommand('default', '');
85
-    }
86
-
87
-    /**
88
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType->handleCommand
89
-     */
90
-    public function testCommandDefaultBadValue()
91
-    {
92
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
93
-
94
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
95
-
96
-        $this->expectException('\SwaggerGen\Exception', "Invalid uuid default");
97
-        $object->handleCommand('default', 'foobar');
98
-    }
99
-
100
-    /**
101
-     * @covers \SwaggerGen\Swagger\Type\StringUuidType->handleCommand
102
-     */
103
-    public function testCommandDefault()
104
-    {
105
-        $object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
106
-
107
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
108
-
109
-        $object->handleCommand('default', '123e4567-e89b-12d3-a456-426655440000');
110
-
111
-        $this->assertSame(array(
112
-            'type' => 'string',
113
-            'format' => 'uuid',
114
-            'pattern' => '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$',
115
-            'default' => '123e4567-e89b-12d3-a456-426655440000',
116
-        ), $object->toArray());
117
-    }
118
-
119
-    protected function setUp(): void
120
-    {
121
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
122
-    }
123
-
124
-    protected function assertPreConditions(): void
125
-    {
126
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
127
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
13
+	 */
14
+	public function testConstructNotAUuid()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not a uuid: 'wrong'");
17
+
18
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
23
+	 */
24
+	public function testConstructUuid()
25
+	{
26
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
27
+
28
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
29
+
30
+		$this->assertSame(array(
31
+			'type' => 'string',
32
+			'format' => 'uuid',
33
+			'pattern' => '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$',
34
+		), $object->toArray());
35
+	}
36
+
37
+	/**
38
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
39
+	 */
40
+	public function testConstructUuidEmptyDefault()
41
+	{
42
+		$this->expectException('\SwaggerGen\Exception', "Unparseable uuid definition: 'uuid='");
43
+
44
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid= ');
45
+	}
46
+
47
+	/**
48
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
49
+	 */
50
+	public function testConstructUuidBadDefault()
51
+	{
52
+		$this->expectException('\SwaggerGen\Exception', "Unparseable uuid definition: 'uuid=123'");
53
+
54
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid=123');
55
+	}
56
+
57
+	/**
58
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType::__construct
59
+	 */
60
+	public function testConstructUuidDefault()
61
+	{
62
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid=123e4567-e89b-12d3-a456-426655440000');
63
+
64
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
65
+
66
+		$this->assertSame(array(
67
+			'type' => 'string',
68
+			'format' => 'uuid',
69
+			'pattern' => '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$',
70
+			'default' => '123e4567-e89b-12d3-a456-426655440000',
71
+		), $object->toArray());
72
+	}
73
+
74
+	/**
75
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType->handleCommand
76
+	 */
77
+	public function testCommandDefaultNoValue()
78
+	{
79
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
80
+
81
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
82
+
83
+		$this->expectException('\SwaggerGen\Exception', "Empty uuid default");
84
+		$object->handleCommand('default', '');
85
+	}
86
+
87
+	/**
88
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType->handleCommand
89
+	 */
90
+	public function testCommandDefaultBadValue()
91
+	{
92
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
93
+
94
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
95
+
96
+		$this->expectException('\SwaggerGen\Exception', "Invalid uuid default");
97
+		$object->handleCommand('default', 'foobar');
98
+	}
99
+
100
+	/**
101
+	 * @covers \SwaggerGen\Swagger\Type\StringUuidType->handleCommand
102
+	 */
103
+	public function testCommandDefault()
104
+	{
105
+		$object = new SwaggerGen\Swagger\Type\StringUuidType($this->parent, 'uuid');
106
+
107
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringUuidType', $object);
108
+
109
+		$object->handleCommand('default', '123e4567-e89b-12d3-a456-426655440000');
110
+
111
+		$this->assertSame(array(
112
+			'type' => 'string',
113
+			'format' => 'uuid',
114
+			'pattern' => '^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$',
115
+			'default' => '123e4567-e89b-12d3-a456-426655440000',
116
+		), $object->toArray());
117
+	}
118
+
119
+	protected function setUp(): void
120
+	{
121
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
122
+	}
123
+
124
+	protected function assertPreConditions(): void
125
+	{
126
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
127
+	}
128 128
 
129 129
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/StringTypeTest.php 1 patch
Indentation   +288 added lines, -288 removed lines patch added patch discarded remove patch
@@ -6,293 +6,293 @@
 block discarded – undo
6 6
 class StringTypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
13
-     */
14
-    public function testConstructNotAString()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not a string: 'wrong'");
17
-
18
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
23
-     */
24
-    public function testConstructEmptyRange()
25
-    {
26
-        $this->expectException('\SwaggerGen\Exception', "Empty string range: 'string[,]=1'");
27
-
28
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[,]=1');
29
-    }
30
-
31
-    /**
32
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
33
-     */
34
-    public function testConstructDefaultTooLongInclusive()
35
-    {
36
-        $this->expectException('\SwaggerGen\Exception', "Default string length beyond maximum: 'long'");
37
-
38
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[,3]=long');
39
-    }
40
-
41
-    /**
42
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
43
-     */
44
-    public function testConstructDefaultTooLongExclusive()
45
-    {
46
-        $this->expectException('\SwaggerGen\Exception', "Default string length beyond maximum: 'long'");
47
-
48
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[,4>=long');
49
-    }
50
-
51
-    /**
52
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
53
-     */
54
-    public function testConstructDefaultTooShortInclusive()
55
-    {
56
-        $this->expectException('\SwaggerGen\Exception', "Default string length beyond minimum: 'short'");
57
-
58
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[6,]=short');
59
-    }
60
-
61
-    /**
62
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
63
-     */
64
-    public function testConstructDefaultTooShortExclusive()
65
-    {
66
-        $this->expectException('\SwaggerGen\Exception', "Default string length beyond minimum: 'short'");
67
-
68
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string<5,]=short');
69
-    }
70
-
71
-    /**
72
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
73
-     */
74
-    public function testConstructString()
75
-    {
76
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
77
-
78
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
79
-
80
-        $this->assertSame(array(
81
-            'type' => 'string',
82
-        ), $object->toArray());
83
-    }
84
-
85
-    /**
86
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
87
-     */
88
-    public function testConstructStringEmptyDefault()
89
-    {
90
-        $this->expectException('\SwaggerGen\Exception', "Unparseable string definition: 'string='");
91
-
92
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string= ');
93
-    }
94
-
95
-    /**
96
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
97
-     */
98
-    public function testConstructStringDefaultLengthInclusive()
99
-    {
100
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[4,4]=word');
101
-
102
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
103
-
104
-        $this->assertSame(array(
105
-            'type' => 'string',
106
-            'default' => 'word',
107
-            'minLength' => 4,
108
-            'maxLength' => 4,
109
-        ), $object->toArray());
110
-    }
111
-
112
-    /**
113
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
114
-     */
115
-    public function testConstructStringDefaultLengthExclusive()
116
-    {
117
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string<3,5>=word');
118
-
119
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
120
-
121
-        $this->assertSame(array(
122
-            'type' => 'string',
123
-            'default' => 'word',
124
-            'minLength' => 4,
125
-            'maxLength' => 4,
126
-        ), $object->toArray());
127
-    }
128
-
129
-    /**
130
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
131
-     */
132
-    public function testConstructBinary()
133
-    {
134
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'binary');
135
-
136
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
137
-
138
-        $this->assertSame(array(
139
-            'type' => 'string',
140
-            'format' => 'binary',
141
-        ), $object->toArray());
142
-    }
143
-
144
-    /**
145
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
146
-     */
147
-    public function testConstructEnumRange()
148
-    {
149
-        $this->expectException('\SwaggerGen\Exception', "Range not allowed in enumeration definition: 'enum(a,b)[,]'");
150
-
151
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)[,]');
152
-    }
153
-
154
-    /**
155
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
156
-     */
157
-    public function testConstructEnumInvalidDefault()
158
-    {
159
-        $this->expectException('\SwaggerGen\Exception', "Invalid enum default: 'c'");
160
-
161
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)=c');
162
-    }
163
-
164
-    /**
165
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
166
-     */
167
-    public function testConstructEnum()
168
-    {
169
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)');
170
-
171
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
172
-
173
-        $this->assertSame(array(
174
-            'type' => 'string',
175
-            'enum' => array('a', 'b'),
176
-        ), $object->toArray());
177
-    }
178
-
179
-    /**
180
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
181
-     */
182
-    public function testConstructEnumWithDefault()
183
-    {
184
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)=a');
185
-
186
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
187
-
188
-        $this->assertSame(array(
189
-            'type' => 'string',
190
-            'default' => 'a',
191
-            'enum' => array('a', 'b'),
192
-        ), $object->toArray());
193
-    }
194
-
195
-    /**
196
-     * @covers \SwaggerGen\Swagger\Type\StringType::__construct
197
-     */
198
-    public function testConstructPattern()
199
-    {
200
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string([a-z])');
201
-
202
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
203
-
204
-        $this->assertSame(array(
205
-            'type' => 'string',
206
-            'pattern' => '[a-z]',
207
-        ), $object->toArray());
208
-    }
209
-
210
-    /**
211
-     * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
212
-     */
213
-    public function testCommandDefaultNoValue()
214
-    {
215
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
216
-
217
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
218
-
219
-        $this->expectException('\SwaggerGen\Exception', "Empty string default");
220
-        $object->handleCommand('default', '');
221
-    }
222
-
223
-    /**
224
-     * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
225
-     */
226
-    public function testCommandDefault()
227
-    {
228
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
229
-
230
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
231
-
232
-        $object->handleCommand('default', 'word');
233
-
234
-        $this->assertSame(array(
235
-            'type' => 'string',
236
-            'default' => 'word',
237
-        ), $object->toArray());
238
-    }
239
-
240
-    /**
241
-     * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
242
-     */
243
-    public function testCommandPattern()
244
-    {
245
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
246
-
247
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
248
-
249
-        $object->handleCommand('pattern', '[a-z]');
250
-
251
-        $this->assertSame(array(
252
-            'type' => 'string',
253
-            'pattern' => '[a-z]',
254
-        ), $object->toArray());
255
-    }
256
-
257
-    /**
258
-     * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
259
-     */
260
-    public function testCommandEnumWhenRange()
261
-    {
262
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[0,]');
263
-
264
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
265
-
266
-        $this->expectException('\SwaggerGen\Exception', "Enumeration not allowed in ranged string: 'red green blue'");
267
-
268
-        $object->handleCommand('enum', 'red green blue');
269
-    }
270
-
271
-    /**
272
-     * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
273
-     */
274
-    public function testCommandEnum()
275
-    {
276
-        $object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
277
-
278
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
279
-
280
-        $object->handleCommand('enum', 'red green blue');
281
-
282
-        $this->assertSame(array(
283
-            'type' => 'string',
284
-            'enum' => array('red', 'green', 'blue'),
285
-        ), $object->toArray());
286
-    }
287
-
288
-    protected function setUp(): void
289
-    {
290
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
291
-    }
292
-
293
-    protected function assertPreConditions(): void
294
-    {
295
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
296
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
13
+	 */
14
+	public function testConstructNotAString()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not a string: 'wrong'");
17
+
18
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
23
+	 */
24
+	public function testConstructEmptyRange()
25
+	{
26
+		$this->expectException('\SwaggerGen\Exception', "Empty string range: 'string[,]=1'");
27
+
28
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[,]=1');
29
+	}
30
+
31
+	/**
32
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
33
+	 */
34
+	public function testConstructDefaultTooLongInclusive()
35
+	{
36
+		$this->expectException('\SwaggerGen\Exception', "Default string length beyond maximum: 'long'");
37
+
38
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[,3]=long');
39
+	}
40
+
41
+	/**
42
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
43
+	 */
44
+	public function testConstructDefaultTooLongExclusive()
45
+	{
46
+		$this->expectException('\SwaggerGen\Exception', "Default string length beyond maximum: 'long'");
47
+
48
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[,4>=long');
49
+	}
50
+
51
+	/**
52
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
53
+	 */
54
+	public function testConstructDefaultTooShortInclusive()
55
+	{
56
+		$this->expectException('\SwaggerGen\Exception', "Default string length beyond minimum: 'short'");
57
+
58
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[6,]=short');
59
+	}
60
+
61
+	/**
62
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
63
+	 */
64
+	public function testConstructDefaultTooShortExclusive()
65
+	{
66
+		$this->expectException('\SwaggerGen\Exception', "Default string length beyond minimum: 'short'");
67
+
68
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string<5,]=short');
69
+	}
70
+
71
+	/**
72
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
73
+	 */
74
+	public function testConstructString()
75
+	{
76
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
77
+
78
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
79
+
80
+		$this->assertSame(array(
81
+			'type' => 'string',
82
+		), $object->toArray());
83
+	}
84
+
85
+	/**
86
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
87
+	 */
88
+	public function testConstructStringEmptyDefault()
89
+	{
90
+		$this->expectException('\SwaggerGen\Exception', "Unparseable string definition: 'string='");
91
+
92
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string= ');
93
+	}
94
+
95
+	/**
96
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
97
+	 */
98
+	public function testConstructStringDefaultLengthInclusive()
99
+	{
100
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[4,4]=word');
101
+
102
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
103
+
104
+		$this->assertSame(array(
105
+			'type' => 'string',
106
+			'default' => 'word',
107
+			'minLength' => 4,
108
+			'maxLength' => 4,
109
+		), $object->toArray());
110
+	}
111
+
112
+	/**
113
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
114
+	 */
115
+	public function testConstructStringDefaultLengthExclusive()
116
+	{
117
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string<3,5>=word');
118
+
119
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
120
+
121
+		$this->assertSame(array(
122
+			'type' => 'string',
123
+			'default' => 'word',
124
+			'minLength' => 4,
125
+			'maxLength' => 4,
126
+		), $object->toArray());
127
+	}
128
+
129
+	/**
130
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
131
+	 */
132
+	public function testConstructBinary()
133
+	{
134
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'binary');
135
+
136
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
137
+
138
+		$this->assertSame(array(
139
+			'type' => 'string',
140
+			'format' => 'binary',
141
+		), $object->toArray());
142
+	}
143
+
144
+	/**
145
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
146
+	 */
147
+	public function testConstructEnumRange()
148
+	{
149
+		$this->expectException('\SwaggerGen\Exception', "Range not allowed in enumeration definition: 'enum(a,b)[,]'");
150
+
151
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)[,]');
152
+	}
153
+
154
+	/**
155
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
156
+	 */
157
+	public function testConstructEnumInvalidDefault()
158
+	{
159
+		$this->expectException('\SwaggerGen\Exception', "Invalid enum default: 'c'");
160
+
161
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)=c');
162
+	}
163
+
164
+	/**
165
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
166
+	 */
167
+	public function testConstructEnum()
168
+	{
169
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)');
170
+
171
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
172
+
173
+		$this->assertSame(array(
174
+			'type' => 'string',
175
+			'enum' => array('a', 'b'),
176
+		), $object->toArray());
177
+	}
178
+
179
+	/**
180
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
181
+	 */
182
+	public function testConstructEnumWithDefault()
183
+	{
184
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'enum(a,b)=a');
185
+
186
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
187
+
188
+		$this->assertSame(array(
189
+			'type' => 'string',
190
+			'default' => 'a',
191
+			'enum' => array('a', 'b'),
192
+		), $object->toArray());
193
+	}
194
+
195
+	/**
196
+	 * @covers \SwaggerGen\Swagger\Type\StringType::__construct
197
+	 */
198
+	public function testConstructPattern()
199
+	{
200
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string([a-z])');
201
+
202
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
203
+
204
+		$this->assertSame(array(
205
+			'type' => 'string',
206
+			'pattern' => '[a-z]',
207
+		), $object->toArray());
208
+	}
209
+
210
+	/**
211
+	 * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
212
+	 */
213
+	public function testCommandDefaultNoValue()
214
+	{
215
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
216
+
217
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
218
+
219
+		$this->expectException('\SwaggerGen\Exception', "Empty string default");
220
+		$object->handleCommand('default', '');
221
+	}
222
+
223
+	/**
224
+	 * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
225
+	 */
226
+	public function testCommandDefault()
227
+	{
228
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
229
+
230
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
231
+
232
+		$object->handleCommand('default', 'word');
233
+
234
+		$this->assertSame(array(
235
+			'type' => 'string',
236
+			'default' => 'word',
237
+		), $object->toArray());
238
+	}
239
+
240
+	/**
241
+	 * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
242
+	 */
243
+	public function testCommandPattern()
244
+	{
245
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
246
+
247
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
248
+
249
+		$object->handleCommand('pattern', '[a-z]');
250
+
251
+		$this->assertSame(array(
252
+			'type' => 'string',
253
+			'pattern' => '[a-z]',
254
+		), $object->toArray());
255
+	}
256
+
257
+	/**
258
+	 * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
259
+	 */
260
+	public function testCommandEnumWhenRange()
261
+	{
262
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string[0,]');
263
+
264
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
265
+
266
+		$this->expectException('\SwaggerGen\Exception', "Enumeration not allowed in ranged string: 'red green blue'");
267
+
268
+		$object->handleCommand('enum', 'red green blue');
269
+	}
270
+
271
+	/**
272
+	 * @covers \SwaggerGen\Swagger\Type\StringType->handleCommand
273
+	 */
274
+	public function testCommandEnum()
275
+	{
276
+		$object = new SwaggerGen\Swagger\Type\StringType($this->parent, 'string');
277
+
278
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\StringType', $object);
279
+
280
+		$object->handleCommand('enum', 'red green blue');
281
+
282
+		$this->assertSame(array(
283
+			'type' => 'string',
284
+			'enum' => array('red', 'green', 'blue'),
285
+		), $object->toArray());
286
+	}
287
+
288
+	protected function setUp(): void
289
+	{
290
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
291
+	}
292
+
293
+	protected function assertPreConditions(): void
294
+	{
295
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
296
+	}
297 297
 
298 298
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/PropertyTest.php 1 patch
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -6,130 +6,130 @@
 block discarded – undo
6 6
 class PropertyTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
13
-     */
14
-    public function testConstructEmpty()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not a property: ''");
17
-
18
-        new SwaggerGen\Swagger\Type\Property($this->parent, '');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
23
-     */
24
-    public function testConstructReference()
25
-    {
26
-        $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'Address');
27
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
28
-
29
-        $this->assertSame(array(
30
-            '$ref' => '#/definitions/Address',
31
-        ), $object->toArray());
32
-    }
33
-
34
-    /**
35
-     * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
36
-     */
37
-    public function testConstructReferences()
38
-    {
39
-        $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'array(Address)');
40
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
41
-
42
-        $this->assertSame(array(
43
-            'type' => 'array',
44
-            'items' => array(
45
-                '$ref' => '#/definitions/Address',
46
-            ),
47
-        ), $object->toArray());
48
-    }
49
-
50
-    /**
51
-     * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
52
-     */
53
-    public function testConstructString()
54
-    {
55
-        $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string');
56
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
57
-
58
-        $this->assertSame(array(
59
-            'type' => 'string',
60
-        ), $object->toArray());
61
-    }
62
-
63
-    /**
64
-     * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
65
-     */
66
-    public function testConstructDescription()
67
-    {
68
-        $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here');
69
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
70
-
71
-        $this->assertSame(array(
72
-            'type' => 'string',
73
-            'description' => 'Some words here',
74
-        ), $object->toArray());
75
-    }
76
-
77
-    /**
78
-     * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
79
-     */
80
-    public function testConstructReadOnly()
81
-    {
82
-        $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true);
83
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
84
-
85
-        $this->assertSame(array(
86
-            'type' => 'string',
87
-            'description' => 'Some words here',
88
-            'readOnly' => true
89
-        ), $object->toArray());
90
-    }
91
-
92
-    /**
93
-     * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
94
-     */
95
-    public function testConstructComplex()
96
-    {
97
-        $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'int[3,10>=6');
98
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
99
-
100
-        $this->assertSame(array(
101
-            'type' => 'integer',
102
-            'format' => 'int32',
103
-            'default' => 6,
104
-            'minimum' => 3,
105
-            'maximum' => 10,
106
-            'exclusiveMaximum' => true,
107
-        ), $object->toArray());
108
-    }
109
-
110
-    /**
111
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
112
-     */
113
-    public function testCommandPassing()
114
-    {
115
-        $object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string');
116
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
117
-
118
-        $object->handleCommand('default', 'good');
119
-        $this->assertSame(array(
120
-            'type' => 'string',
121
-            'default' => 'good',
122
-        ), $object->toArray());
123
-    }
124
-
125
-    protected function setUp(): void
126
-    {
127
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
128
-    }
129
-
130
-    protected function assertPreConditions(): void
131
-    {
132
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
133
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
13
+	 */
14
+	public function testConstructEmpty()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not a property: ''");
17
+
18
+		new SwaggerGen\Swagger\Type\Property($this->parent, '');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
23
+	 */
24
+	public function testConstructReference()
25
+	{
26
+		$object = new SwaggerGen\Swagger\Type\Property($this->parent, 'Address');
27
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
28
+
29
+		$this->assertSame(array(
30
+			'$ref' => '#/definitions/Address',
31
+		), $object->toArray());
32
+	}
33
+
34
+	/**
35
+	 * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
36
+	 */
37
+	public function testConstructReferences()
38
+	{
39
+		$object = new SwaggerGen\Swagger\Type\Property($this->parent, 'array(Address)');
40
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
41
+
42
+		$this->assertSame(array(
43
+			'type' => 'array',
44
+			'items' => array(
45
+				'$ref' => '#/definitions/Address',
46
+			),
47
+		), $object->toArray());
48
+	}
49
+
50
+	/**
51
+	 * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
52
+	 */
53
+	public function testConstructString()
54
+	{
55
+		$object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string');
56
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
57
+
58
+		$this->assertSame(array(
59
+			'type' => 'string',
60
+		), $object->toArray());
61
+	}
62
+
63
+	/**
64
+	 * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
65
+	 */
66
+	public function testConstructDescription()
67
+	{
68
+		$object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here');
69
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
70
+
71
+		$this->assertSame(array(
72
+			'type' => 'string',
73
+			'description' => 'Some words here',
74
+		), $object->toArray());
75
+	}
76
+
77
+	/**
78
+	 * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
79
+	 */
80
+	public function testConstructReadOnly()
81
+	{
82
+		$object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string', 'Some words here', true);
83
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
84
+
85
+		$this->assertSame(array(
86
+			'type' => 'string',
87
+			'description' => 'Some words here',
88
+			'readOnly' => true
89
+		), $object->toArray());
90
+	}
91
+
92
+	/**
93
+	 * @covers \SwaggerGen\Swagger\Type\PropertyType::__construct
94
+	 */
95
+	public function testConstructComplex()
96
+	{
97
+		$object = new SwaggerGen\Swagger\Type\Property($this->parent, 'int[3,10>=6');
98
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
99
+
100
+		$this->assertSame(array(
101
+			'type' => 'integer',
102
+			'format' => 'int32',
103
+			'default' => 6,
104
+			'minimum' => 3,
105
+			'maximum' => 10,
106
+			'exclusiveMaximum' => true,
107
+		), $object->toArray());
108
+	}
109
+
110
+	/**
111
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
112
+	 */
113
+	public function testCommandPassing()
114
+	{
115
+		$object = new SwaggerGen\Swagger\Type\Property($this->parent, 'string');
116
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Property', $object);
117
+
118
+		$object->handleCommand('default', 'good');
119
+		$this->assertSame(array(
120
+			'type' => 'string',
121
+			'default' => 'good',
122
+		), $object->toArray());
123
+	}
124
+
125
+	protected function setUp(): void
126
+	{
127
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
128
+	}
129
+
130
+	protected function assertPreConditions(): void
131
+	{
132
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
133
+	}
134 134
 
135 135
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/ArrayTypeTest.php 1 patch
Indentation   +356 added lines, -356 removed lines patch added patch discarded remove patch
@@ -6,372 +6,372 @@
 block discarded – undo
6 6
 class ArrayTypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
13
-     */
14
-    public function testConstructNotAArray()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not an array: 'wrong'");
17
-
18
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
23
-     */
24
-    public function testConstructInvalidDefault()
25
-    {
26
-        $this->expectException('\SwaggerGen\Exception', "Unparseable array definition: 'array=null'");
27
-
28
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array=null');
29
-    }
30
-
31
-    /**
32
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
33
-     */
34
-    public function testConstructMultiLimit()
35
-    {
36
-        $this->expectException('\SwaggerGen\Exception', "Multi array only allowed on query or form parameter: 'multi'");
37
-
38
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'multi');
39
-    }
40
-
41
-    /**
42
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
43
-     */
44
-    public function testConstructMultiOnFormParam()
45
-    {
46
-        $param = new \SwaggerGen\Swagger\Parameter($this->parent, 'form', 'multi foo');
47
-
48
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Parameter', $param);
49
-    }
50
-
51
-    /**
52
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
53
-     */
54
-    public function testConstructEmptyRange()
55
-    {
56
-        $this->expectException('\SwaggerGen\Exception', "Empty array range: 'array[,]'");
57
-
58
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[,]');
59
-    }
60
-
61
-    /**
62
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
63
-     */
64
-    public function testConstructRangeStart()
65
-    {
66
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[0,]');
67
-
68
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
69
-
70
-        $this->assertSame(array(
71
-            'type' => 'array',
72
-            'minItems' => 0,
73
-        ), $object->toArray());
74
-    }
75
-
76
-    /**
77
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
78
-     */
79
-    public function testConstructRangeBoth()
80
-    {
81
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array<2,4]');
82
-
83
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
84
-
85
-        $this->assertSame(array(
86
-            'type' => 'array',
87
-            'minItems' => 3,
88
-            'maxItems' => 4,
89
-        ), $object->toArray());
90
-    }
91
-
92
-    /**
93
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
94
-     */
95
-    public function testConstructEmptyItems()
96
-    {
97
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array()');
98
-
99
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
100
-
101
-        $this->assertSame(array(
102
-            'type' => 'array',
103
-        ), $object->toArray());
104
-    }
105
-
106
-    /**
107
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
108
-     */
109
-    public function testConstructBadItems()
110
-    {
111
-        $this->expectException('\SwaggerGen\Exception', "Unparseable items definition: '1'");
112
-
113
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(1)');
114
-    }
115
-
116
-    /**
117
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
118
-     */
119
-    public function testConstructTypeItems()
120
-    {
121
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(string)');
122
-
123
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
124
-
125
-        $this->assertSame(array(
126
-            'type' => 'array',
127
-            'items' => array(
128
-                'type' => 'string',
129
-            ),
130
-        ), $object->toArray());
131
-    }
132
-
133
-    /**
134
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
135
-     */
136
-    public function testConstructBracketsTypeItems()
137
-    {
138
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, '[string]');
139
-
140
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
141
-
142
-        $this->assertSame(array(
143
-            'type' => 'array',
144
-            'items' => array(
145
-                'type' => 'string',
146
-            ),
147
-        ), $object->toArray());
148
-    }
149
-
150
-    /**
151
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
152
-     */
153
-    public function testConstructTypeItemsPipes()
154
-    {
155
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'pipes(string)');
156
-
157
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
158
-
159
-        $this->assertSame(array(
160
-            'type' => 'array',
161
-            'items' => array(
162
-                'type' => 'string',
163
-            ),
164
-            'collectionFormat' => 'pipes',
165
-        ), $object->toArray());
166
-    }
167
-
168
-    /**
169
-     * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
170
-     */
171
-    public function testConstructReferenceItems()
172
-    {
173
-        $this->parent->handleCommand('model', 'Item');
174
-
175
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(Item)');
176
-
177
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
178
-
179
-        $this->assertSame(array(
180
-            'type' => 'array',
181
-            'items' => array(
182
-                '$ref' => '#/definitions/Item',
183
-            ),
184
-        ), $object->toArray());
185
-    }
186
-
187
-    /**
188
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
189
-     */
190
-    public function testCommandMinUpperBound()
191
-    {
192
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
193
-
194
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
195
-
196
-        $this->expectException('\SwaggerGen\Exception', "Minimum greater than maximum: '6'");
197
-
198
-        $object->handleCommand('min', '6');
199
-    }
200
-
201
-    /**
202
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
203
-     */
204
-    public function testCommandMinLowerBound()
205
-    {
206
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
207
-
208
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
209
-
210
-        $this->expectException('\SwaggerGen\Exception', "Minimum less than zero: '-1'");
211
-
212
-        $object->handleCommand('min', '-1');
213
-    }
214
-
215
-    /**
216
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
217
-     */
218
-    public function testCommandMin()
219
-    {
220
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
221
-
222
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
223
-
224
-        $object->handleCommand('min', '4');
225
-
226
-        $this->assertSame(array(
227
-            'type' => 'array',
228
-            'minItems' => 4,
229
-            'maxItems' => 5,
230
-        ), $object->toArray());
231
-    }
232
-
233
-    /**
234
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
235
-     */
236
-    public function testCommandMaxLowerBound()
237
-    {
238
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
13
+	 */
14
+	public function testConstructNotAArray()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not an array: 'wrong'");
17
+
18
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
23
+	 */
24
+	public function testConstructInvalidDefault()
25
+	{
26
+		$this->expectException('\SwaggerGen\Exception', "Unparseable array definition: 'array=null'");
27
+
28
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array=null');
29
+	}
30
+
31
+	/**
32
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
33
+	 */
34
+	public function testConstructMultiLimit()
35
+	{
36
+		$this->expectException('\SwaggerGen\Exception', "Multi array only allowed on query or form parameter: 'multi'");
37
+
38
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'multi');
39
+	}
40
+
41
+	/**
42
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
43
+	 */
44
+	public function testConstructMultiOnFormParam()
45
+	{
46
+		$param = new \SwaggerGen\Swagger\Parameter($this->parent, 'form', 'multi foo');
47
+
48
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Parameter', $param);
49
+	}
50
+
51
+	/**
52
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
53
+	 */
54
+	public function testConstructEmptyRange()
55
+	{
56
+		$this->expectException('\SwaggerGen\Exception', "Empty array range: 'array[,]'");
57
+
58
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[,]');
59
+	}
60
+
61
+	/**
62
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
63
+	 */
64
+	public function testConstructRangeStart()
65
+	{
66
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[0,]');
67
+
68
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
69
+
70
+		$this->assertSame(array(
71
+			'type' => 'array',
72
+			'minItems' => 0,
73
+		), $object->toArray());
74
+	}
75
+
76
+	/**
77
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
78
+	 */
79
+	public function testConstructRangeBoth()
80
+	{
81
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array<2,4]');
82
+
83
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
84
+
85
+		$this->assertSame(array(
86
+			'type' => 'array',
87
+			'minItems' => 3,
88
+			'maxItems' => 4,
89
+		), $object->toArray());
90
+	}
91
+
92
+	/**
93
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
94
+	 */
95
+	public function testConstructEmptyItems()
96
+	{
97
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array()');
98
+
99
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
100
+
101
+		$this->assertSame(array(
102
+			'type' => 'array',
103
+		), $object->toArray());
104
+	}
105
+
106
+	/**
107
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
108
+	 */
109
+	public function testConstructBadItems()
110
+	{
111
+		$this->expectException('\SwaggerGen\Exception', "Unparseable items definition: '1'");
112
+
113
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(1)');
114
+	}
115
+
116
+	/**
117
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
118
+	 */
119
+	public function testConstructTypeItems()
120
+	{
121
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(string)');
122
+
123
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
124
+
125
+		$this->assertSame(array(
126
+			'type' => 'array',
127
+			'items' => array(
128
+				'type' => 'string',
129
+			),
130
+		), $object->toArray());
131
+	}
132
+
133
+	/**
134
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
135
+	 */
136
+	public function testConstructBracketsTypeItems()
137
+	{
138
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, '[string]');
139
+
140
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
141
+
142
+		$this->assertSame(array(
143
+			'type' => 'array',
144
+			'items' => array(
145
+				'type' => 'string',
146
+			),
147
+		), $object->toArray());
148
+	}
149
+
150
+	/**
151
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
152
+	 */
153
+	public function testConstructTypeItemsPipes()
154
+	{
155
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'pipes(string)');
156
+
157
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
158
+
159
+		$this->assertSame(array(
160
+			'type' => 'array',
161
+			'items' => array(
162
+				'type' => 'string',
163
+			),
164
+			'collectionFormat' => 'pipes',
165
+		), $object->toArray());
166
+	}
167
+
168
+	/**
169
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType::__construct
170
+	 */
171
+	public function testConstructReferenceItems()
172
+	{
173
+		$this->parent->handleCommand('model', 'Item');
174
+
175
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(Item)');
176
+
177
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
178
+
179
+		$this->assertSame(array(
180
+			'type' => 'array',
181
+			'items' => array(
182
+				'$ref' => '#/definitions/Item',
183
+			),
184
+		), $object->toArray());
185
+	}
186
+
187
+	/**
188
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
189
+	 */
190
+	public function testCommandMinUpperBound()
191
+	{
192
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
193
+
194
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
195
+
196
+		$this->expectException('\SwaggerGen\Exception', "Minimum greater than maximum: '6'");
197
+
198
+		$object->handleCommand('min', '6');
199
+	}
200
+
201
+	/**
202
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
203
+	 */
204
+	public function testCommandMinLowerBound()
205
+	{
206
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
207
+
208
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
209
+
210
+		$this->expectException('\SwaggerGen\Exception', "Minimum less than zero: '-1'");
211
+
212
+		$object->handleCommand('min', '-1');
213
+	}
214
+
215
+	/**
216
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
217
+	 */
218
+	public function testCommandMin()
219
+	{
220
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
221
+
222
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
223
+
224
+		$object->handleCommand('min', '4');
225
+
226
+		$this->assertSame(array(
227
+			'type' => 'array',
228
+			'minItems' => 4,
229
+			'maxItems' => 5,
230
+		), $object->toArray());
231
+	}
232
+
233
+	/**
234
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
235
+	 */
236
+	public function testCommandMaxLowerBound()
237
+	{
238
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
239 239
 
240
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
241
-
242
-        $this->expectException('\SwaggerGen\Exception', "Maximum less than minimum: '2'");
243
-
244
-        $object->handleCommand('max', '2');
245
-    }
246
-
247
-    /**
248
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
249
-     */
250
-    public function testCommandMaxUpperBound()
251
-    {
252
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array');
253
-
254
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
240
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
241
+
242
+		$this->expectException('\SwaggerGen\Exception', "Maximum less than minimum: '2'");
243
+
244
+		$object->handleCommand('max', '2');
245
+	}
246
+
247
+	/**
248
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
249
+	 */
250
+	public function testCommandMaxUpperBound()
251
+	{
252
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array');
253
+
254
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
255 255
 
256
-        $this->expectException('\SwaggerGen\Exception', "Maximum less than zero: '-1'");
256
+		$this->expectException('\SwaggerGen\Exception', "Maximum less than zero: '-1'");
257 257
 
258
-        $object->handleCommand('max', '-1');
259
-    }
260
-
261
-    /**
262
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
263
-     */
264
-    public function testCommandMax()
265
-    {
266
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
258
+		$object->handleCommand('max', '-1');
259
+	}
260
+
261
+	/**
262
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
263
+	 */
264
+	public function testCommandMax()
265
+	{
266
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
267 267
 
268
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
269
-
270
-        $object->handleCommand('max', '4');
268
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
269
+
270
+		$object->handleCommand('max', '4');
271 271
 
272
-        $this->assertSame(array(
273
-            'type' => 'array',
274
-            'minItems' => 3,
275
-            'maxItems' => 4,
276
-        ), $object->toArray());
277
-    }
278
-
279
-    /**
280
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
281
-     */
282
-    public function testCommandEmptyItems()
283
-    {
284
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
272
+		$this->assertSame(array(
273
+			'type' => 'array',
274
+			'minItems' => 3,
275
+			'maxItems' => 4,
276
+		), $object->toArray());
277
+	}
278
+
279
+	/**
280
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
281
+	 */
282
+	public function testCommandEmptyItems()
283
+	{
284
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
285 285
 
286
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
287
-
288
-        $this->expectException('\SwaggerGen\Exception', "Empty items definition: ''");
286
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
287
+
288
+		$this->expectException('\SwaggerGen\Exception', "Empty items definition: ''");
289 289
 
290
-        $object->handleCommand('items', '');
291
-    }
290
+		$object->handleCommand('items', '');
291
+	}
292 292
 
293
-    /**
294
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
295
-     */
296
-    public function testCommandBadItems()
297
-    {
298
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
299
-
300
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
301
-
302
-        $this->expectException('\SwaggerGen\Exception', "Unparseable items definition: '1'");
303
-
304
-        $object->handleCommand('items', '1');
305
-    }
293
+	/**
294
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
295
+	 */
296
+	public function testCommandBadItems()
297
+	{
298
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array[3,5]');
299
+
300
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
301
+
302
+		$this->expectException('\SwaggerGen\Exception', "Unparseable items definition: '1'");
303
+
304
+		$object->handleCommand('items', '1');
305
+	}
306 306
 
307
-    /**
308
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
309
-     */
310
-    public function testCommandTypeItems()
311
-    {
312
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array');
313
-
314
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
315
-
316
-        $object->handleCommand('items', 'string');
317
-
318
-        $this->assertSame(array(
319
-            'type' => 'array',
320
-            'items' => array(
321
-                'type' => 'string',
322
-            ),
323
-        ), $object->toArray());
324
-    }
325
-
326
-    /**
327
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
328
-     */
329
-    public function testCommandReferenceItems()
330
-    {
331
-        $this->parent->handleCommand('model', 'Item');
332
-
333
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array');
334
-
335
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
336
-
337
-        $object->handleCommand('items', 'Item');
307
+	/**
308
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
309
+	 */
310
+	public function testCommandTypeItems()
311
+	{
312
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array');
313
+
314
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
315
+
316
+		$object->handleCommand('items', 'string');
317
+
318
+		$this->assertSame(array(
319
+			'type' => 'array',
320
+			'items' => array(
321
+				'type' => 'string',
322
+			),
323
+		), $object->toArray());
324
+	}
325
+
326
+	/**
327
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
328
+	 */
329
+	public function testCommandReferenceItems()
330
+	{
331
+		$this->parent->handleCommand('model', 'Item');
332
+
333
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array');
334
+
335
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
336
+
337
+		$object->handleCommand('items', 'Item');
338 338
 
339
-        $this->assertSame(array(
340
-            'type' => 'array',
341
-            'items' => array(
342
-                '$ref' => '#/definitions/Item',
343
-            ),
344
-        ), $object->toArray());
345
-    }
346
-
347
-    /**
348
-     * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
349
-     */
350
-    public function testCommandPassing()
351
-    {
352
-        $object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(string)');
339
+		$this->assertSame(array(
340
+			'type' => 'array',
341
+			'items' => array(
342
+				'$ref' => '#/definitions/Item',
343
+			),
344
+		), $object->toArray());
345
+	}
346
+
347
+	/**
348
+	 * @covers \SwaggerGen\Swagger\Type\ArrayType->handleCommand
349
+	 */
350
+	public function testCommandPassing()
351
+	{
352
+		$object = new SwaggerGen\Swagger\Type\ArrayType($this->parent, 'array(string)');
353 353
 
354
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
355
-
356
-        $object->handleCommand('default', 'good');
357
-
358
-        $this->assertSame(array(
359
-            'type' => 'array',
360
-            'items' => array(
361
-                'type' => 'string',
362
-                'default' => 'good',
363
-            ),
364
-        ), $object->toArray());
365
-    }
366
-
367
-    protected function setUp(): void
368
-    {
369
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
370
-    }
371
-
372
-    protected function assertPreConditions(): void
373
-    {
374
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
375
-    }
354
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ArrayType', $object);
355
+
356
+		$object->handleCommand('default', 'good');
357
+
358
+		$this->assertSame(array(
359
+			'type' => 'array',
360
+			'items' => array(
361
+				'type' => 'string',
362
+				'default' => 'good',
363
+			),
364
+		), $object->toArray());
365
+	}
366
+
367
+	protected function setUp(): void
368
+	{
369
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
370
+	}
371
+
372
+	protected function assertPreConditions(): void
373
+	{
374
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
375
+	}
376 376
 
377 377
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/ReferenceObjectTypeTest.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -6,32 +6,32 @@
 block discarded – undo
6 6
 class ReferenceObjectTypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
9
+	protected $parent;
10 10
 
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\ReferenceObjectType::__construct
13
-     */
14
-    public function testConstructBothConsumes()
15
-    {
16
-        $this->parent->handleCommand('model', 'blah');
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\ReferenceObjectType::__construct
13
+	 */
14
+	public function testConstructBothConsumes()
15
+	{
16
+		$this->parent->handleCommand('model', 'blah');
17 17
 
18
-        $object = new SwaggerGen\Swagger\Type\ReferenceObjectType($this->parent, 'blah');
18
+		$object = new SwaggerGen\Swagger\Type\ReferenceObjectType($this->parent, 'blah');
19 19
 
20
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\ReferenceObjectType', $object);
20
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\ReferenceObjectType', $object);
21 21
 
22
-        $this->assertSame(array(
23
-            '$ref' => '#/definitions/blah',
24
-        ), $object->toArray());
25
-    }
22
+		$this->assertSame(array(
23
+			'$ref' => '#/definitions/blah',
24
+		), $object->toArray());
25
+	}
26 26
 
27
-    protected function setUp(): void
28
-    {
29
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
30
-    }
27
+	protected function setUp(): void
28
+	{
29
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\Swagger');
30
+	}
31 31
 
32
-    protected function assertPreConditions(): void
33
-    {
34
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
35
-    }
32
+	protected function assertPreConditions(): void
33
+	{
34
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
35
+	}
36 36
 
37 37
 }
Please login to merge, or discard this patch.