/** * @test * @return void */ public function searchCanBeSet() { $value = new Search(); $value->setSubject('fo'); $this->instance->setSearch($value); $this->assertEquals($value, $this->instance->getSearch()); }
/** * @test */ public function constraintsAreReturnedForDateFields() { $mockedQuery = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\QueryInterface'); $mockedRepository = $this->getAccessibleMock('GeorgRinger\\News\\Domain\\Repository\\NewsRepository', ['dummy'], [], '', FALSE); $search = new Search(); $search->setMinimumDate('2014-01-01'); $search->setDateField('datetime'); $demand = new NewsDemand(); $demand->setSearch($search); $result = $mockedRepository->_call('getSearchConstraints', $mockedQuery, $demand); $this->assertEquals(1, count($result)); $search->setMaximumDate('2015-01-01'); $demand->setSearch($search); $result = $mockedRepository->_call('getSearchConstraints', $mockedQuery, $demand); $this->assertEquals(2, count($result)); $search->setMaximumDate('xyz'); $demand->setSearch($search); $result = $mockedRepository->_call('getSearchConstraints', $mockedQuery, $demand); $this->assertEquals(1, count($result)); }