X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2Fsrc%2FCore%2FLock%2FSemaphoreLockTest.php;h=04aeb2b45dff3d5e7656f3c34fd2d9ce6c6f4525;hb=bc5a1e5acee9ceb61cd08734c554f69850120d76;hp=a2291b2c241eedc019eee4d520fd7f8396e3c803;hpb=1de3960e267a8d298348fbca18cf1be1f6a20f7a;p=friendica.git diff --git a/tests/src/Core/Lock/SemaphoreLockTest.php b/tests/src/Core/Lock/SemaphoreLockTest.php index a2291b2c24..04aeb2b45d 100644 --- a/tests/src/Core/Lock/SemaphoreLockTest.php +++ b/tests/src/Core/Lock/SemaphoreLockTest.php @@ -1,32 +1,54 @@ . + * + */ namespace Friendica\Test\src\Core\Lock; use Dice\Dice; use Friendica\App; -use Friendica\BaseObject; -use Friendica\Core\Config\Configuration; +use Friendica\Core\Config\IConfig; +use Friendica\Core\Config\JitConfig; use Friendica\Core\Lock\SemaphoreLock; +use Friendica\DI; +use Mockery\MockInterface; class SemaphoreLockTest extends LockTest { public function setUp() { + /** @var MockInterface|Dice $dice */ $dice = \Mockery::mock(Dice::class)->makePartial(); $app = \Mockery::mock(App::class); $app->shouldReceive('getHostname')->andReturn('friendica.local'); $dice->shouldReceive('create')->with(App::class)->andReturn($app); - $configMock = \Mockery::mock(Configuration::class); + $configMock = \Mockery::mock(JitConfig::class); $configMock ->shouldReceive('get') - ->with('system', 'temppath', NULL, false) + ->with('system', 'temppath') ->andReturn('/tmp/'); - $dice->shouldReceive('create')->with(Configuration::class)->andReturn($configMock); + $dice->shouldReceive('create')->with(IConfig::class)->andReturn($configMock); // @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject - BaseObject::setDependencyInjection($dice); + DI::init($dice); parent::setUp(); } @@ -52,7 +74,7 @@ class SemaphoreLockTest extends LockTest touch($file); $this->assertTrue(file_exists($file)); - $this->assertFalse($this->instance->releaseLock('test', false)); + $this->assertFalse($this->instance->release('test', false)); $this->assertTrue(file_exists($file)); } @@ -69,7 +91,7 @@ class SemaphoreLockTest extends LockTest touch($file); $this->assertTrue(file_exists($file)); - $this->assertFalse($this->instance->releaseLock('test', true)); + $this->assertFalse($this->instance->release('test', true)); $this->assertTrue(file_exists($file)); } @@ -82,8 +104,8 @@ class SemaphoreLockTest extends LockTest touch($file); $this->assertTrue(file_exists($file)); - $this->assertTrue($this->instance->acquireLock('test')); + $this->assertTrue($this->instance->acquire('test')); $this->assertTrue($this->instance->isLocked('test')); - $this->assertTrue($this->instance->releaseLock('test')); + $this->assertTrue($this->instance->release('test')); } }