/** * @param bool|null $andFlush * @dataProvider provideAddFlushValues */ public function testSave($andFlush = null) { $entity = $this->subject->create('type'); $this->objectManager->expects($this->once())->method('persist')->with($entity); $what = $andFlush || is_null($andFlush) ? $this->once() : $this->never(); $this->objectManager->expects($what)->method('flush'); is_null($andFlush) ? $this->subject->save($entity) : $this->subject->save($entity, $andFlush); }
public function testFindByWithStatus() { $job = $this->subject->create('JobType', null, new Schedule('Type', 'Expression')); $job->setStatus(Status::REQUESTED()); $this->subject->save($job); $this->assertCount(1, $this->subject->findBy(['status' => Status::REQUESTED()])); $this->assertEmpty($this->subject->findBy(['status' => Status::PROCESSED()])); }