예제 #1
0
 /**
  * Test for isValid()
  *
  * @param \string $value
  * @param \bool $expectedResult
  * @return void
  * @dataProvider validateIsValidReturnsBoolDataProvider
  * @test
  */
 public function validateIsValidReturnsBool($value, $expectedResult)
 {
     $mail = new \In2code\Powermail\Domain\Model\Mail();
     $field = new \In2code\Powermail\Domain\Model\Field();
     $field->setType(1);
     $answer1 = new \In2code\Powermail\Domain\Model\Answer();
     $answer1->setValueType(3);
     $answer1->setValue($value);
     $answer1->setField($field);
     $objectStorage = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
     $objectStorage->attach($answer1);
     $mail->setAnswers($objectStorage);
     $result = $this->generalValidatorMock->_callRef('isValid', $mail);
     $this->assertSame($result, $expectedResult);
 }
 /**
  * Test for isValid()
  *
  * @param string $value
  * @param bool $expectedResult
  * @return void
  * @dataProvider validateIsValidReturnsBoolDataProvider
  * @test
  */
 public function validateIsValidReturnsBool($value, $expectedResult)
 {
     $mail = new Mail();
     $field = new Field();
     $field->setType(1);
     $answer1 = new Answer();
     $answer1->setValueType(3);
     $answer1->setValue($value);
     $answer1->setField($field);
     $objectStorage = new ObjectStorage();
     $objectStorage->attach($answer1);
     $mail->setAnswers($objectStorage);
     if ($expectedResult === false) {
         $this->generalValidatorMock->expects($this->once())->method('setErrorAndMessage');
     } else {
         $this->generalValidatorMock->expects($this->never())->method('setErrorAndMessage');
     }
     $this->generalValidatorMock->_callRef('isValid', $mail);
 }