5
5
use GenericCommand ;
6
6
use Illuminate \Support \Facades \Cache ;
7
7
use Illuminated \Console \Mutex ;
8
- use Mockery ;
9
8
use NinjaMutex \Lock \FlockLock ;
10
9
use NinjaMutex \Lock \MemcachedLock ;
11
10
use NinjaMutex \Lock \MySqlLock ;
@@ -22,8 +21,8 @@ public function setUp()
22
21
{
23
22
parent ::setUp ();
24
23
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 ' ]);
27
26
}
28
27
29
28
/** @test */
@@ -43,7 +42,7 @@ public function it_determines_mutex_strategy_once_while_creation()
43
42
/** @test */
44
43
public function it_has_default_strategy_which_is_file ()
45
44
{
46
- $ this ->command ->shouldReceive ( ' getMutexStrategy ' )->withNoArgs ()-> once ()->andReturn ('foobar ' );
45
+ $ this ->command ->expects ( )->getMutexStrategy ()->andReturn ('foobar ' );
47
46
48
47
$ mutex = new Mutex ($ this ->command );
49
48
$ expectedStrategy = new FlockLock (storage_path ('app ' ));
@@ -53,7 +52,7 @@ public function it_has_default_strategy_which_is_file()
53
52
/** @test */
54
53
public function it_supports_mysql_strategy ()
55
54
{
56
- $ this ->command ->shouldReceive ( ' getMutexStrategy ' )->withNoArgs ()-> once ()->andReturn ('mysql ' );
55
+ $ this ->command ->expects ( )->getMutexStrategy ()->andReturn ('mysql ' );
57
56
58
57
$ mutex = new Mutex ($ this ->command );
59
58
$ expectedStrategy = new MySqlLock (
@@ -68,7 +67,7 @@ public function it_supports_mysql_strategy()
68
67
/** @test */
69
68
public function it_supports_redis_strategy_with_predis_client_which_is_default ()
70
69
{
71
- $ this ->command ->shouldReceive ( ' getMutexStrategy ' )->withNoArgs ()-> once ()->andReturn ('redis ' );
70
+ $ this ->command ->expects ( )->getMutexStrategy ()->andReturn ('redis ' );
72
71
73
72
$ mutex = new Mutex ($ this ->command );
74
73
$ expectedStrategy = new PredisRedisLock ($ mutex ->getPredisClient ());
@@ -80,7 +79,7 @@ public function it_supports_redis_strategy_with_phpredis_client()
80
79
{
81
80
config (['database.redis.client ' => 'phpredis ' ]);
82
81
83
- $ this ->command ->shouldReceive ( ' getMutexStrategy ' )->withNoArgs ()-> once ()->andReturn ('redis ' );
82
+ $ this ->command ->expects ( )->getMutexStrategy ()->andReturn ('redis ' );
84
83
85
84
$ mutex = new Mutex ($ this ->command );
86
85
$ expectedStrategy = new PhpRedisLock ($ mutex ->getPhpRedisClient ());
@@ -108,7 +107,8 @@ public function it_supports_memcached_strategy()
108
107
{
109
108
Cache::shouldReceive ('getStore ' )->withNoArgs ()->twice ()->andReturnSelf ();
110
109
Cache::shouldReceive ('getMemcached ' )->withNoArgs ()->twice ()->andReturnSelf ();
111
- $ this ->command ->shouldReceive ('getMutexStrategy ' )->withNoArgs ()->once ()->andReturn ('memcached ' );
110
+
111
+ $ this ->command ->expects ()->getMutexStrategy ()->andReturn ('memcached ' );
112
112
113
113
$ mutex = new Mutex ($ this ->command );
114
114
$ expectedStrategy = new MemcachedLock (Cache::getStore ()->getMemcached ());
@@ -122,8 +122,8 @@ public function it_supports_memcached_strategy()
122
122
*/
123
123
public function it_delegates_public_method_calls_to_ninja_mutex ()
124
124
{
125
- $ ninja = Mockery:: mock ('overload:NinjaMutex\Mutex ' );
126
- $ ninja ->shouldReceive ( ' isLocked ' )->once ();
125
+ $ ninja = mock ('overload:NinjaMutex\Mutex ' );
126
+ $ ninja ->expects ( )->isLocked ();
127
127
128
128
$ mutex = new Mutex ($ this ->command );
129
129
$ mutex ->isLocked ();
0 commit comments