public function testIterator() { $stream = new Stream(); for ($i = 0; $i < 10; $i++) { $status = new Status(); $status->setText($i); $stream->addStatus($status); } foreach ($stream as $k => $status) { $this->assertInstanceOf('Lyrixx\\Lifestream\\Status', $status); $this->assertSame($k, $status->getText()); } }
public function testAddStatus() { $datas = array('text' => 'some text', 'date' => new \DateTime('2000-01-01'), 'url' => 'http://exemple.com', 'option1' => 'my first option', 'option2' => 'my second option', 'option3' => 'my third option'); $status = new Status($datas); $this->assertEquals($datas['text'], $status->__ToString(), 'Check ToString ()'); $this->assertEquals($datas['text'], $status->getText(), 'Check Text'); $this->assertEquals($datas['date'], $status->getDate(), 'Check Date'); $this->assertEquals($datas['url'], $status->getUrl(), 'Check Url'); $options = array('option1' => 'my first option', 'option2' => 'my second option', 'option3' => 'my third option'); $this->assertEquals($options, $status->getExtra(), 'Check Extra'); }
public function __construct(array $datas = array()) { parent::__construct($datas); $datas = $this->getExtra(); if (isset($datas['username'])) { $this->setUsername($datas['username']); unset($datas['username']); } if (isset($datas['fullname'])) { $this->setFullname($datas['fullname']); unset($datas['fullname']); } if (isset($datas['pictureUrl'])) { $this->setPictureUrl($datas['pictureUrl']); unset($datas['pictureUrl']); } if (isset($datas['profileUrl'])) { $this->setProfileUrl($datas['profileUrl']); unset($datas['profileUrl']); } $this->setExtra($datas); }
/** * @dataProvider getFormatTests */ public function testFormat($expected, $text) { $status = new Status(); $status->setText($text); $this->assertSame($expected, $this->formatter->format($status)->getText()); }
/** * @dataProvider getFilterTests */ public function testFilter($expected, $text) { $status = new Status(); $status->setText($text); $this->assertSame($expected, $this->filter->isValid($status)); }