This repository has been archived by the owner on May 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sven Speckmaier
committed
Jun 21, 2017
1 parent
254d0c4
commit 6fe320b
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php namespace Redis; | ||
|
||
use Ipunkt\LaravelHealthcheck\HealthChecker\CheckFailedException; | ||
use Ipunkt\LaravelHealthcheck\Redis\RedisChecker; | ||
use Ipunkt\LaravelHealthcheck\Redis\RedisConnnectionChecker; | ||
use Mockery; | ||
|
||
/** | ||
* Class RedisTest | ||
* @package Redis | ||
*/ | ||
class RedisTest extends \TestCase { | ||
|
||
/** | ||
* @test | ||
* @dataProvider dataProvider | ||
*/ | ||
public function redis_checker( $connections, $succeeds ) { | ||
|
||
$connectionChecker = Mockery::mock(RedisConnnectionChecker::class); | ||
|
||
$checker = new RedisChecker( $connectionChecker ); | ||
$checker->setConnectionNames($connections); | ||
|
||
if( !$succeeds ) | ||
$this->expectException( CheckFailedException::class ); | ||
|
||
foreach( $connections as $connection ) | ||
$connectionChecker->shouldReceive('check')->with($connection)->once()->andReturn( $succeeds ); | ||
|
||
$checker->check(); | ||
} | ||
|
||
public function dataProvider( ) { | ||
return [ | ||
[ [ 'test' ], true ], | ||
[ [ 'cookies' ], false ], | ||
]; | ||
} | ||
} |