Completed
Push — master ( fcb010...ba73f2 )
by Martijn
19s
created
tests/Swagger/AbstractObjectTest.php 1 patch
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -6,84 +6,84 @@
 block discarded – undo
6 6
 class AbstractObjectTest extends TestCase
7 7
 {
8 8
 
9
-    /**
10
-     * @covers \SwaggerGen\Swagger\AbstractObject::words_shift
11
-     */
12
-    public function testWords_shift()
13
-    {
14
-        $text = 'quite a few words';
15
-
16
-        $this->assertSame('quite', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
17
-        $this->assertSame('a few words', $text);
18
-
19
-        $this->assertSame('a', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
20
-        $this->assertSame('few words', $text);
21
-
22
-        $this->assertSame('few', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
23
-        $this->assertSame('words', $text);
24
-
25
-        $this->assertSame('words', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
26
-        $this->assertSame('', $text);
27
-
28
-        $this->assertSame(false, \SwaggerGen\Swagger\AbstractObject::wordShift($text));
29
-        $this->assertSame('', $text);
30
-    }
31
-
32
-    /**
33
-     * @covers \SwaggerGen\Swagger\AbstractObject::words_shift
34
-     */
35
-    public function testWords_shift_whitespace()
36
-    {
37
-        $text = "    quite  a\nfew   \r  \n\r words \t";
38
-
39
-        $this->assertSame('quite', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
40
-        $this->assertSame('a', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
41
-        $this->assertSame('few', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
42
-        $this->assertSame('words', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
43
-        $this->assertSame(false, \SwaggerGen\Swagger\AbstractObject::wordShift($text));
44
-        $this->assertSame('', $text);
45
-    }
46
-
47
-    /**
48
-     * @covers \SwaggerGen\Swagger\AbstractObject::mb_trim
49
-     */
50
-    public function testMb_trim()
51
-    {
52
-        $this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("trimmed"));
53
-        $this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("trimmed "));
54
-        $this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim(" trimmed"));
55
-        $this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("   trimmed   "));
56
-        $this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("\n \t trimmed \f \r"));
57
-    }
58
-
59
-    /**
60
-     * @covers \SwaggerGen\Swagger\AbstractObject::toArray
61
-     */
62
-    public function testToArray()
63
-    {
64
-        $object = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
65
-
66
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $object);
67
-
68
-        $this->assertSame(array(), $object->toArray());
69
-    }
70
-
71
-    /**
72
-     * @covers \SwaggerGen\Swagger\AbstractObject::handleCommand
73
-     */
74
-    public function testCommandExtensions()
75
-    {
76
-        $object = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
77
-
78
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $object);
79
-
80
-        $object->handleCommand('x-someTag', 'some value');
81
-        $object->handleCommand('x-anyTag', 'any value');
82
-
83
-        $this->assertSame(array(
84
-            'x-someTag' => 'some value',
85
-            'x-anyTag' => 'any value',
86
-        ), $object->toArray());
87
-    }
9
+	/**
10
+	 * @covers \SwaggerGen\Swagger\AbstractObject::words_shift
11
+	 */
12
+	public function testWords_shift()
13
+	{
14
+		$text = 'quite a few words';
15
+
16
+		$this->assertSame('quite', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
17
+		$this->assertSame('a few words', $text);
18
+
19
+		$this->assertSame('a', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
20
+		$this->assertSame('few words', $text);
21
+
22
+		$this->assertSame('few', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
23
+		$this->assertSame('words', $text);
24
+
25
+		$this->assertSame('words', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
26
+		$this->assertSame('', $text);
27
+
28
+		$this->assertSame(false, \SwaggerGen\Swagger\AbstractObject::wordShift($text));
29
+		$this->assertSame('', $text);
30
+	}
31
+
32
+	/**
33
+	 * @covers \SwaggerGen\Swagger\AbstractObject::words_shift
34
+	 */
35
+	public function testWords_shift_whitespace()
36
+	{
37
+		$text = "    quite  a\nfew   \r  \n\r words \t";
38
+
39
+		$this->assertSame('quite', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
40
+		$this->assertSame('a', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
41
+		$this->assertSame('few', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
42
+		$this->assertSame('words', \SwaggerGen\Swagger\AbstractObject::wordShift($text));
43
+		$this->assertSame(false, \SwaggerGen\Swagger\AbstractObject::wordShift($text));
44
+		$this->assertSame('', $text);
45
+	}
46
+
47
+	/**
48
+	 * @covers \SwaggerGen\Swagger\AbstractObject::mb_trim
49
+	 */
50
+	public function testMb_trim()
51
+	{
52
+		$this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("trimmed"));
53
+		$this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("trimmed "));
54
+		$this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim(" trimmed"));
55
+		$this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("   trimmed   "));
56
+		$this->assertSame('trimmed', \SwaggerGen\Swagger\AbstractObject::trim("\n \t trimmed \f \r"));
57
+	}
58
+
59
+	/**
60
+	 * @covers \SwaggerGen\Swagger\AbstractObject::toArray
61
+	 */
62
+	public function testToArray()
63
+	{
64
+		$object = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
65
+
66
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $object);
67
+
68
+		$this->assertSame(array(), $object->toArray());
69
+	}
70
+
71
+	/**
72
+	 * @covers \SwaggerGen\Swagger\AbstractObject::handleCommand
73
+	 */
74
+	public function testCommandExtensions()
75
+	{
76
+		$object = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
77
+
78
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $object);
79
+
80
+		$object->handleCommand('x-someTag', 'some value');
81
+		$object->handleCommand('x-anyTag', 'any value');
82
+
83
+		$this->assertSame(array(
84
+			'x-someTag' => 'some value',
85
+			'x-anyTag' => 'any value',
86
+		), $object->toArray());
87
+	}
88 88
 
89 89
 }
Please login to merge, or discard this patch.
tests/Swagger/Type/Custom/Ipv4TypeTest.php 1 patch
Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -6,138 +6,138 @@
 block discarded – undo
6 6
 class Ipv4TypeTest extends TestCase
7 7
 {
8 8
 
9
-    protected $parent;
10
-
11
-    /**
12
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
13
-     */
14
-    public function testConstructNotAnIpv4()
15
-    {
16
-        $this->expectException('\SwaggerGen\Exception', "Not an IPv4: 'wrong'");
17
-
18
-        new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'wrong');
19
-    }
20
-
21
-    /**
22
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
23
-     */
24
-    public function testConstruct()
25
-    {
26
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4');
27
-
28
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
29
-
30
-        $this->assertSame(array(
31
-            'type' => 'string',
32
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv4Type::PATTERN,
33
-        ), $object->toArray());
34
-    }
35
-
36
-    /**
37
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
38
-     */
39
-    public function testConstructEmptyDefault()
40
-    {
41
-        $this->expectException('\SwaggerGen\Exception', "Unparseable IPv4 definition: 'ipv4='");
42
-
43
-        new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4= ');
44
-    }
45
-
46
-    /**
47
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
48
-     */
49
-    public function testConstructDefaultRange()
50
-    {
51
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: '127.0.256.0'");
52
-
53
-        new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=127.0.256.0');
54
-    }
55
-
56
-    /**
57
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
58
-     */
59
-    public function testConstructDefault3Numbers()
60
-    {
61
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: '0.0.0'");
62
-
63
-        new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=0.0.0');
64
-    }
65
-
66
-    /**
67
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
68
-     */
69
-    public function testConstructDefault5Numbers()
70
-    {
71
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: '0.0.0.0.0'");
72
-
73
-        new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=0.0.0.0.0');
74
-    }
75
-
76
-    /**
77
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
78
-     */
79
-    public function testConstructDefaultUntrimmed()
80
-    {
81
-        $this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: ' 0.0.0.0.0'");
82
-
83
-        new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4= 0.0.0.0.0');
84
-    }
85
-
86
-    /**
87
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
88
-     */
89
-    public function testConstructDefault()
90
-    {
91
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=123.45.67.89');
92
-
93
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
94
-
95
-        $this->assertSame(array(
96
-            'type' => 'string',
97
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv4Type::PATTERN,
98
-            'default' => '123.45.67.89',
99
-        ), $object->toArray());
100
-    }
101
-
102
-    /**
103
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type->handleCommand
104
-     */
105
-    public function testCommandDefaultNoValue()
106
-    {
107
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4');
108
-
109
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
110
-
111
-        $this->expectException('\SwaggerGen\Exception', "Empty IPv4 default");
112
-        $object->handleCommand('default', '');
113
-    }
114
-
115
-    /**
116
-     * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type->handleCommand
117
-     */
118
-    public function testCommandDefault()
119
-    {
120
-        $object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4');
121
-
122
-        $this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
123
-
124
-        $object->handleCommand('default', '123.45.67.89');
125
-
126
-        $this->assertSame(array(
127
-            'type' => 'string',
128
-            'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv4Type::PATTERN,
129
-            'default' => '123.45.67.89',
130
-        ), $object->toArray());
131
-    }
132
-
133
-    protected function setUp(): void
134
-    {
135
-        $this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
136
-    }
137
-
138
-    protected function assertPreConditions(): void
139
-    {
140
-        $this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
141
-    }
9
+	protected $parent;
10
+
11
+	/**
12
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
13
+	 */
14
+	public function testConstructNotAnIpv4()
15
+	{
16
+		$this->expectException('\SwaggerGen\Exception', "Not an IPv4: 'wrong'");
17
+
18
+		new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'wrong');
19
+	}
20
+
21
+	/**
22
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
23
+	 */
24
+	public function testConstruct()
25
+	{
26
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4');
27
+
28
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
29
+
30
+		$this->assertSame(array(
31
+			'type' => 'string',
32
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv4Type::PATTERN,
33
+		), $object->toArray());
34
+	}
35
+
36
+	/**
37
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
38
+	 */
39
+	public function testConstructEmptyDefault()
40
+	{
41
+		$this->expectException('\SwaggerGen\Exception', "Unparseable IPv4 definition: 'ipv4='");
42
+
43
+		new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4= ');
44
+	}
45
+
46
+	/**
47
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
48
+	 */
49
+	public function testConstructDefaultRange()
50
+	{
51
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: '127.0.256.0'");
52
+
53
+		new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=127.0.256.0');
54
+	}
55
+
56
+	/**
57
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
58
+	 */
59
+	public function testConstructDefault3Numbers()
60
+	{
61
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: '0.0.0'");
62
+
63
+		new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=0.0.0');
64
+	}
65
+
66
+	/**
67
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
68
+	 */
69
+	public function testConstructDefault5Numbers()
70
+	{
71
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: '0.0.0.0.0'");
72
+
73
+		new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=0.0.0.0.0');
74
+	}
75
+
76
+	/**
77
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
78
+	 */
79
+	public function testConstructDefaultUntrimmed()
80
+	{
81
+		$this->expectException('\SwaggerGen\Exception', "Invalid IPv4 default value: ' 0.0.0.0.0'");
82
+
83
+		new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4= 0.0.0.0.0');
84
+	}
85
+
86
+	/**
87
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type::__construct
88
+	 */
89
+	public function testConstructDefault()
90
+	{
91
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4=123.45.67.89');
92
+
93
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
94
+
95
+		$this->assertSame(array(
96
+			'type' => 'string',
97
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv4Type::PATTERN,
98
+			'default' => '123.45.67.89',
99
+		), $object->toArray());
100
+	}
101
+
102
+	/**
103
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type->handleCommand
104
+	 */
105
+	public function testCommandDefaultNoValue()
106
+	{
107
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4');
108
+
109
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
110
+
111
+		$this->expectException('\SwaggerGen\Exception', "Empty IPv4 default");
112
+		$object->handleCommand('default', '');
113
+	}
114
+
115
+	/**
116
+	 * @covers \SwaggerGen\Swagger\Type\Custom\Ipv4Type->handleCommand
117
+	 */
118
+	public function testCommandDefault()
119
+	{
120
+		$object = new SwaggerGen\Swagger\Type\Custom\Ipv4Type($this->parent, 'ipv4');
121
+
122
+		$this->assertInstanceOf('\SwaggerGen\Swagger\Type\Custom\Ipv4Type', $object);
123
+
124
+		$object->handleCommand('default', '123.45.67.89');
125
+
126
+		$this->assertSame(array(
127
+			'type' => 'string',
128
+			'pattern' => \SwaggerGen\Swagger\Type\Custom\Ipv4Type::PATTERN,
129
+			'default' => '123.45.67.89',
130
+		), $object->toArray());
131
+	}
132
+
133
+	protected function setUp(): void
134
+	{
135
+		$this->parent = $this->getMockForAbstractClass('\SwaggerGen\Swagger\AbstractObject');
136
+	}
137
+
138
+	protected function assertPreConditions(): void
139
+	{
140
+		$this->assertInstanceOf('\SwaggerGen\Swagger\AbstractObject', $this->parent);
141
+	}
142 142
 
143 143
 }
Please login to merge, or discard this patch.
tests/Swagger/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.