Skip to content

Commit fb114be

Browse files
authored
Merge pull request #2 from peter279k/test_enhancement
Test enhancement
2 parents 03fe350 + 033c516 commit fb114be

File tree

3 files changed

+40
-35
lines changed

3 files changed

+40
-35
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ dist: trusty
33
php:
44
- '7.0'
55
- '7.1'
6+
- '7.2'
7+
- nightly
8+
matrix:
9+
allow_failures:
10+
- php: nightly
611
install:
7-
- composer update
12+
- composer install
813
script:
914
- ./vendor/bin/phpunit --coverage-clover ./tests/Logs/clover.xml
1015
after_script:
11-
- php vendor/bin/php-coveralls -v
16+
- php vendor/bin/php-coveralls -v

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"doctrine/inflector": "^1.2"
1111
},
1212
"require-dev": {
13-
"phpunit/phpunit": "^5.7",
13+
"phpunit/phpunit": "^6.5",
1414
"satooshi/php-coveralls": "^2.0"
1515
},
1616
"license": "LGPL-3.0-only",

tests/Unit/WordTest.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -123,48 +123,48 @@ public function testPortmanteaus2()
123123
$this->assertEquals($expected, $portmanteaus);
124124
}
125125

126-
private function getSingularToPluralData()
126+
public function pluraliseProvider()
127127
{
128128
return [
129-
'cat' => 'cats',
130-
'mitten' => 'mittens',
131-
'sausage' => 'sausages',
132-
'child' => 'children',
133-
'goose' => 'geese',
134-
'person' => 'people',
135-
'woman' => 'women',
136-
'man' => 'men',
137-
'audio' => 'audio',
138-
'education' => 'education',
139-
'rice' => 'rice',
140-
'love' => 'love',
141-
'pokemon' => 'pokemon',
142-
'sheep' => 'sheep',
143-
'sex' => 'sexes',
144-
'mouse' => 'mice',
145-
'mathematics' => 'mathematics',
146-
'information' => 'information',
147-
'tooth' => 'teeth',
129+
['cat', 'cats'],
130+
['mitten', 'mittens'],
131+
['sausage', 'sausages'],
132+
['child', 'children'],
133+
['goose', 'geese'],
134+
['person', 'people'],
135+
['woman', 'women'],
136+
['man', 'men'],
137+
['audio', 'audio'],
138+
['education', 'education'],
139+
['rice', 'rice'],
140+
['love', 'love'],
141+
['pokemon', 'pokemon'],
142+
['sheep', 'sheep'],
143+
['sex', 'sexes'],
144+
['mouse', 'mice'],
145+
['mathematics', 'mathematics'],
146+
['information', 'information'],
147+
['tooth', 'teeth'],
148148
];
149149
}
150150

151-
public function testPluralise()
151+
/**
152+
* @dataProvider pluraliseProvider
153+
*/
154+
public function testPluralise($singular, $plural)
152155
{
153-
$data = $this->getSingularToPluralData();
156+
$word = new Word($singular);
154157

155-
foreach ($data as $singular => $plural) {
156-
$word = new Word($singular);
157-
$this->assertEquals($plural, $word->plural());
158-
}
158+
$this->assertEquals($plural, $word->plural());
159159
}
160160

161-
public function testSingularise()
161+
/**
162+
* @dataProvider pluraliseProvider
163+
*/
164+
public function testSingularise($singular, $plural)
162165
{
163-
$data = $this->getSingularToPluralData();
166+
$word = new Word($plural);
164167

165-
foreach ($data as $singular => $plural) {
166-
$word = new Word($plural);
167-
$this->assertEquals($singular, $word->singular());
168-
}
168+
$this->assertEquals($singular, $word->singular());
169169
}
170170
}

0 commit comments

Comments
 (0)