3 namespace Friendica\Test\src\Core\Lock;
7 use Friendica\BaseObject;
8 use Friendica\Core\Config\Configuration;
9 use Friendica\Core\Lock\SemaphoreLock;
11 class SemaphoreLockTest extends LockTest
13 public function setUp()
17 $dice = \Mockery::mock(Dice::class)->makePartial();
19 $app = \Mockery::mock(App::class);
20 $app->shouldReceive('getHostname')->andReturn('friendica.local');
21 $dice->shouldReceive('create')->with(App::class)->andReturn($app);
23 $configMock = \Mockery::mock(Configuration::class);
25 ->shouldReceive('get')
26 ->with('system', 'temppath', NULL, false)
28 $dice->shouldReceive('create')->with(Configuration::class)->andReturn($configMock);
30 // @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
31 BaseObject::setDependencyInjection($dice);
34 protected function getInstance()
36 return new SemaphoreLock();
39 function testLockTTL()
41 // Semaphore doesn't work with TTL