/* Decoded by unphp.net */ server->getIfConditions($request); self::assertEquals([], $conditions); } public function testLockToken() { $request = new HTTP\Request('GET', '/path/', ['If' => '()']); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => 'path', 'tokens' => [ [ 'negate' => false, 'token' => 'opaquelocktoken:token1', 'etag' => '', ], ], ], ]; self::assertEquals($compare, $conditions); } public function testNotLockToken() { $request = new HTTP\Request('GET', '/bla', [ 'If' => '(Not )', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => 'bla', 'tokens' => [ [ 'negate' => true, 'token' => 'opaquelocktoken:token1', 'etag' => '', ], ], ], ]; self::assertEquals($compare, $conditions); } public function testLockTokenUrl() { $request = new HTTP\Request('GET', '/bla', [ 'If' => ' ()', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => '', 'tokens' => [ [ 'negate' => false, 'token' => 'opaquelocktoken:token1', 'etag' => '', ], ], ], ]; self::assertEquals($compare, $conditions); } public function test2LockTokens() { $request = new HTTP\Request('GET', '/bla', [ 'If' => '() (Not )', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => 'bla', 'tokens' => [ [ 'negate' => false, 'token' => 'opaquelocktoken:token1', 'etag' => '', ], [ 'negate' => true, 'token' => 'opaquelocktoken:token2', 'etag' => '', ], ], ], ]; self::assertEquals($compare, $conditions); } public function test2UriLockTokens() { $request = new HTTP\Request('GET', '/bla', [ 'If' => ' () (Not )', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => 'node1', 'tokens' => [ [ 'negate' => false, 'token' => 'opaquelocktoken:token1', 'etag' => '', ], ], ], [ 'uri' => 'node2', 'tokens' => [ [ 'negate' => true, 'token' => 'opaquelocktoken:token2', 'etag' => '', ], ], ], ]; self::assertEquals($compare, $conditions); } public function test2UriMultiLockTokens() { $request = new HTTP\Request('GET', '/bla', [ 'If' => ' () () (Not )', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => 'node1', 'tokens' => [ [ 'negate' => false, 'token' => 'opaquelocktoken:token1', 'etag' => '', ], [ 'negate' => false, 'token' => 'opaquelocktoken:token2', 'etag' => '', ], ], ], [ 'uri' => 'node2', 'tokens' => [ [ 'negate' => true, 'token' => 'opaquelocktoken:token3', 'etag' => '', ], ], ], ]; self::assertEquals($compare, $conditions); } public function testEtag() { $request = new HTTP\Request('GET', '/foo', [ 'If' => '(["etag1"])', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => 'foo', 'tokens' => [ [ 'negate' => false, 'token' => '', 'etag' => '"etag1"', ], ], ], ]; self::assertEquals($compare, $conditions); } public function test2Etags() { $request = new HTTP\Request('GET', '/foo', [ 'If' => ' (["etag1"]) (["etag2"])', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => '', 'tokens' => [ [ 'negate' => false, 'token' => '', 'etag' => '"etag1"', ], [ 'negate' => false, 'token' => '', 'etag' => '"etag2"', ], ], ], ]; self::assertEquals($compare, $conditions); } public function testComplexIf() { $request = new HTTP\Request('GET', '/foo', [ 'If' => ' ( ["etag1"]) '. '(Not ) (["etag2"]) '. '() (Not ) (["etag3"])', ]); $conditions = $this->server->getIfConditions($request); $compare = [ [ 'uri' => 'node1', 'tokens' => [ [ 'negate' => false, 'token' => 'opaquelocktoken:token1', 'etag' => '"etag1"', ], [ 'negate' => true, 'token' => 'opaquelocktoken:token2', 'etag' => '', ], [ 'negate' => false, 'token' => '', 'etag' => '"etag2"', ], ], ], [ 'uri' => 'node2', 'tokens' => [ [ 'negate' => false, 'token' => 'opaquelocktoken:token3', 'etag' => '', ], [ 'negate' => true, 'token' => 'opaquelocktoken:token4', 'etag' => '', ], [ 'negate' => false, 'token' => '', 'etag' => '"etag3"', ], ], ], ]; self::assertEquals($compare, $conditions); } } ?>