Skip to content

Commit 074d3d9

Browse files
committed
Mockery ^1.0 features used.
1 parent f4b0376 commit 074d3d9

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/ConsoleMutex/MutexTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use GenericCommand;
66
use Illuminate\Support\Facades\Cache;
77
use Illuminated\Console\Mutex;
8-
use Mockery;
98
use NinjaMutex\Lock\FlockLock;
109
use NinjaMutex\Lock\MemcachedLock;
1110
use NinjaMutex\Lock\MySqlLock;
@@ -22,8 +21,8 @@ public function setUp()
2221
{
2322
parent::setUp();
2423

25-
$this->command = Mockery::mock(GenericCommand::class)->makePartial();
26-
$this->command->shouldReceive('argument')->withNoArgs()->andReturn(['foo' => 'bar']);
24+
$this->command = mock(GenericCommand::class)->makePartial();
25+
$this->command->expects()->argument()->andReturn(['foo' => 'bar']);
2726
}
2827

2928
/** @test */
@@ -43,7 +42,7 @@ public function it_determines_mutex_strategy_once_while_creation()
4342
/** @test */
4443
public function it_has_default_strategy_which_is_file()
4544
{
46-
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('foobar');
45+
$this->command->expects()->getMutexStrategy()->andReturn('foobar');
4746

4847
$mutex = new Mutex($this->command);
4948
$expectedStrategy = new FlockLock(storage_path('app'));
@@ -53,7 +52,7 @@ public function it_has_default_strategy_which_is_file()
5352
/** @test */
5453
public function it_supports_mysql_strategy()
5554
{
56-
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('mysql');
55+
$this->command->expects()->getMutexStrategy()->andReturn('mysql');
5756

5857
$mutex = new Mutex($this->command);
5958
$expectedStrategy = new MySqlLock(
@@ -68,7 +67,7 @@ public function it_supports_mysql_strategy()
6867
/** @test */
6968
public function it_supports_redis_strategy_with_predis_client_which_is_default()
7069
{
71-
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('redis');
70+
$this->command->expects()->getMutexStrategy()->andReturn('redis');
7271

7372
$mutex = new Mutex($this->command);
7473
$expectedStrategy = new PredisRedisLock($mutex->getPredisClient());
@@ -80,7 +79,7 @@ public function it_supports_redis_strategy_with_phpredis_client()
8079
{
8180
config(['database.redis.client' => 'phpredis']);
8281

83-
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('redis');
82+
$this->command->expects()->getMutexStrategy()->andReturn('redis');
8483

8584
$mutex = new Mutex($this->command);
8685
$expectedStrategy = new PhpRedisLock($mutex->getPhpRedisClient());
@@ -108,7 +107,8 @@ public function it_supports_memcached_strategy()
108107
{
109108
Cache::shouldReceive('getStore')->withNoArgs()->twice()->andReturnSelf();
110109
Cache::shouldReceive('getMemcached')->withNoArgs()->twice()->andReturnSelf();
111-
$this->command->shouldReceive('getMutexStrategy')->withNoArgs()->once()->andReturn('memcached');
110+
111+
$this->command->expects()->getMutexStrategy()->andReturn('memcached');
112112

113113
$mutex = new Mutex($this->command);
114114
$expectedStrategy = new MemcachedLock(Cache::getStore()->getMemcached());
@@ -122,8 +122,8 @@ public function it_supports_memcached_strategy()
122122
*/
123123
public function it_delegates_public_method_calls_to_ninja_mutex()
124124
{
125-
$ninja = Mockery::mock('overload:NinjaMutex\Mutex');
126-
$ninja->shouldReceive('isLocked')->once();
125+
$ninja = mock('overload:NinjaMutex\Mutex');
126+
$ninja->expects()->isLocked();
127127

128128
$mutex = new Mutex($this->command);
129129
$mutex->isLocked();

0 commit comments

Comments
 (0)