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
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ services:

sudo: false

env:
- REDIS_URI=localhost

install:
- composer install --no-interaction

Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,16 @@ To run the test suite, go to the project root and run:
$ php vendor/bin/phpunit
```

The test suite contains both unit tests and functional integration tests.
The functional tests require access to a running Redis server instance
and will be skipped by default.
If you want to also run the functional tests, you need to supply *your* login
details in an environment variable like this:

```bash
$ REDIS_URI=localhost:6379 php vendor/bin/phpunit
```

## License

MIT
14 changes: 10 additions & 4 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ class FunctionalTest extends TestCase

public function setUp()
{
$uri = getenv('REDIS_URI');
if ($uri === false) {
$this->markTestSkipped('No REDIS_URI environment variable given');
}

$this->loop = new React\EventLoop\StreamSelectLoop();
$this->factory = new Factory($this->loop);
$this->client = $this->createClient();
$this->client = $this->createClient($uri);
}

public function testPing()
Expand Down Expand Up @@ -104,7 +109,7 @@ public function testMonitorPing()
public function testPubSub()
{
$consumer = $this->client;
$producer = $this->createClient();
$producer = $this->createClient(getenv('REDIS_URI'));

$channel = 'channel:test:' . mt_rand();

Expand Down Expand Up @@ -157,11 +162,12 @@ public function testInvalidServerRepliesWithDuplicateMessages()
}

/**
* @param string $uri
* @return Client
*/
protected function createClient()
protected function createClient($uri)
{
return Block\await($this->factory->createClient(), $this->loop);
return Block\await($this->factory->createClient($uri), $this->loop);
}

protected function createClientResponse($response)
Expand Down