Exemplo n.º 1
0
 public function testCompleteArraysTransformed()
 {
     $item = new Item();
     $item->setUnread();
     $item2 = new Item();
     $item2->setRead();
     $serializer = new EntityApiSerializer('items');
     $in = ['items' => [$item, $item2], 'test' => 1];
     $result = $serializer->serialize($in);
     $this->assertTrue($result['items'][0]['unread']);
     $this->assertFalse($result['items'][1]['unread']);
     $this->assertEquals(1, $result['test']);
 }
Exemplo n.º 2
0
 public function testRead()
 {
     $itemId = 3;
     $item = new Item();
     $item->setStatus(128);
     $item->setId($itemId);
     $item->setRead();
     $expectedItem = new Item();
     $expectedItem->setStatus(128);
     $expectedItem->setUnread();
     $expectedItem->setId($itemId);
     $expectedItem->setLastModified($this->time);
     $this->mapper->expects($this->once())->method('find')->with($this->equalTo($itemId), $this->equalTo($this->user))->will($this->returnValue($item));
     $this->mapper->expects($this->once())->method('update')->with($this->equalTo($expectedItem));
     $this->itemBusinessLayer->read($itemId, false, $this->user);
     $this->assertTrue($item->isUnread());
 }
Exemplo n.º 3
0
 private function createUpdateItem2()
 {
     $item = new Item();
     $item->setGuidHash(md5('hi'));
     $item->setFeedId(3);
     $item->setPubDate(1);
     $item->setTitle('ho');
     $item->setAuthor('auto');
     $item->setBody('old');
     $item->setRead();
     return $item;
 }