Skip to content

Commit

Permalink
Fixes 5.5 compatibility.
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
  • Loading branch information
crynobone committed Mar 1, 2020
1 parent 7ad98c2 commit 79aa95f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -21,13 +21,13 @@
},
"require": {
"php": ">=7.1",
"illuminate/support": "^5.6 || ^6.0 || ^7.0",
"illuminate/support": "^5.5 || ^6.0 || ^7.0",
"jakub-onderka/php-console-color": "~0.2",
"react/stream": "^1.1"
},
"require-dev": {
"mockery/mockery": "^1.3.1",
"orchestra/testbench": "^3.6 || ^4.0 || ^5.0"
"orchestra/testbench": "^3.5 || ^4.0 || ^5.0"
},
"config": {
"sort-packages": true
Expand Down
3 changes: 1 addition & 2 deletions tests/Feature/StreamServiceProviderTest.php
Expand Up @@ -6,7 +6,6 @@
use React\Stream\ThroughStream;
use React\Stream\WritableResourceStream;
use React\Stream\WritableStreamInterface;
use SebastianBergmann\Environment\OperatingSystem;

class StreamServiceProviderTest extends TestCase
{
Expand All @@ -20,7 +19,7 @@ public function it_provides_proper_services()

$writable = $this->app->make(WritableStreamInterface::class);

if ((new OperatingSystem())->getFamily() === 'Windows') {
if (DIRECTORY_SEPARATOR !== '/') {
$this->assertInstanceOf(ThroughStream::class, $writable);
} else {
$this->assertInstanceOf(WritableResourceStream::class, $writable);
Expand Down
15 changes: 12 additions & 3 deletions tests/Unit/Log/ConsoleTest.php
Expand Up @@ -39,7 +39,7 @@ public function it_can_write_info()
$stub = new Console($writer, $styler);

$writer->shouldReceive('write')->once()->with(m::type('String'))->andReturnUsing(function ($message) {
$this->assertStringContainsString('Hello world', $message);
$this->expectContains('Hello world', $message);
});

$stub->info('Hello world');
Expand All @@ -54,7 +54,7 @@ public function it_can_write_warn()
$stub = new Console($writer, $styler);

$writer->shouldReceive('write')->once()->with(m::type('String'))->andReturnUsing(function ($message) {
$this->assertStringContainsString('Hello world', $message);
$this->expectContains('Hello world', $message);
});

$stub->warn('Hello world');
Expand All @@ -69,9 +69,18 @@ public function it_can_write_error()
$stub = new Console($writer, $styler);

$writer->shouldReceive('write')->once()->with(m::type('String'))->andReturnUsing(function ($message) {
$this->assertStringContainsString('Hello world', $message);
$this->expectContains('Hello world', $message);
});

$stub->error('Hello world');
}

public function expectContains(string $needle, string $haystack): void
{
if (\method_exists($this, 'assertStringContainsString')) {
$this->assertStringContainsString($needle, $haystack);
} else {
$this->assertContains($needle, $haystack);
}
}
}

0 comments on commit 79aa95f

Please sign in to comment.