public function setup() { parent::setup(); $this->controller = $this->prophesize("Ethna_Controller"); $this->event_dispatcher = $this->prophesize('\\Symfony\\Component\\EventDispatcher\\EventDispatcher'); $this->backend = $this->prophesize("Ethna_Backend"); $this->i18n = $this->prophesize("Ethna_I18N"); $this->action_error = $this->prophesize("Ethna_ActionError"); $this->plugin = $this->prophesize("Ethna_Plugin"); $this->logger = $this->prophesize("Ethna_Logger"); $this->controller->getEventDispatcher()->willReturn($this->event_dispatcher); $this->event_dispatcher->dispatch(Argument::type('string'), Argument::any())->will(function ($args, $event) { $action_form = $args[1]->getActionForm(); $target = null; if ($_SERVER['REQUEST_METHOD'] == 'GET') { $target =& $_GET; } else { $target = $_POST; } foreach ($target as $key => $value) { $action_form->set($key, $value); } }); $this->backend->getController()->willReturn($this->controller); $this->controller->getBackend()->willReturn($this->backend); $this->controller->getActionError()->willReturn($this->action_error); $this->controller->getI18N()->willReturn($this->i18n); $this->controller->getLogger()->willReturn($this->logger); $this->controller->getPlugin()->willReturn($this->plugin); }
protected function setup() { parent::setup(); $this->blank = new DefaultTree([], false); $this->full = new DefaultTree(['some' => ['entity' => ['edit' => false, 'delete' => false, 'view' => false], 'resource' => ['edit' => false]]], false); $this->inverse = new DefaultTree(['app' => ['res' => ['main' => ['see' => true]]], 'some' => ['entity' => ['delete' => true]]], true); }
public function setUp() { parent::setup(); $groupData = "\nwest:\n lists:\n webminister:\n members:\n - minister@sca.org\n - deputy@sca.org\n properties:\n group-name: West Kingdom Web Minister"; $this->initialState = Yaml::parse(trim($groupData)); $properties = array('top-level-group' => 'north', 'subdomains' => 'fogs,geese,wolves,lightwoods'); $this->policy = new StandardGroupPolicy('testdomain.org', $properties); }
public function setUp() { parent::setup(); $groupData = "\nwest:\n lists:\n webminister:\n members:\n - minister@sca.org\n - deputy@sca.org\n properties:\n group-name: West Kingdom Web Minister"; $this->initialState = Yaml::parse(trim($groupData)); $properties = array('top-level-group' => 'north', 'primary-office' => 'president', 'subdomains' => 'fogs,geese,wolves,lightwoods', 'aggregated-groups' => "\nlesseroffices:\n members:\n - vice-president\n - secretary\n - gophers\n properties:\n group-name: '\${branch} Lesser Officers'"); $this->policy = new StandardGroupPolicy('testdomain.org', $properties); }
protected function setup() { parent::setup(); $provider = $this->prophesize('AclBundle\\Access\\PolicyProviderInterface'); $builder = $this->prophesize('AclBundle\\Resource\\Builder'); $trans = $this->prophesize('AclBundle\\Resource\\Transformer\\Transformator'); $builder->tree()->willReturn(new DefaultTree(['resource' => ['edit' => false, 'view' => false], 'app' => ['edit' => false]], false)); $provider->policies()->willReturn(['resource.view' => true, 'app' => true]); $this->acl = new DecisionManager($builder->reveal(), $trans->reveal()); $this->acl->provider($provider->reveal()); }
public function setup() { parent::setup(); // Current command, we need to mock all method that interact with // Database & File system. $this->command = $this->getMockBuilder('PHPCI\\Command\\InstallCommand')->setMethods(array('reloadConfig', 'verifyNotInstalled', 'verifyDatabaseDetails', 'setupDatabase', 'createAdminUser', 'writeConfigFile'))->getMock(); $this->command->expects($this->once())->method('verifyDatabaseDetails')->willReturn(true); $this->command->expects($this->once())->method('setupDatabase')->willReturn(true); $this->command->expects($this->once())->method('createAdminUser')->will($this->returnCallback(function ($adm) { // use (&$admin) { $this->admin = $adm; })); $this->command->expects($this->once())->method('writeConfigFile')->will($this->returnCallback(function ($cfg) { //use (&$config) { $this->config = $cfg; })); // We check that there's no interaction with user. $this->dialog = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\DialogHelper')->setMethods(array('ask', 'askConfirmation', 'askAndValidate', 'askHiddenResponse', 'askHiddenResponseAndValidate'))->getMock(); $this->application = new Application(); $this->application->setHelperSet(new HelperSet()); }
public function setup() { parent::setup(); $this->controller = $this->prophesize("Ethna_Controller"); $this->config = $this->prophesize("Ethna_Config"); $this->i18n = $this->prophesize("Ethna_I18N"); $this->action_error = $this->prophesize("Ethna_ActionError"); $this->action_form = $this->prophesize("Ethna_ActionForm"); $this->action_class = $this->prophesize("Ethna_ActionClass"); $this->session = $this->prophesize("Ethna_Session"); $this->plugin = $this->prophesize("Ethna_Plugin"); $this->logger = $this->prophesize("Ethna_Logger"); $this->class_factory = $this->prophesize("Ethna_ClassFactory"); $this->controller->getClassFactory()->willReturn($this->class_factory); $this->controller->getConfig()->willReturn($this->config); $this->controller->getI18N()->willReturn($this->i18n); $this->controller->getActionError()->willReturn($this->action_error); $this->controller->getActionForm()->willReturn($this->action_form); $this->controller->getSession()->willReturn($this->session); $this->controller->getPlugin()->willReturn($this->plugin); $this->controller->getLogger()->willReturn($this->logger); }
public function setup() { parent::setup(); $this->controller = $this->prophesize("Ethna_Controller"); $this->backend = $this->prophesize("Ethna_Backend"); $this->config = $this->prophesize("Ethna_Config"); $this->i18n = $this->prophesize("Ethna_I18N"); $this->action_error = $this->prophesize("Ethna_ActionError"); $this->action_form = $this->prophesize("Ethna_ActionForm"); $this->session = $this->prophesize("Ethna_Session"); $this->plugin = $this->prophesize("Ethna_Plugin"); $this->logger = $this->prophesize("Ethna_Logger"); $this->backend->getLogger()->willReturn($this->logger); $this->backend->getPlugin()->willReturn($this->plugin); $this->backend->getSession()->willReturn($this->session); $this->backend->getActionForm()->willReturn($this->action_form); $this->backend->getActionError()->willReturn($this->action_error); $this->backend->getI18N()->willReturn($this->i18n); $this->backend->getConfig()->willReturn($this->config); $this->backend->getController()->willReturn($this->controller); $this->controller->getBackend()->willReturn($this->backend); }
public function setUp() { parent::setup(); }
protected function setup() { parent::setup(); $this->builder = new Builder([false, null, null, true]); $this->provider = $this->prophesize('AclBundle\\Resource\\ProviderInterface'); }
protected function setUp() { parent::setup(); $this->testedInterpolator = new BuildInterpolator(); }
public function setup() { parent::setup(); $this->application = new Application(); $this->application->setHelperSet(new HelperSet()); }