Skip to content

Commit

Permalink
Fix PHPUnit 8 and Travis compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan.kelley committed Feb 27, 2019
1 parent c6222fe commit 73db243
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ cache:
- $HOME/.composer/cache/files

php:
- 7.0
- 7.1
- 7.2
- 7.3
- nightly

before_install:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"require-dev": {
"squizlabs/php_codesniffer": "^2.5",
"escapestudios/symfony2-coding-standard": "^2.9",
"phpunit/phpunit": "^7.5.0",
"phpunit/phpunit": "^8.0.0",
"wimg/php-compatibility": "^7.0"
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

namespace Limenius\ReactRenderer\Tests\Renderer;

use Limenius\ReactRenderer\Renderer\PhpExecJsReactRenderer;
use Limenius\ReactRenderer\Context\ContextProviderInterface;
use Psr\Log\LoggerInterface;
use Limenius\ReactRenderer\Exception\EvalJsException;
use Limenius\ReactRenderer\Renderer\PhpExecJsReactRenderer;
use Nacmartin\PhpExecJs\PhpExecJs;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;

/**
Expand All @@ -32,7 +34,7 @@ class PhpExecJsReactRendererTest extends TestCase
/**
* {@inheritdoc}
*/
public function setUp()
public function setUp(): void
{
$this->logger = $this->getMockBuilder(LoggerInterface::class)
->getMock();
Expand All @@ -47,11 +49,9 @@ public function setUp()
$this->renderer->setPhpExecJs($this->phpExecJs);
}

/**
* @expectedException \RuntimeException
*/
public function testServerBundleNotFound()
{
$this->expectException(\RuntimeException::class);
$this->renderer = new PhpExecJsReactRenderer(__DIR__.'/Fixtures/i-dont-exist.js', $this->logger, $this->contextProvider);
$this->renderer->render('MyApp', 'props', 1, null, false);
}
Expand Down Expand Up @@ -109,9 +109,6 @@ public function testReactOnRails()
$this->renderer->render('MyApp', '{msg:"It Works!"}', 1, null, true));
}

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

Expand All @@ -128,7 +126,7 @@ public function testFailLoud()
*/
public function testFailLoudBubblesThrownException()
{
$err = new \Exception('test exception');
$err = new Exception('test exception');
$this->phpExecJs->method('createContext')->willThrowException($err);
$this->renderer = new PhpExecJsReactRenderer(__DIR__.'/Fixtures/server-bundle.js', true, $this->contextProvider, $this->logger);
$this->renderer->setPhpExecJs($this->phpExecJs);
Expand Down Expand Up @@ -159,7 +157,7 @@ public function testFailQuietReturnsEmptyErrorResultOnException()
*/
public function testFailQuietLogsThrownExceptions()
{
$err = new \Exception('test exception');
$err = new Exception('test exception');
$this->phpExecJs->method('createContext')->willThrowException($err);

$this->logger
Expand Down

0 comments on commit 73db243

Please sign in to comment.