Ejemplo n.º 1
0
 public function test_methods()
 {
     $driver = $this->getMock('Openbuildings\\Spiderling\\Driver_Simple');
     $driver->expects($this->once())->method('visit')->with($this->equalTo('http://example.com'), $this->equalTo(array('test' => 'value')));
     $driver->expects($this->once())->method('content')->will($this->returnValue('content test'));
     $driver->expects($this->once())->method('current_url')->will($this->returnValue('current_url test'));
     $driver->expects($this->once())->method('current_path')->will($this->returnValue('current_path test'));
     $page = new Page($driver);
     $this->assertSame($driver, $page->driver());
     $page->visit('http://example.com', array('test' => 'value'));
     $this->assertEquals('content test', $page->content());
     $this->assertEquals('current_url test', $page->current_url());
     $this->assertEquals('current_path test', $page->current_path());
 }