/** * Helper function for the bound property * * @param $formObject */ protected function stubVariableContainer($formObject) { $this->viewHelperVariableContainer->exists(Argument::cetera())->willReturn(true); $this->viewHelperVariableContainer->get(Argument::any(), 'formObjectName')->willReturn('objectName'); $this->viewHelperVariableContainer->get(Argument::any(), 'fieldNamePrefix')->willReturn('fieldPrefix'); $this->viewHelperVariableContainer->get(Argument::any(), 'formFieldNames')->willReturn([]); $this->viewHelperVariableContainer->get(Argument::any(), 'formObject')->willReturn($formObject); $this->viewHelperVariableContainer->get(Argument::any(), 'renderedHiddenFields')->willReturn([]); $this->viewHelperVariableContainer->addOrUpdate(Argument::cetera())->willReturn(null); }
/** * @test */ public function testGetReturnsDefaultIfRequestedVariableDoesNotExist() { $subject = new ViewHelperVariableContainer(); $this->assertEquals('test', $subject->get('foo', 'bar', 'test')); }
/** * @param string $as * @param ViewHelper\ViewHelperVariableContainer $viewHelperVariableContainer * @return integer */ protected static function initializeIndex($as, ViewHelper\ViewHelperVariableContainer $viewHelperVariableContainer) { $index = 0; if ($viewHelperVariableContainer->exists(static::class, $as)) { $index = $viewHelperVariableContainer->get(static::class, $as); } return $index; }