/** * Get entity sniffed from URL * @return ElggEntity|false */ public function getEntity() { if (isset($this->entity)) { return $this->entity; } return $this->url->getEntity(); }
/** * @covers ::getEntity */ public function testGetEntity() { $this->object->setURL('http://localhost/'); $this->assertEquals($this->object->getEntity('http://localhost/'), false); $this->object->setURL('http://localhost/'); $this->assertEquals($this->object->getEntity('http://bar/'), false); /** @todo: mock get_entity() * */ // $this->object->setURL('http://localhost/foo/123'); // $this->assertInstanceOf('ElggEntity', $this->object->getEntity('http://localhost/')); }