Skip to content

Commit e9e3528

Browse files
TomasVotrubajaapio
authored andcommitted
use PHPUnit 6.0 syntax for tests
1 parent 5282c2e commit e9e3528

16 files changed

+101
-108
lines changed

tests/unit/DocBlock/StandardTagFactoryTest.php

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ public function testPassingYourOwnSetOfTagHandlers(): void
144144

145145
/**
146146
* @covers ::create
147-
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
148-
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
149-
* @expectedException \InvalidArgumentException
150-
* @expectedExceptionMessage The tag "@user[myuser" does not seem to be wellformed, please check it for errors
147+
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
148+
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
151149
*/
152-
public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void
150+
public function testExceptionIsThrownIfProvidedTagIsNotWellformed() : void
153151
{
152+
$this->expectException('InvalidArgumentException');
153+
$this->expectExceptionMessage('The tag "@user[myuser" does not seem to be wellformed, please check it for errors');
154154
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class));
155155
$tagFactory->create('@user[myuser');
156156
}
@@ -235,55 +235,51 @@ public function testRegisteringAHandlerForANewTag(): void
235235
* @covers ::registerTagHandler
236236
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
237237
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
238-
* @expectedException \InvalidArgumentException
239238
*/
240-
public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void
239+
public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void
241240
{
241+
$this->expectException('InvalidArgumentException');
242242
$resolver = m::mock(FqsenResolver::class);
243243
$tagFactory = new StandardTagFactory($resolver);
244-
245244
$tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class);
246245
}
247246

248247
/**
249248
* @covers ::registerTagHandler
250249
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
251250
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
252-
* @expectedException \InvalidArgumentException
253251
*/
254-
public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void
252+
public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void
255253
{
254+
$this->expectException('InvalidArgumentException');
256255
$resolver = m::mock(FqsenResolver::class);
257256
$tagFactory = new StandardTagFactory($resolver);
258-
259257
$tagFactory->registerTagHandler('my-tag', '');
260258
}
261259

262260
/**
263261
* @covers ::registerTagHandler
264262
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
265263
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
266-
* @expectedException \InvalidArgumentException
267264
*/
268-
public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void
265+
public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void
269266
{
267+
$this->expectException('InvalidArgumentException');
270268
$resolver = m::mock(FqsenResolver::class);
271269
$tagFactory = new StandardTagFactory($resolver);
272-
273270
$tagFactory->registerTagHandler('my-tag', 'IDoNotExist');
274271
}
275272

276273
/**
277274
* @covers ::registerTagHandler
278275
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct
279276
* @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService
280-
* @expectedException \InvalidArgumentException
281277
*/
282-
public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void
278+
public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void
283279
{
280+
$this->expectException('InvalidArgumentException');
284281
$resolver = m::mock(FqsenResolver::class);
285282
$tagFactory = new StandardTagFactory($resolver);
286-
287283
$tagFactory->registerTagHandler('my-tag', 'stdClass');
288284
}
289285

tests/unit/DocBlock/Tags/AuthorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ public function testHasTheAuthorMailAddress(): void
9797

9898
/**
9999
* @covers ::__construct
100-
* @expectedException \InvalidArgumentException
101100
*/
102-
public function testInitializationFailsIfEmailIsNotValid(): void
101+
public function testInitializationFailsIfEmailIsNotValid() : void
103102
{
103+
$this->expectException('InvalidArgumentException');
104104
new Author('Mike van Riel', 'mike');
105105
}
106106

tests/unit/DocBlock/Tags/CoversTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,10 @@ public function testFactoryMethod(): void
148148

149149
/**
150150
* @covers ::create
151-
* @expectedException \InvalidArgumentException
152151
*/
153-
public function testFactoryMethodFailsIfBodyIsNotEmpty(): void
152+
public function testFactoryMethodFailsIfBodyIsNotEmpty() : void
154153
{
154+
$this->expectException('InvalidArgumentException');
155155
$this->assertNull(Covers::create(''));
156156
}
157157
}

tests/unit/DocBlock/Tags/GenericTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,20 +127,20 @@ public function testFactoryMethod(): void
127127

