Skip to content

Commit d899715

Browse files
committed
Test cleanup
1 parent 44235df commit d899715

File tree

5 files changed

+381
-579
lines changed

5 files changed

+381
-579
lines changed

Tests/InflectorTest.php

Lines changed: 25 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,7 @@ protected function tearDown(): void
103103
}
104104

105105
/**
106-
* Method to test Inflector::addRule().
107-
*
108-
* @return void
109-
*
110-
* @covers Joomla\String\Inflector::addRule
111-
* @since 1.0
106+
* @testdox A rule cannot be added to the inflector if it is of an unsupported type
112107
*/
113108
public function testAddRuleException()
114109
{
@@ -118,12 +113,7 @@ public function testAddRuleException()
118113
}
119114

120115
/**
121-
* Method to test Inflector::addCountableRule().
122-
*
123-
* @return void
124-
*
125-
* @covers Joomla\String\Inflector::addCountableRule
126-
* @since 1.0
116+
* @testdox A countable rule can be added to the inflector
127117
*/
128118
public function testAddCountableRule()
129119
{
@@ -151,12 +141,7 @@ public function testAddCountableRule()
151141
}
152142

153143
/**
154-
* Method to test Inflector::addWord().
155-
*
156-
* @return void
157-
*
158-
* @covers Joomla\String\Inflector::addWord
159-
* @since 1.2.0
144+
* @testdox A word can be added to the inflector without a plural form
160145
*/
161146
public function testAddWordWithoutPlural()
162147
{
@@ -179,12 +164,7 @@ public function testAddWordWithoutPlural()
179164
}
180165

181166
/**
182-
* Method to test Inflector::addWord().
183-
*
184-
* @return void
185-
*
186-
* @covers Joomla\String\Inflector::addWord
187-
* @since 1.2.0
167+
* @testdox A word can be added to the inflector with a plural form
188168
*/
189169
public function testAddWordWithPlural()
190170
{
@@ -209,12 +189,7 @@ public function testAddWordWithPlural()
209189
}
210190

211191
/**
212-
* Method to test Inflector::addPluraliseRule().
213-
*
214-
* @return void
215-
*
216-
* @covers Joomla\String\Inflector::addPluraliseRule
217-
* @since 1.0
192+
* @testdox A pluralisation rule can be added to the inflector
218193
*/
219194
public function testAddPluraliseRule()
220195
{
@@ -234,12 +209,7 @@ public function testAddPluraliseRule()
234209
}
235210

236211
/**
237-
* Method to test Inflector::addSingulariseRule().
238-
*
239-
* @return void
240-
*
241-
* @covers Joomla\String\Inflector::addSingulariseRule
242-
* @since 1.0
212+
* @testdox A singularisation rule can be added to the inflector
243213
*/
244214
public function testAddSingulariseRule()
245215
{
@@ -259,70 +229,48 @@ public function testAddSingulariseRule()
259229
}
260230

