Skip to content

Commit 3fd6674

Browse files
author
Matthijs van Dorp
committed
Fix failing tests
1 parent 9a283eb commit 3fd6674

File tree

5 files changed

+15
-10
lines changed

5 files changed

+15
-10
lines changed

Diff for: phpunit.xml

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
convertWarningsToExceptions="true"
99
processIsolation="false"
1010
stopOnFailure="false"
11-
syntaxCheck="false"
1211
>
1312
<testsuites>
1413
<testsuite name="Package Test Suite">

Diff for: tests/JsLocalization/Caching/MessageCachingServiceTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ public function testGetLastRefreshTimestamp()
5454

5555
public function testRefreshMessageCacheEvent()
5656
{
57-
Event::shouldReceive('fire')->once()->with('JsLocalization.registerMessages');
57+
$this->addToAssertionCount(
58+
\Mockery::getContainer()->mockery_getExpectationCount()
59+
);
60+
61+
Event::shouldReceive('dispatch')->once()->with('JsLocalization.registerMessages');
5862

5963
MessageCachingService::refreshCache();
6064
}

Diff for: tests/JsLocalization/Console/RefreshCommandTest.php

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ public function testNoLocalesConfigException()
2020
$config->shouldReceive('get')->with('js-localization.locales')
2121
->andReturn(null);
2222

23-
24-
$this->setExpectedException('Exception');
23+
$this->expectException(Exception::class);
2524

2625
$this->runCommand();
2726
}
@@ -30,8 +29,10 @@ protected function runCommand()
3029
{
3130
$cmd = new RefreshCommand();
3231

32+
$cmd->setLaravel(resolve(\Illuminate\Contracts\Foundation\Application::class));
33+
3334
$cmd->run(
34-
new Symfony\Component\Console\Input\ArrayInput(['package' => 'foo']),
35+
new Symfony\Component\Console\Input\ArrayInput([]),
3536
new Symfony\Component\Console\Output\NullOutput
3637
);
3738
}

Diff for: tests/JsLocalization/Http/Responses/StaticFileResponseTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ public function testServingFile()
3333
public function testExceptionHandling()
3434
{
3535
$filePath = "/tmp/x/y/z/does-not-exist";
36-
$this->setExpectedException('Exception', "Cannot read file: $filePath");
36+
37+
$this->expectException(Exception::class, "Cannot read file: $filePath");
3738

3839
new StaticFileResponse($filePath);
3940
}

Diff for: tests/JsLocalization/Utils/JsLocalizationHelperTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testEventBasedAdding()
120120

121121
$this->assertEquals([], JsLocalizationHelper::getAdditionalMessages());
122122

123-
Event::fire('JsLocalization.registerMessages');
123+
Event::dispatch('JsLocalization.registerMessages');
124124

125125
$this->assertEquals(
126126
$this->additionalMessageKeysFlat,
@@ -135,7 +135,7 @@ public function testEventBasedAdding()
135135
JsLocalizationHelper::addMessagesToExport(['another']);
136136
});
137137

138-
Event::fire('JsLocalization.registerMessages');
138+
Event::dispatch('JsLocalization.registerMessages');
139139

140140
$this->assertEquals(
141141
array_merge($this->additionalMessageKeysFlat, ['another']),
@@ -164,8 +164,8 @@ public function testAddMessageFileToExportExceptionHandling()
164164
{
165165
$filePath = "/tmp/x/y/z/does-not-exist";
166166

167-
$this->setExpectedException(
168-
'JsLocalization\Exceptions\FileNotFoundException',
167+
$this->expectException(
168+
JsLocalization\Exceptions\FileNotFoundException::class,
169169
"File not found: $filePath"
170170
);
171171

0 commit comments

Comments
 (0)