Skip to content

Instantly share code, notes, and snippets.

@fatorx
Last active August 29, 2015 13:56
Show Gist options
  • Save fatorx/9196485 to your computer and use it in GitHub Desktop.
Save fatorx/9196485 to your computer and use it in GitHub Desktop.
Controller Test - get variables defined for ViewModel
<?php
public function testIfSetsVariablesInRequestABudgetAction()
{
$this->createMocks(); // create mocks for services
$this->dispatch('/en/contact/request-a-budget');
$this->assertResponseStatusCode(200);
$viewManager = $this->getApplicationServiceLocator()->get('ViewManager');
$variables = $viewManager->getViewModel()->getChildren()[0]->getVariables();
$this->assertArrayHasKey('form', $variables);
$this->assertInstanceOf('Services\Form\RequestABudget', $variables['form']);
$this->assertArrayHasKey('message', $variables);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment