/** * @test */ public function findDemanded() { $itemDemand = $this->getMock(ItemDemand::class); $result = $this->getMock(QueryResult::class, array(), array(), '', FALSE); $query = $this->getMock(Query::class, array('execute'), array(), '', FALSE); $itemDemand->expects($this->once())->method('getTitle')->will($this->returnValue('')); $itemDemand->expects($this->once())->method('getLimit')->will($this->returnValue(0)); $query->expects($this->once())->method('execute')->will($this->returnValue($result)); $this->subject->expects($this->once())->method('createQuery')->will($this->returnValue($query)); $this->assertEquals($result, $this->subject->findDemanded($itemDemand)); }
/** * @test * @dataProvider searchByTitleDataProvider */ public function searchByTitle($title, $matches) { $itemDemand = new ItemDemand(); $itemDemand->setTitle($title); $items = $this->itemRepository->findDemanded($itemDemand); $this->assertCount($matches, $items); $this->assertContainsOnlyInstancesOf(Item::class, $items); }
/** * action create * * @param \Frappant\FrpExample\Domain\Model\Item $newItem * @return void */ public function createAction(\Frappant\FrpExample\Domain\Model\Item $newItem) { $this->addFlashMessage('The object was created. Please be aware that this action is publicly accessible unless you implement an access check. See <a href="http://wiki.typo3.org/T3Doc/Extension_Builder/Using_the_Extension_Builder#1._Model_the_domain" target="_blank">Wiki</a>', '', \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR); $this->itemRepository->add($newItem); $this->redirect('list'); }