示例#1
0
 /**
  * @param string $adId
  *
  * @return Schedule|null
  */
 public function findScheduleByAdId($adId)
 {
     return $this->model->findScheduleByAdId($adId);
 }
示例#2
0
 /**
  * Test get schedule by ad id
  */
 public function testFindScheduleByAdId()
 {
     $scheduleDocument = $this->getMockObject('Litvinab\\Bundle\\CronEventBundle\\Document\\Schedule');
     $queryBuilder = $this->getMockObject('Doctrine\\MongoDB\\Query\\Query', ['getSingleResult']);
     $this->setMockMethodsReturnValue($queryBuilder, ['getSingleResult'], $scheduleDocument);
     $repository = $this->getMockObject('Litvinab\\Bundle\\CronEventBundle\\Repository\\ScheduleRepository', ['findScheduleByAdId']);
     $this->setMockMethodsReturnValue($repository, ['findScheduleByAdId'], $queryBuilder);
     $model = new ScheduleModel($repository);
     $result = $model->findScheduleByAdId('test');
     $this->assertEquals($scheduleDocument, $result);
 }