Skip to content

Commit 23165f8

Browse files
authoredMar 22, 2019
Merge pull request #104 from basz/test-latest-php-versions
Run tests for php 7.2 and 7.3
2 parents ddc7f55 + b1b4e81 commit 23165f8

File tree

5 files changed

+42
-13
lines changed

5 files changed

+42
-13
lines changed
 

‎.travis.yml

+15-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,25 @@ matrix:
2222
- php: 7.1
2323
env:
2424
- DEPENDENCIES="--prefer-stable"
25-
- TEST_COVERAGE=true
2625
- php: 7.1
2726
env:
2827
- DEPENDENCIES="--prefer-lowest --prefer-stable"
2928

29+
- php: 7.2
30+
env:
31+
- DEPENDENCIES="--prefer-stable"
32+
- php: 7.2
33+
env:
34+
- DEPENDENCIES="--prefer-lowest --prefer-stable"
35+
36+
- php: 7.3
37+
env:
38+
- DEPENDENCIES="--prefer-stable"
39+
- TEST_COVERAGE=true
40+
- php: 7.3
41+
env:
42+
- DEPENDENCIES="--prefer-lowest --prefer-stable"
43+
3044

3145
before_script:
3246
- phpenv config-rm xdebug.ini

‎composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@
2525
"zendframework/zend-modulemanager": "^2.8.2",
2626
"zendframework/zend-router": "^3.0",
2727
"zendframework/zend-servicemanager": "^3.2",
28-
"zendframework/zend-stdlib": "^3.1",
28+
"zendframework/zend-stdlib": "^3.2.1",
2929
"zendframework/zend-view": "^2.9.0"
3030
},
3131
"require-dev": {
3232
"friendsofphp/php-cs-fixer": "^2.8.1",
33-
"phpunit/phpunit": "^4.8.36",
33+
"phpunit/phpunit": "^5.7.27",
3434
"satooshi/php-coveralls": "^1.0.2",
3535
"zendframework/zend-console": "^2.6",
3636
"zendframework/zend-mvc": "^3.1",

‎phpunit.xml.dist

+6
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@
44
<testsuite name="SlmLocale">
55
<directory>./tests</directory>
66
</testsuite>
7+
8+
<filter>
9+
<whitelist processUncoveredFilesFromWhitelist="true">
10+
<directory suffix=".php">src</directory>
11+
</whitelist>
12+
</filter>
713
</phpunit>

‎tests/SlmLocaleTest/Locale/DetectorTest.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ public function testEmptyMappingsListIndicatesNoMappingsList()
202202
public function testStrategyAttachesToEventManager()
203203
{
204204
$detector = new Detector();
205-
$events = $this->getMock(EventManager::class);
206-
$strategy = $this->getMock(StrategyInterface::class);
205+
$events = $this->createMock(EventManager::class);
206+
$strategy = $this->createMock(StrategyInterface::class);
207207
$strategy->expects($this->once())
208208
->method('attach')
209209
->with($events);
@@ -217,12 +217,18 @@ public function testStrategyWithHighestPriorityWins()
217217
$detector = new Detector();
218218
$this->setEventManager($detector);
219219

220-
$strategy1 = $this->getMock(AbstractStrategy::class, ['detect']);
220+
$strategy1 = $this
221+
->getMockBuilder(AbstractStrategy::class)
222+
->setMethods(['detect'])
223+
->getMock();
221224
$strategy1->expects($this->once())
222225
->method('detect')
223226
->will($this->returnValue('Foo'));
224227

225-
$strategy2 = $this->getMock(AbstractStrategy::class, ['detect']);
228+
$strategy2 = $this
229+
->getMockBuilder(AbstractStrategy::class)
230+
->setMethods(['detect'])
231+
->getMock();
226232
$strategy2->expects($this->never())
227233
->method('detect');
228234

‎tests/SlmLocaleTest/Service/DetectFactoryTest.php

+9-6
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function testUseServiceLocatorToInstantiateStrategy()
125125
$plugins->setFactory('TestStrategy', function () use ($self, &$called) {
126126
$called = true;
127127

128-
return $self->getMock(StrategyInterface::class);
128+
return $self->createMock(StrategyInterface::class);
129129
});
130130

131131
$detector = $sl->get(Detector::class);
@@ -144,14 +144,14 @@ public function testConfigurationCanHoldMultipleStrategies()
144144
$plugins->setFactory('TestStrategy1', function () use ($self, &$called1) {
145145
$called1 = true;
146146

147-
return $self->getMock(StrategyInterface::class);
147+
return $self->createMock(StrategyInterface::class);
148148
});
149149

150150
$called2 = false;
151151
$plugins->setFactory('TestStrategy2', function () use ($self, &$called2) {
152152
$called2 = true;
153153

154-
return $self->getMock(StrategyInterface::class);
154+
return $self->createMock(StrategyInterface::class);
155155
});
156156

157157
$detector = $sl->get(Detector::class);
@@ -173,7 +173,7 @@ public function testStrategyConfigurationCanBeAnArray()
173173
$plugins->setFactory('TestStrategy', function () use ($self, &$called) {
174174
$called = true;
175175

176-
return $self->getMock(StrategyInterface::class);
176+
return $self->createMock(StrategyInterface::class);
177177
});
178178

179179
$detector = $sl->get(Detector::class);
@@ -189,7 +189,7 @@ public function testStrategyCanBeAttachedWithPriorities()
189189
]);
190190
$em = $sl->get('EventManager');
191191

192-
$strategy = $this->getMock(StrategyInterface::class, ['attach', 'detach']);
192+
$strategy = $this->createMock(StrategyInterface::class, ['attach', 'detach']);
193193
$strategy->expects($this->once())
194194
->method('attach')
195195
->with($em, 100);
@@ -206,7 +206,10 @@ public function testStrategyCanBeInstantiatedWithOptions()
206206
['name' => 'TestStrategy', 'options' => 'Foo'],
207207
],
208208
]);
209-
$strategy = $this->getMock(StrategyInterface::class, ['attach', 'detach', 'setOptions']);
209+
210+
$strategy = $this->getMockBuilder(StrategyInterface::class)
211+
->setMethods(['attach', 'detach', 'setOptions'])
212+
->getMock();
210213
$strategy->expects($this->once())
211214
->method('setOptions')
212215
->with('Foo');

0 commit comments

Comments
 (0)