コード例 #1
0
 /**
  * При удалении удалении операции, удаляется ссылка на источник
  */
 public function testOnDeleteOperationCascade()
 {
     $op = $this->helper->makeOperation();
     $source = new SourceOperation();
     $source->setOperationId($op->getId());
     $source->save();
     $this->assertEquals(1, $source->getTable()->createQuery()->count());
     $this->assertModels($op, $source->Operation);
     $op->hardDelete();
     $this->assertEquals(0, $source->getTable()->createQuery()->count());
 }
コード例 #2
0
 /**
  * План тестирования ошибок валидации
  */
 protected function getValidationTestingPlan()
 {
     $validInput = $this->getValidInput();
     $op = $this->helper->makeOperation();
     $source = new SourceOperation();
     $source->setOperationId($op->getId());
     $source->setSourceUid(Operation::SOURCE_AMT);
     $source->setSourceOperationUid('12345');
     $source->save();
     return array('Empty request' => new sfPHPUnitFormValidationItem(array(), array('id' => 'required', 'email' => 'required', 'type' => 'required', 'timestamp' => 'required', 'amount' => 'required', 'description' => 'required')), 'Email not found' => new sfPHPUnitFormValidationItem(array_merge($this->getValidInput(), array('email' => '*****@*****.**')), array('email' => 'invalid')), 'Invalid operation type' => new sfPHPUnitFormValidationItem(array_merge($this->getValidInput(), array('type' => 2)), array('type' => 'invalid')), 'Source operation already exists' => new sfPHPUnitFormValidationItem(array_merge($this->getValidInput(), array('id' => $source->getSourceOperationUid())), array('source_uid' => 'invalid')));
 }