Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/examples/ export-ignore
/phpunit.xml.dist export-ignore
/tests/ export-ignore
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"autoload": {
"psr-4": { "Clue\\React\\EventSource\\": "src/" }
},
"autoload-dev": {
"psr-4": { "Clue\\Tests\\React\\EventSource\\": "tests/" }
},
"require": {
"php": ">=5.4",
"clue/buzz-react": "^2.5",
Expand Down
7 changes: 1 addition & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
<phpunit bootstrap="vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="EventSource Test Suite">
<directory>./tests/</directory>
Expand Down
16 changes: 9 additions & 7 deletions tests/EventSourceTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Clue\Tests\React\EventSource;

use PHPUnit\Framework\TestCase;
use Clue\React\EventSource\EventSource;
use React\Promise\Promise;
Expand Down Expand Up @@ -44,7 +46,7 @@ public function testConstructorCanBeCalledWithoutBrowser()

$es = new EventSource('http://example.invalid', $loop);

$ref = new ReflectionProperty($es, 'browser');
$ref = new \ReflectionProperty($es, 'browser');
$ref->setAccessible(true);
$browser = $ref->getValue($es);

Expand Down Expand Up @@ -98,7 +100,7 @@ public function testCloseWillNotEmitErrorEventWhenGetRequestCancellationHandlerR
$loop = $this->getMockBuilder('React\EventLoop\LoopInterface')->getMock();

$pending = new Promise(function () { }, function () {
throw new RuntimeException();
throw new \RuntimeException();
});
$browser = $this->getMockBuilder('Clue\React\Buzz\Browser')->disableOriginalConstructor()->getMock();
$browser->expects($this->once())->method('withOptions')->willReturnSelf();
Expand Down Expand Up @@ -131,7 +133,7 @@ public function testConstructorWillStartGetRequestThatWillStartRetryTimerWhenGet

$es = new EventSource('http://example.com', $loop, $browser);

$deferred->reject(new RuntimeException());
$deferred->reject(new \RuntimeException());
}

public function testConstructorWillStartGetRequestThatWillStartRetryTimerThatWillRetryGetRequestWhenInitialGetRequestRejects()
Expand All @@ -156,7 +158,7 @@ public function testConstructorWillStartGetRequestThatWillStartRetryTimerThatWil

$es = new EventSource('http://example.com', $loop, $browser);

$deferred->reject(new RuntimeException());
$deferred->reject(new \RuntimeException());

$this->assertNotNull($timerRetry);
$timerRetry();
Expand All @@ -181,7 +183,7 @@ public function testConstructorWillStartGetRequestThatWillEmitErrorWhenGetReques
$es->on('error', function ($e) use (&$caught) {
$caught = $e;
});
$deferred->reject($expected = new RuntimeException());
$deferred->reject($expected = new \RuntimeException());

$this->assertSame($expected, $caught);
}
Expand All @@ -200,7 +202,7 @@ public function testConstructorWillStartGetRequestThatWillNotStartRetryTimerWhen
$es->on('error', function () use ($es) {
$es->close();
});
$deferred->reject(new RuntimeException());
$deferred->reject(new \RuntimeException());
}

public function testCloseAfterGetRequestFromConstructorFailsWillCancelPendingRetryTimer()
Expand All @@ -220,7 +222,7 @@ public function testCloseAfterGetRequestFromConstructorFailsWillCancelPendingRet

$es = new EventSource('http://example.com', $loop, $browser);

$deferred->reject(new RuntimeException());
$deferred->reject(new \RuntimeException());

$es->close();
}
Expand Down
2 changes: 2 additions & 0 deletions tests/MessageEventTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Clue\Tests\React\EventSource;

use PHPUnit\Framework\TestCase;
use Clue\React\EventSource\MessageEvent;

Expand Down