예제 #1
0
 public function testGetLocationCityAction()
 {
     $city = new Cities(array('id' => 7));
     $collectionCity = new Collection();
     $collectionCity->append($city);
     $dataLocation = array('id' => 5);
     $this->paramsMock->expects($this->once())->method('fromPost')->will($this->returnValue($dataLocation));
     $this->cityFinderServiceMock->expects($this->once())->method('findMany')->with($this->equalTo(array('RoLocations' => array('Cities' => array('regionId' => $dataLocation['id'])))))->will($this->returnValue($collectionCity));
     $resultView = $this->controller->getLocationCityAction($this->paramsMock, $this->cityFinderServiceMock);
     $this->assertSame($collectionCity, $resultView->locations);
 }
예제 #2
0
파일: DeleteTest.php 프로젝트: t4web/base
 public function testDeleteAll_CriteriaNameDifferentToField_Delete()
 {
     $id = 1;
     $criteria = new Ids($id);
     $collection = new Collection();
     $collection->append($this->entityMock);
     $this->criteriaFactoryMock->expects($this->once())->method('getNativeCriteria')->with($this->equalTo('Ids'), $this->equalTo($id))->will($this->returnValue($criteria));
     $this->repositoryMock->expects($this->once())->method('findMany')->with($this->equalTo($criteria))->will($this->returnValue($collection));
     $this->repositoryMock->expects($this->once())->method('deleteByAttribute')->with($this->equalTo($id), $this->equalTo('id'));
     $this->eventManagerMock->expects($this->once())->method('trigger')->with($this->equalTo('deleteAll:post'), $this->equalTo($this->service), $this->equalTo(array('collection' => $collection)));
     $result = $this->service->deleteAll($id, 'Ids');
     $this->assertEquals($collection, $result);
 }
예제 #3
0
 /**
  * @dataProvider GetAllByAttributeValueProvider
  */
 public function testGetAllByAttributeValue_WithHtmlEntities($value, $collectionValue)
 {
     $entity = new Entity(array('id' => $collectionValue));
     $collection = new Collection();
     $collection->append($entity);
     $expectedCollection = new Collection();
     $expectedCollection->offsetSet($entity->getId(), $entity);
     $this->assertEquals($expectedCollection, $collection->getAllByAttributeValue($value));
 }
예제 #4
0
파일: UpdateTest.php 프로젝트: t4web/base
 public function testUpdateAllCriteriaNameDifferentToField()
 {
     $id = 1;
     $criteria = new Ids($id);
     $collection = new Collection();
     $collection->append($this->entityMock);
     $data = array();
     $this->criteriaFactoryMock->expects($this->once())->method('getNativeCriteria')->with($this->equalTo('Ids'), $this->equalTo($id))->will($this->returnValue($criteria));
     $this->repositoryMock->expects($this->once())->method('findMany')->with($this->equalTo($criteria))->will($this->returnValue($collection));
     $this->repositoryMock->expects($this->once())->method('updateByAttribute')->with($this->equalTo($data), $this->equalTo($id), $this->equalTo('id'));
     $result = $this->service->updateAll($id, 'Ids', $data);
     $this->assertEquals($collection, $result);
 }