128128
/**
129129
* @covers ::create
130-
* @expectedException \InvalidArgumentException
131130
*/
132-
public function testFactoryMethodFailsIfNameIsNotEmpty(): void
131+
public function testFactoryMethodFailsIfNameIsNotEmpty() : void
133132
{
133+
$this->expectException('InvalidArgumentException');
134134
Generic::create('', '');
135135
}
136136

137137
/**
138138
* @covers ::create
139139
* @covers ::__construct
140-
* @expectedException \InvalidArgumentException
141140
*/
142-
public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void
141+
public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void
143142
{
143+
$this->expectException('InvalidArgumentException');
144144
Generic::create('', 'name/myname');
145145
}
146146
}

tests/unit/DocBlock/Tags/MethodTest.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -366,73 +366,73 @@ public function testCollectionReturnTypes(
366366

367367
/**
368368
* @covers ::create
369-
* @expectedException \InvalidArgumentException
370369
*/
371-
public function testFactoryMethodFailsIfBodyIsEmpty(): void
370+
public function testFactoryMethodFailsIfBodyIsEmpty() : void
372371
{
372+
$this->expectException('InvalidArgumentException');
373373
Method::create('');
374374
}
375375

376376
/**
377377
* @covers ::create
378-
* @expectedException \InvalidArgumentException
379378
*/
380-
public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void
379+
public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void
381380
{
381+
$this->expectException('InvalidArgumentException');
382382
$this->assertNull(Method::create('body('));
383383
}
384384

385385
/**
386386
* @covers ::create
387-
* @expectedException \InvalidArgumentException
388387
*/
389-
public function testFactoryMethodFailsIfResolverIsNull(): void
388+
public function testFactoryMethodFailsIfResolverIsNull() : void
390389
{
390+
$this->expectException('InvalidArgumentException');
391391
Method::create('body');
392392
}
393393

394394
/**
395395
* @covers ::create
396-
* @expectedException \InvalidArgumentException
397396
*/
398-
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
397+
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
399398
{
399+
$this->expectException('InvalidArgumentException');
400400
Method::create('body', new TypeResolver());
401401
}
402402

403403
/**
404404
* @covers ::__construct
405-
* @expectedException \InvalidArgumentException
406405
*/
407-
public function testCreationFailsIfBodyIsNotString(): void
406+
public function testCreationFailsIfBodyIsNotString() : void
408407
{
408+
$this->expectException('InvalidArgumentException');
409409
new Method([]);
410410
}
411411

412412
/**
413413
* @covers ::__construct
414-
* @expectedException \InvalidArgumentException
415414
*/
416-
public function testCreationFailsIfBodyIsEmpty(): void
415+
public function testCreationFailsIfBodyIsEmpty() : void
417416
{
417+
$this->expectException('InvalidArgumentException');
418418
new Method('');
419419
}
420420

421421
/**
422422
* @covers ::__construct
423-
* @expectedException \InvalidArgumentException
424423
*/
425-
public function testCreationFailsIfStaticIsNotBoolean(): void
424+
public function testCreationFailsIfStaticIsNotBoolean() : void
426425
{
426+
$this->expectException('InvalidArgumentException');
427427
new Method('body', [], null, []);
428428
}
429429

430430
/**
431431
* @covers ::__construct
432-
* @expectedException \InvalidArgumentException
433432
*/
434-
public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void
433+
public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void
435434
{
435+
$this->expectException('InvalidArgumentException');
436436
new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]);
437437
}
438438

tests/unit/DocBlock/Tags/ParamTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -182,30 +182,30 @@ public function testFactoryMethod(): void
182182
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::<public>
183183
* @uses \phpDocumentor\Reflection\TypeResolver
184184
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
185-
* @expectedException \InvalidArgumentException
186185
*/
187-
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
186+
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
188187
{
188+
$this->expectException('InvalidArgumentException');
189189
$descriptionFactory = m::mock(DescriptionFactory::class);
190190
Param::create('', new TypeResolver(), $descriptionFactory);
191191
}
192192

193193
/**
194194
* @covers ::create
195-
* @expectedException \InvalidArgumentException
196195
*/
197-
public function testFactoryMethodFailsIfResolverIsNull(): void
196+
public function testFactoryMethodFailsIfResolverIsNull() : void
198197
{
198+
$this->expectException('InvalidArgumentException');
199199
Param::create('body');
200200
}
201201

