当前位置: 首页>>代码示例>>PHP>>正文


PHP Parameters::set方法代码示例

本文整理汇总了PHP中Zend\Stdlib\Parameters::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Parameters::set方法的具体用法?PHP Parameters::set怎么用?PHP Parameters::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend\Stdlib\Parameters的用法示例。


在下文中一共展示了Parameters::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testWithProjectPathSet

 /**
  *  Test with project path set
  */
 public function testWithProjectPathSet()
 {
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_working_path_mandatory'));
     $this->parameters->set('workingPath', '/path/to/project/');
     $task = new ProjectPathMandatory();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
开发者ID:pjio,项目名称:zf2rapid,代码行数:11,代码来源:ProjectPathMandatoryTest.php

示例2: initDefaults

 /**
  * @param Parameters $params
  *
  * @return Parameters
  */
 protected function initDefaults(Parameters $params)
 {
     if (is_null($params->get('quality')) || !strlen(trim($params->get('quality')))) {
         $params->set('quality', QualityInterface::QUALITY_THUMBNAIL);
     }
     if (is_null($params->get('source')) || !strlen(trim($params->get('source')))) {
         $params->set('source', SourceNameInterface::SOURCE_USER);
     }
     return $params;
 }
开发者ID:spalax,项目名称:ua-webchalange-instagram-collage,代码行数:15,代码来源:ConfigurationData.php

示例3: login

 /**
  * @param $request
  * @return array|mixed|User
  * @throws \Exception
  */
 public function login($request)
 {
     $adapter = $this->getAuthPlugin()->getAuthAdapter();
     $pin = $request->get('pin');
     $accountId = $request->get('accountId');
     if (!empty($pin)) {
         $user = $this->getUserByPin($pin, $accountId);
         $credentials = array('username' => $user->getUsername(), 'password' => $user->getPassword());
     } else {
         $credentials = array('username' => $request->get('username'), 'password' => $request->get('password'));
     }
     $params = new Parameters();
     $params->set('identity', $credentials['username']);
     $params->set('credential', $credentials['password']);
     $emulatedRequest = new Request();
     $emulatedRequest->setPost($params);
     $result = $adapter->prepareForAuthentication($emulatedRequest);
     if ($result instanceof Response) {
         return $result;
     }
     $auth = $this->getAuthPlugin()->getAuthService()->authenticate($adapter);
     if (!$auth->isValid()) {
         $isRegistered = $this->isRegistered($credentials);
         $accountUser = $this->getAccountUsersByParams($params);
         if ($accountUser != null && !$isRegistered) {
             if ($this->getAgencyIsDeleted($accountUser->getAccountId())) {
                 throw new \Exception(self::AGENCY_DELETED_MESSAGE);
             }
             return $this->createUserFromAccountUsers($accountUser);
         }
         $account = $this->getAccountByParams($params);
         if ($account != null && !$isRegistered) {
             return $this->createUserFromAccount($account);
         }
         if ($accountUser != null && $isRegistered) {
             return $this->updateUser($accountUser);
         }
         $result = $auth->getMessages();
         $message = "Bad request.";
         if (isset($result[0])) {
             $message = $result[0];
         }
         throw new \Exception($message);
     }
     $accountUser = $this->getAccountUsersByParams($params);
     if ($this->getAgencyIsDeleted($accountUser->getAccountId())) {
         throw new \Exception(self::AGENCY_DELETED_MESSAGE);
     }
     if ($this->getUserIsDeleted($credentials['username'])) {
         throw new \Exception(self::USER_DELETED_MESSAGE);
     }
     $user = $this->getAuthPlugin()->getIdentity();
     return $user;
 }
开发者ID:javierdlahoz,项目名称:SS-zend,代码行数:59,代码来源:LoginAdapter.php

示例4: testWithKnownHydrators

 /**
  *  Test with controller existing
  */
 public function testWithKnownHydrators()
 {
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_base_hydrator_param_unknown'));
     $this->console->expects($this->never())->method('colorize');
     $knownHydrators = ['ArraySerializable', 'ClassMethods', 'ObjectProperty', 'Reflection'];
     foreach ($knownHydrators as $hydrator) {
         $this->parameters->set('paramBaseHydrator', $hydrator);
         $task = new BaseHydratorParam();
         $result = $task($this->route, $this->console, $this->parameters);
         $this->assertEquals(0, $result);
     }
 }
开发者ID:pgiacometto,项目名称:zf2rapid,代码行数:15,代码来源:BaseHydratorParamTest.php

示例5: testRunActionWithParams

 public function testRunActionWithParams()
 {
     $params = array('strict' => true, 'verbose' => true, 'debug' => true);
     $runner = $this->getMockForAbstractClass('HumusPHPUnitModule\\RunnerInterface');
     $runner->expects($this->once())->method('setParams')->with($params);
     $runner->expects($this->once())->method('run');
     $params = new Parameters();
     $params->set('strict', true);
     $params->set('verbose', true);
     $params->set('debug', true);
     $this->request->setParams($params);
     $this->controller->setRunner($runner);
     $response = new Response();
     $this->controller->dispatch($this->request, $response);
 }
开发者ID:aromatix,项目名称:HumusPHPUnitModule,代码行数:15,代码来源:IndexControllerTest.php

示例6: testWithModulePathExisting

 /**
  *  Test with module path existing
  */
 public function testWithModulePathExisting()
 {
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_working_path_not_exists'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('projectModuleDir', $this->zf2rapidModuleDir);
     $task = new ModulePathExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:12,代码来源:ModulePathExistsTest.php

示例7: testWithControllerPluginExisting

 /**
  *  Test with controller plugin existing
  */
 public function testWithControllerPluginExisting()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_check_checking_file'), ['controller plugin']);
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_file_exists_not_found'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('controllerPluginDir', $this->zf2rapidControllerPluginDir);
     $this->parameters->set('paramControllerPlugin', $this->zf2rapidControllerPluginName);
     file_put_contents($this->zf2rapidControllerPluginDir . $this->zf2rapidControllerPluginFile, 'class TestPlugin {}');
     $task = new ControllerPluginExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:15,代码来源:ControllerPluginExistsTest.php

示例8: testWithFormExisting

 /**
  *  Test with form existing
  */
 public function testWithFormExisting()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_check_checking_file'), ['form']);
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_file_exists_not_found'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('formDir', $this->zf2rapidFormDir);
     $this->parameters->set('paramForm', $this->zf2rapidFormName);
     file_put_contents($this->zf2rapidFormDir . $this->zf2rapidFormFile, 'class TestForm {}');
     $task = new FormExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:15,代码来源:FormExistsTest.php

示例9: testWithValidatorExisting

 /**
  *  Test with validator existing
  */
 public function testWithValidatorExisting()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_check_checking_file'), array('validator'));
     $this->console->expects($this->never())->method('writeFailLine')->with($this->equalTo('task_check_file_exists_not_found'));
     $this->console->expects($this->never())->method('colorize');
     $this->parameters->set('validatorDir', $this->zf2rapidValidatorDir);
     $this->parameters->set('paramValidator', $this->zf2rapidValidatorName);
     file_put_contents($this->zf2rapidValidatorDir . $this->zf2rapidValidatorFile, 'class TestValidator {}');
     $task = new ValidatorExists();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
 }
开发者ID:nomaanp,项目名称:zf2rapid,代码行数:15,代码来源:ValidatorExistsTest.php

示例10: testWithExistingFile

 /**
  *  Test with existing file
  */
 public function testWithExistingFile()
 {
     $this->parameters->set('workingPath', $this->zf2rapidFileDir);
     $expectedConfig = array('foo' => 'bar', 'one' => 'two');
     file_put_contents($this->zf2rapidFileDir . $this->zf2rapidFileName, json_encode($expectedConfig, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
     $task = new ConfigFile();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
     $this->assertEquals($expectedConfig, $this->parameters->config);
     $this->assertFileExists($this->zf2rapidFileDir . $this->zf2rapidFileName);
     $this->assertEquals($expectedConfig, json_decode(file_get_contents($this->zf2rapidFileDir . $this->zf2rapidFileName), true));
 }
开发者ID:pjio,项目名称:zf2rapid,代码行数:15,代码来源:ConfigFileTest.php

示例11: testPagesActionCanBeAccessedByPost

 public function testPagesActionCanBeAccessedByPost()
 {
     $this->routeMatch->setParam('action', 'pages');
     $this->request->setMethod('POST');
     $p = new Parameters();
     $p->set('role_id', '1');
     $this->request->setPost($p);
     $result = $this->controller->dispatch($this->request);
     $response = $this->controller->getResponse();
     $this->assertInstanceOf('Zend\\Http\\Response', $result);
     $this->assertEquals(302, $response->getStatusCode());
 }
开发者ID:opsway,项目名称:tocat-opsdesk-platform,代码行数:12,代码来源:PermissionControllerTest.php

示例12: testHydratorParam

 /**
  *  Test hydrator param
  */
 public function testHydratorParam()
 {
     $this->parameters->set('moduleSrcDir', '/path/to/module/dir/testModule/src');
     $this->parameters->set('config', ['namespaceHydrator' => 'Model\\Hydrator']);
     $paramValueMap = [['hydrator', null, 'HydratorName'], ['baseHydrator', null, 'BaseHydrator']];
     $this->route->method('getMatchedParam')->will($this->returnValueMap($paramValueMap));
     $task = new Params();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
     $this->assertEquals('HydratorName', $this->parameters->paramHydrator);
     $this->assertEquals('BaseHydrator', $this->parameters->paramBaseHydrator);
     $this->assertEquals('/path/to/module/dir/testModule/src/Model/Hydrator', $this->parameters->hydratorDir);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:16,代码来源:ParamsTest.php

示例13: testWithExistingFile

 /**
  *  Test with existing file
  */
 public function testWithExistingFile()
 {
     $this->parameters->set('workingPath', $this->zf2rapidFileDir);
     $setupConfig = ['foo' => 'bar', 'one' => 'two'];
     file_put_contents($this->zf2rapidFileDir . $this->zf2rapidFileName, json_encode($setupConfig, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
     $expectedConfig = array_merge($setupConfig, ['configFileFormat' => 'php', 'flagAddDocBlocks' => 'true', 'fileDocBlockText' => 'ZF2 Application built by ZF2rapid', 'fileDocBlockCopyright' => '(c) 2015 John Doe', 'fileDocBlockLicense' => 'http://opensource.org/licenses/MIT The MIT License (MIT)', 'namespaceController' => 'Controller', 'namespaceControllerPlugin' => 'Controller\\Plugin', 'namespaceViewHelper' => 'View\\Helper', 'namespaceFilter' => 'Filter', 'namespaceValidator' => 'Validator', 'namespaceInputFilter' => 'InputFilter', 'namespaceForm' => 'Form', 'namespaceHydrator' => 'Hydrator', 'namespaceEntity' => 'Entity', 'namespaceTableGateway' => 'TableGateway', 'namespaceStorage' => 'Storage', 'namespaceRepository' => 'Repository']);
     $task = new ConfigFile();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
     $this->assertEquals($expectedConfig, $this->parameters->config);
     $this->assertFileExists($this->zf2rapidFileDir . $this->zf2rapidFileName);
     $this->assertEquals($expectedConfig, json_decode(file_get_contents($this->zf2rapidFileDir . $this->zf2rapidFileName), true));
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:16,代码来源:ConfigFileTest.php

示例14: testWithModuleDirCreatingSucceed

 /**
  *  Test with module dir creating succeed
  */
 public function testWithModuleDirCreatingSucceed()
 {
     $this->console->expects($this->once())->method('writeTaskLine')->with($this->equalTo('task_create_structure_module_root_created'));
     $this->console->expects($this->once())->method('colorize');
     $this->parameters->set('moduleDir', $this->zf2rapidModuleDir);
     $this->parameters->set('moduleConfigDir', $this->zf2rapidModuleDir . 'config/');
     $this->parameters->set('moduleSrcDir', $this->zf2rapidModuleDir . 'src/');
     $this->parameters->set('moduleViewDir', $this->zf2rapidModuleDir . 'view/');
     $task = new CreateModuleStructure();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(0, $result);
     $this->assertFileExists($this->zf2rapidModuleDir);
     $this->assertFileExists($this->zf2rapidModuleDir . 'config/');
     $this->assertFileExists($this->zf2rapidModuleDir . 'src/');
     $this->assertFileExists($this->zf2rapidModuleDir . 'view/');
 }
开发者ID:nomaanp,项目名称:zf2rapid,代码行数:19,代码来源:CreateModuleStructureTest.php

示例15: testWithProjectPathNotAllowedFile

 /**
  *  Test with project path not allowed file
  */
 public function testWithProjectPathNotAllowedFile()
 {
     if (!file_exists($this->zf2rapidProjectPath)) {
         mkdir($this->zf2rapidProjectPath);
     }
     if (!file_exists($this->zf2rapidProjectPath . $this->zf2rapidNotAllowedFile)) {
         file_put_contents($this->zf2rapidProjectPath . $this->zf2rapidNotAllowedFile, 'test');
     }
     $this->console->expects($this->once())->method('writeFailLine')->with($this->equalTo('task_check_working_path_not_empty'));
     $this->console->expects($this->once())->method('colorize');
     $this->parameters->set('workingPath', $this->zf2rapidProjectPath);
     $this->assertFileExists($this->zf2rapidProjectPath);
     $task = new ProjectPathEmpty();
     $result = $task($this->route, $this->console, $this->parameters);
     $this->assertEquals(1, $result);
     $this->assertFileExists($this->zf2rapidProjectPath);
 }
开发者ID:zfrapid,项目名称:zf2rapid,代码行数:20,代码来源:ProjectPathEmptyTest.php


注:本文中的Zend\Stdlib\Parameters::set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。