Skip to content

Commit 73db243

Browse files
author
ryan.kelley
committed
Fix PHPUnit 8 and Travis compatability
1 parent c6222fe commit 73db243

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ cache:
77
- $HOME/.composer/cache/files
88

99
php:
10-
- 7.0
1110
- 7.1
1211
- 7.2
12+
- 7.3
1313
- nightly
1414

1515
before_install:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"require-dev": {
2929
"squizlabs/php_codesniffer": "^2.5",
3030
"escapestudios/symfony2-coding-standard": "^2.9",
31-
"phpunit/phpunit": "^7.5.0",
31+
"phpunit/phpunit": "^8.0.0",
3232
"wimg/php-compatibility": "^7.0"
3333
},
3434
"scripts": {

tests/Limenius/ReactRenderer/Tests/Renderer/PhpExecJsReactRendererTest.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
namespace Limenius\ReactRenderer\Tests\Renderer;
44

5-
use Limenius\ReactRenderer\Renderer\PhpExecJsReactRenderer;
65
use Limenius\ReactRenderer\Context\ContextProviderInterface;
7-
use Psr\Log\LoggerInterface;
6+
use Limenius\ReactRenderer\Exception\EvalJsException;
7+
use Limenius\ReactRenderer\Renderer\PhpExecJsReactRenderer;
88
use Nacmartin\PhpExecJs\PhpExecJs;
9+
use PHPUnit\Framework\Exception;
910
use PHPUnit\Framework\TestCase;
11+
use Psr\Log\LoggerInterface;
1012
use Psr\Log\LogLevel;
1113

1214
/**
@@ -32,7 +34,7 @@ class PhpExecJsReactRendererTest extends TestCase
3234
/**
3335
* {@inheritdoc}
3436
*/
35-
public function setUp()
37+
public function setUp(): void
3638
{
3739
$this->logger = $this->getMockBuilder(LoggerInterface::class)
3840
->getMock();
@@ -47,11 +49,9 @@ public function setUp()
4749
$this->renderer->setPhpExecJs($this->phpExecJs);
4850
}
4951

50-
/**
51-
* @expectedException \RuntimeException
52-
*/
5352
public function testServerBundleNotFound()
5453
{
54+
$this->expectException(\RuntimeException::class);
5555
$this->renderer = new PhpExecJsReactRenderer(__DIR__.'/Fixtures/i-dont-exist.js', $this->logger, $this->contextProvider);
5656
$this->renderer->render('MyApp', 'props', 1, null, false);
5757
}
@@ -109,9 +109,6 @@ public function testReactOnRails()
109109
$this->renderer->render('MyApp', '{msg:"It Works!"}', 1, null, true));
110110
}
111111

112-
/**
113-
* @expectedException \Limenius\ReactRenderer\Exception\EvalJsException
114-
*/
115112
public function testFailLoud()
116113
{
117114
$phpExecJs = $this->getMockBuilder(PhpExecJs::class)
@@ -120,6 +117,7 @@ public function testFailLoud()
120117
->willReturn('{ "html" : "go for it", "hasErrors" : true, "consoleReplayScript": " - my replay"}');
121118
$this->renderer = new PhpExecJsReactRenderer(__DIR__.'/Fixtures/server-bundle.js', true, $this->contextProvider, $this->logger);
122119
$this->renderer->setPhpExecJs($phpExecJs);
120+
$this->expectException(EvalJsException::class);
123121
$this->renderer->render('MyApp', 'props', 1, null, true);
124122
}
125123

@@ -128,7 +126,7 @@ public function testFailLoud()
128126
*/
129127
public function testFailLoudBubblesThrownException()
130128
{
131-
$err = new \Exception('test exception');
129+
$err = new Exception('test exception');
132130
$this->phpExecJs->method('createContext')->willThrowException($err);
133131
$this->renderer = new PhpExecJsReactRenderer(__DIR__.'/Fixtures/server-bundle.js', true, $this->contextProvider, $this->logger);
134132
$this->renderer->setPhpExecJs($this->phpExecJs);
@@ -159,7 +157,7 @@ public function testFailQuietReturnsEmptyErrorResultOnException()
159157
*/
160158
public function testFailQuietLogsThrownExceptions()
161159
{
162-
$err = new \Exception('test exception');
160+
$err = new Exception('test exception');
163161
$this->phpExecJs->method('createContext')->willThrowException($err);
164162

165163
$this->logger

0 commit comments

Comments
 (0)