202202
/**
203203
* @covers ::create
204204
* @uses \phpDocumentor\Reflection\TypeResolver
205-
* @expectedException \InvalidArgumentException
206205
*/
207-
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
206+
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
208207
{
208+
$this->expectException('InvalidArgumentException');
209209
Param::create('body', new TypeResolver());
210210
}
211211
}

tests/unit/DocBlock/Tags/PropertyReadTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,30 @@ public function testFactoryMethod(): void
168168
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::<public>
169169
* @uses \phpDocumentor\Reflection\TypeResolver
170170
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
171-
* @expectedException \InvalidArgumentException
172171
*/
173-
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
172+
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
174173
{
174+
$this->expectException('InvalidArgumentException');
175175
$descriptionFactory = m::mock(DescriptionFactory::class);
176176
PropertyRead::create('', new TypeResolver(), $descriptionFactory);
177177
}
178178

179179
/**
180180
* @covers ::create
181-
* @expectedException \InvalidArgumentException
182181
*/
183-
public function testFactoryMethodFailsIfResolverIsNull(): void
182+
public function testFactoryMethodFailsIfResolverIsNull() : void
184183
{
184+
$this->expectException('InvalidArgumentException');
185185
PropertyRead::create('body');
186186
}
187187

188188
/**
189189
* @covers ::create
190190
* @uses \phpDocumentor\Reflection\TypeResolver
191-
* @expectedException \InvalidArgumentException
192191
*/
193-
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
192+
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
194193
{
194+
$this->expectException('InvalidArgumentException');
195195
PropertyRead::create('body', new TypeResolver());
196196
}
197197
}

tests/unit/DocBlock/Tags/PropertyTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,30 +163,30 @@ public function testFactoryMethod(): void
163163
* @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::<public>
164164
* @uses \phpDocumentor\Reflection\TypeResolver
165165
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
166-
* @expectedException \InvalidArgumentException
167166
*/
168-
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
167+
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
169168
{
169+
$this->expectException('InvalidArgumentException');
170170
$descriptionFactory = m::mock(DescriptionFactory::class);
171171
Property::create('', new TypeResolver(), $descriptionFactory);
172172
}
173173

174174
/**
175175
* @covers ::create
176-
* @expectedException \InvalidArgumentException
177176
*/
178-
public function testFactoryMethodFailsIfResolverIsNull(): void
177+
public function testFactoryMethodFailsIfResolverIsNull() : void
179178
{
179+
$this->expectException('InvalidArgumentException');
180180
Property::create('body');
181181
}
182182

183183
/**
184184
* @covers ::create
185185
* @uses \phpDocumentor\Reflection\TypeResolver
186-
* @expectedException \InvalidArgumentException
187186
*/
188-
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
187+
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
189188
{
189+
$this->expectException('InvalidArgumentException');
190190
Property::create('body', new TypeResolver());
191191
}
192192
}

tests/unit/DocBlock/Tags/PropertyWriteTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,30 @@ public function testFactoryMethod(): void
168168
* @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::<public>
169169
* @uses \phpDocumentor\Reflection\TypeResolver
170170
* @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory
171-
* @expectedException \InvalidArgumentException
172171
*/
173-
public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void
172+
public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void
174173
{
174+
$this->expectException('InvalidArgumentException');
175175
$descriptionFactory = m::mock(DescriptionFactory::class);
176176
PropertyWrite::create('', new TypeResolver(), $descriptionFactory);
177177
}
178178

179179
/**
180180
* @covers ::create
181-
* @expectedException \InvalidArgumentException
182181
*/
183-
public function testFactoryMethodFailsIfResolverIsNull(): void
182+
public function testFactoryMethodFailsIfResolverIsNull() : void
184183
{
184+
$this->expectException('InvalidArgumentException');
185185
PropertyWrite::create('body');
186186
}
187187

188188
/**
189189
* @covers ::create
190190
* @uses \phpDocumentor\Reflection\TypeResolver
191-
* @expectedException \InvalidArgumentException
192191
*/
193-
public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void
192+
public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void
194193
{
194+
$this->expectException('InvalidArgumentException');
195195
PropertyWrite::create('body', new TypeResolver());
196196
}
197197
}

0 commit comments

Comments
 (0)