return null;
}
+ /**
+ * Release a scoped lock and set any errors in the attatched Status object.
+ * This is useful for early release of locks before function scope is destroyed.
+ * This is the same as setting the lock object to null.
+ *
+ * @param ScopedLock $lock
+ * @return void
+ * @since 1.21
+ */
+ public static function release( ScopedLock &$lock = null ) {
+ $lock = null;
+ }
+
function __destruct() {
$wasOk = $this->status->isOK();
$this->status->merge( $this->manager->unlock( $this->paths, $this->type ) );
$this->assertEquals( true, $status->isOK(),
"Locking of files succeeded with OK status ($backendName)." );
}
+
+ $status = Status::newGood();
+ $sl = $this->backend->getScopedFileLocks( $paths, LockManager::LOCK_EX, $status );
+ $this->assertType( 'ScopedLock', $sl,
+ "Scoped locking of files succeeded ($backendName)." );
+ $this->assertEquals( array(), $status->errors,
+ "Scoped locking of files succeeded ($backendName)." );
+ $this->assertEquals( true, $status->isOK(),
+ "Scoped locking of files succeeded with OK status ($backendName)." );
+
+ ScopedLock::release( $sl );
+ $this->assertEquals( null, $sl,
+ "Scoped unlocking of files succeeded ($backendName)." );
+ $this->assertEquals( array(), $status->errors,
+ "Scoped unlocking of files succeeded ($backendName)." );
+ $this->assertEquals( true, $status->isOK(),
+ "Scoped unlocking of files succeeded with OK status ($backendName)." );
}
// test helper wrapper for backend prepare() function