Exemplo n.º 1
0
 /**
  * @test
  */
 public function objectStoresDataCorrectly()
 {
     $name = 'This is a name';
     $description = 'Example desc';
     $type = 'string';
     $isRequired = TRUE;
     $isMethodParameter = TRUE;
     $argumentDefinition = new ArgumentDefinition($name, $type, $description, $isRequired, NULL);
     $this->assertEquals($argumentDefinition->getName(), $name, 'Name could not be retrieved correctly.');
     $this->assertEquals($argumentDefinition->getDescription(), $description, 'Description could not be retrieved correctly.');
     $this->assertEquals($argumentDefinition->getType(), $type, 'Type could not be retrieved correctly');
     $this->assertEquals($argumentDefinition->isRequired(), $isRequired, 'Required flag could not be retrieved correctly.');
 }
 /**
  * @test
  * @dataProvider getValidateArgumentsErrorsTestValues
  * @param ArgumentDefinition $argument
  * @param mixed $value
  */
 public function testValidateArgumentsErrors(ArgumentDefinition $argument, $value)
 {
     $viewHelper = $this->getAccessibleMock(AbstractViewHelper::class, array('hasArgument', 'prepareArguments'), array(), '', FALSE);
     $viewHelper->expects($this->once())->method('prepareArguments')->willReturn(array($argument->getName() => $argument));
     $viewHelper->expects($this->once())->method('hasArgument')->with($argument->getName())->willReturn(TRUE);
     $viewHelper->setArguments(array($argument->getName() => $value));
     $this->setExpectedException('InvalidArgumentException');
     $viewHelper->validateArguments();
 }
Exemplo n.º 3
0
 /**
  * @test
  * @dataProvider getValidateArgumentsErrorsTestValues
  * @param ArgumentDefinition $argument
  * @param mixed $value
  */
 public function testValidateArgumentsErrors(ArgumentDefinition $argument, $value)
 {
     $viewHelper = $this->getAccessibleMock(AbstractViewHelper::class, ['hasArgument', 'prepareArguments'], [], '', false);
     $viewHelper->expects($this->once())->method('prepareArguments')->willReturn([$argument->getName() => $argument]);
     $viewHelper->expects($this->once())->method('hasArgument')->with($argument->getName())->willReturn(true);
     $viewHelper->setArguments([$argument->getName() => $value]);
     $this->setExpectedException('InvalidArgumentException');
     $viewHelper->validateArguments();
 }