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()
15 $dice = \Mockery::mock(Dice::class)->makePartial();
17 $app = \Mockery::mock(App::class);
18 $app->shouldReceive('getHostname')->andReturn('friendica.local');
19 $dice->shouldReceive('create')->with(App::class)->andReturn($app);
21 $configMock = \Mockery::mock(Configuration::class);
23 ->shouldReceive('get')
24 ->with('system', 'temppath', NULL, false)
26 $dice->shouldReceive('create')->with(Configuration::class)->andReturn($configMock);
28 // @todo Because "get_temppath()" is using static methods, we have to initialize the BaseObject
29 BaseObject::setDependencyInjection($dice);
34 protected function getInstance()
36 return new SemaphoreLock();
39 function testLockTTL()
41 // Semaphore doesn't work with TTL