From ba7d221cffab4b42871e5926dd6c3e0a2d2b98dc Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 30 Apr 2015 14:16:09 +0200 Subject: allow getting the path from the lockedexception --- tests/lib/lock/lockingprovider.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/lib/lock/lockingprovider.php b/tests/lib/lock/lockingprovider.php index e7b8028dc94..08d879da8bb 100644 --- a/tests/lib/lock/lockingprovider.php +++ b/tests/lib/lock/lockingprovider.php @@ -22,6 +22,7 @@ namespace Test\Lock; use OCP\Lock\ILockingProvider; +use OCP\Lock\LockedException; use Test\TestCase; abstract class LockingProvider extends TestCase { @@ -115,4 +116,22 @@ abstract class LockingProvider extends TestCase { $this->assertTrue($this->instance->isLocked('foo', ILockingProvider::LOCK_EXCLUSIVE)); $this->instance->acquireLock('foo', ILockingProvider::LOCK_SHARED); } + + public function testLockedExceptionHasPathForShared() { + try { + $this->testSharedLockAfterExclusive(); + $this->fail('Expected locked exception'); + } catch (LockedException $e) { + $this->assertEquals('foo', $e->getPath()); + } + } + + public function testLockedExceptionHasPathForExclusive() { + try { + $this->testExclusiveLockAfterShared(); + $this->fail('Expected locked exception'); + } catch (LockedException $e) { + $this->assertEquals('foo', $e->getPath()); + } + } } -- cgit v1.2.3