/** * testRequestMethod method * * @access public * @return void */ function testRequestMethod() { $_SERVER['REQUEST_METHOD'] = 'GET'; $this->assertTrue($this->RequestHandler->isGet()); $this->assertFalse($this->RequestHandler->isPost()); $this->assertFalse($this->RequestHandler->isPut()); $this->assertFalse($this->RequestHandler->isDelete()); $_SERVER['REQUEST_METHOD'] = 'POST'; $this->assertFalse($this->RequestHandler->isGet()); $this->assertTrue($this->RequestHandler->isPost()); $this->assertFalse($this->RequestHandler->isPut()); $this->assertFalse($this->RequestHandler->isDelete()); $_SERVER['REQUEST_METHOD'] = 'PUT'; $this->assertFalse($this->RequestHandler->isGet()); $this->assertFalse($this->RequestHandler->isPost()); $this->assertTrue($this->RequestHandler->isPut()); $this->assertFalse($this->RequestHandler->isDelete()); $_SERVER['REQUEST_METHOD'] = 'DELETE'; $this->assertFalse($this->RequestHandler->isGet()); $this->assertFalse($this->RequestHandler->isPost()); $this->assertFalse($this->RequestHandler->isPut()); $this->assertTrue($this->RequestHandler->isDelete()); }
/** * testRequestMethod method * * @return void */ public function testRequestMethod() { $request = $this->getMock('CakeRequest'); $request->expects($this->at(0))->method('is')->with('get')->will($this->returnValue(true)); $request->expects($this->at(1))->method('is')->with('post')->will($this->returnValue(false)); $request->expects($this->at(2))->method('is')->with('delete')->will($this->returnValue(true)); $request->expects($this->at(3))->method('is')->with('put')->will($this->returnValue(false)); $this->RequestHandler->request = $request; $this->assertTrue($this->RequestHandler->isGet()); $this->assertFalse($this->RequestHandler->isPost()); $this->assertTrue($this->RequestHandler->isDelete()); $this->assertFalse($this->RequestHandler->isPut()); }