Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Commit

Permalink
added redis test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sven Speckmaier committed Jun 21, 2017
1 parent 254d0c4 commit 6fe320b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/Redis/RedisTest.php
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 ],
];
}
}

0 comments on commit 6fe320b

Please sign in to comment.