/** * @test */ public function addingArgumentThroughArrayAccessWorks() { $mockArgument = $this->getMock('Tx_Extbase_MVC_Controller_Argument', array('getName'), array(), '', FALSE); $mockArgument->expects($this->any())->method('getName')->will($this->returnValue('argumentName1234')); $arguments = new Tx_Extbase_MVC_Controller_Arguments(); $arguments[] = $mockArgument; $this->assertTrue($arguments->hasArgument('argumentName1234'), 'Added argument does not exist.'); $this->assertSame($mockArgument, $arguments->getArgument('argumentName1234'), 'Added and retrieved arguments are not the same.'); }
/** * @test */ public function getArgumentWithNonExistingArgumentNameThrowsException() { $arguments = new Tx_Extbase_MVC_Controller_Arguments(); try { $arguments->getArgument('someArgument'); $this->fail('getArgument() did not throw an exception although the specified argument does not exist.'); } catch (Tx_Extbase_MVC_Exception_NoSuchArgument $exception) { } }