261231
/**
262-
* Method to test Inflector::getInstance().
263-
*
264-
* @return void
265-
*
266-
* @covers Joomla\String\Inflector::getInstance
267-
* @since 1.0
232+
* @testdox The singleton instance of the inflector can be retrieved
268233
*/
269234
public function testGetInstance()
270235
{
271236
$this->assertInstanceOf(
272-
'Joomla\\String\\Inflector',
237+
Inflector::class,
273238
Inflector::getInstance(),
274239
'Check getInstance returns the right class.'
275240
);
276241

277-
// Inject an instance an test.
278-
TestHelper::setValue($this->inflector, 'instance', new \stdClass);
279-
280-
$this->assertThat(
242+
$this->assertNotSame(
281243
Inflector::getInstance(),
282-
$this->equalTo(new \stdClass),
283-
'Checks singleton instance is returned.'
284-
);
285-
286-
$this->assertInstanceOf(
287-
'Joomla\\String\\Inflector',
288244
Inflector::getInstance(true),
289-
'Check getInstance a fresh object with true argument even though the instance is set to something else.'
245+
'getInstance with the new flag should not return the singleton instance'
290246
);
291247
}
292248

293249
/**
294-
* Method to test Inflector::isCountable().
250+
* @testdox A string is checked to determine if it a countable word
295251
*
296252
* @param string $input A string.
297253
* @param boolean $expected The expected result of the function call.
298254
*
299-
* @return void
300-
*
301-
* @covers Joomla\String\Inflector::isCountable
302255
* @dataProvider seedIsCountable
303-
* @since 1.0
304256
*/
305-
public function testIsCountable($input, $expected)
257+
public function testIsCountable(string $input, bool $expected)
306258
{
307-
$this->assertThat(
308-
$this->inflector->isCountable($input),
309-
$this->equalTo($expected)
259+
$this->assertEquals(
260+
$expected,
261+
$this->inflector->isCountable($input)
310262
);
311263
}
312264

313265
/**
314-
* Method to test Inflector::isPlural().
266+
* @testdox A string is checked to determine if it is in plural form
315267
*
316268
* @param string $singular The singular form of a word.
317269
* @param string $plural The plural form of a word.
318270
*
319-
* @return void
320-
*
321-
* @covers Joomla\String\Inflector::isPlural
322271
* @dataProvider seedSinglePlural
323-
* @since 1.0
324272
*/
325-
public function testIsPlural($singular, $plural)
273+
public function testIsPlural(string $singular, string $plural)
326274
{
327275
$this->assertTrue(
328276
$this->inflector->isPlural($plural),
@@ -339,18 +287,14 @@ public function testIsPlural($singular, $plural)
339287
}
340288

341289
/**
342-
* Method to test Inflector::isSingular().
290+
* @testdox A string is checked to determine if it is in singular form
343291
*
344292
* @param string $singular The singular form of a word.
345293
* @param string $plural The plural form of a word.
346294
*
347-
* @return void
348-
*
349-
* @covers Joomla\String\Inflector::isSingular
350295
* @dataProvider seedSinglePlural
351-
* @since 1.0
352296
*/
353-
public function testIsSingular($singular, $plural)
297+
public function testIsSingular(string $singular, string $plural)
354298
{
355299
$this->assertTrue(
356300
$this->inflector->isSingular($singular),
@@ -367,18 +311,14 @@ public function testIsSingular($singular, $plural)
367311
}
368312

369313
/**
370-
* Method to test Inflector::toPlural().
314+
* @testdox A string is converted to its plural form
371315
*
372316
* @param string $singular The singular form of a word.
373317
* @param string $plural The plural form of a word.
374318
*
375-
* @return void
376-
*
377-
* @covers Joomla\String\Inflector::toPlural
378319
* @dataProvider seedSinglePlural
379-
* @since 1.0
380320
*/
381-
public function testToPlural($singular, $plural)
321+
public function testToPlural(string $singular, string $plural)
382322
{
383323
$this->assertSame(
384324
$plural,
@@ -388,12 +328,7 @@ public function testToPlural($singular, $plural)
388328
}
389329

390330
/**
391-
* Method to test Inflector::toPlural().
392-
*
393-
* @return void
394-
*
395-
* @covers Joomla\String\Inflector::toPlural
396-
* @since 1.2.0
331+
* @testdox A string that is already plural is returned in the same form
397332
*/
398333
public function testToPluralAlreadyPlural()
399334
{
@@ -405,18 +340,14 @@ public function testToPluralAlreadyPlural()
405340
}
406341

407342
/**
408-
* Method to test Inflector::toSingular().
343+
* @testdox A string is converted to its singular form
409344
*
410345
* @param string $singular The singular form of a word.
411346
* @param string $plural The plural form of a word.
412347
*
413-
* @return void
414-
*
415-
* @covers Joomla\String\Inflector::toSingular
416348
* @dataProvider seedSinglePlural
417-
* @since 1.0
418349
*/
419-
public function testToSingular($singular, $plural)
350+
public function testToSingular(string $singular, string $plural)
420351
{
421352
$this->assertSame(
422353
$singular,
@@ -426,12 +357,7 @@ public function testToSingular($singular, $plural)
426357
}
427358

428359
/**
429-
* Method to test Inflector::toSingular().
430-
*
431-
* @return void
432-
*
433-
* @covers Joomla\String\Inflector::toSingular
434-
* @since 1.2.0
360+
* @testdox A string that is already singular is returned in the same form
435361
*/
436362
public function testToSingularAlreadySingular()
437363
{

0 commit comments

Comments
 (0)