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


PHP AgaviRequestDataHolder::setParameters方法代码示例

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


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

示例1: testSaveState

 /**
  * @depends testReadState
  * @group Database
  */
 public function testSaveState()
 {
     info("\tTesting state-save\n");
     $token = str_shuffle("ABCDEF123456789");
     $params = array("cmd" => "write", "data" => '[{"name":"test-case-setting","value":"TEST_CASE_' . $token . '"}]', "id" => 1, "session" => "session", "user" => "user");
     $paramHolder = new AgaviRequestDataHolder();
     $paramHolder->setParameters($params);
     $controller = AgaviContext::getInstance()->getController();
     $container = $controller->createExecutionContainer("AppKit", "Ext.ApplicationState", $paramHolder, "javascript", "write");
     try {
         $result = $container->execute();
         $data = json_decode($result->getContent(), true);
     } catch (Exception $e) {
         $this->fail("An exception was thrown during state write: " . $e->getMessage());
     }
     // Check for success state
     if (@(!$data["success"])) {
         $this->fail("Could not write view state! Your cronk settings may not be saved in icinga-web.");
     }
     // Finally get sure the enry is really set
     $entryFound = false;
     foreach ($data["data"] as $entry) {
         if ($entry["name"] == 'test-case-setting' && $entry["value"] == 'TEST_CASE_' . $token) {
             $entryFound = true;
         }
     }
     if (!$entryFound) {
         $this->fail("Write returned success, but preference could not be found in DB!\n");
     }
     success("\tWriting state succeeded!\n");
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:35,代码来源:persistenceView.php

示例2: testCorrectLogin

 /**
  * @depends testShowLoginMask
  * @group Interface
  */
 public function testCorrectLogin()
 {
     info("\tTesting correct login\n");
     $root = AgaviConfig::get("core.root_dir");
     $params = new AgaviRequestDataHolder();
     $params->setParameters(array("dologin" => 1, "password" => IcingaWebTestTool::getProperty('testLogin-pass'), "username" => IcingaWebTestTool::getProperty('testLogin-name')));
     $ctx = AgaviContext::getInstance('web');
     $container = $ctx->getController()->createExecutionContainer("AppKit", "Login.AjaxLogin", $params, "json", "write");
     $json = null;
     try {
         $result = $container->execute();
         $json = json_decode($result->getContent(), true);
         if (!$json) {
             throw new Exception("Invalid result given " . $result->getContent());
         }
     } catch (Exception $e) {
         $this->fail("Login threw an exception " . $e->getMessage());
     }
     if (!$json["success"]) {
         $this->fail("Login failed with test credentials. Please check the credentials in test.properties");
     }
     success("\tLogin successful\n");
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:27,代码来源:availabilityTest.php

示例3: testUserPreferenceRemove

 /**
  * @depends testUserPreferenceAdd
  * @group Database
  */
 public function testUserPreferenceRemove()
 {
     try {
         $userid = self::$idFixture;
         info("\tTesting icinga-web action: Remove user preference\n");
         $context = AgaviContext::getInstance();
         $preferenceData = new AgaviRequestDataHolder();
         $preferenceData->setParameters(array("remove" => "true", "isLong" => "false", "upref_key" => "TEST", "upref_val" => "TESTCASE"));
         $modifyAction = $context->getController()->createExecutionContainer("AppKit", "User.Preferences", $preferenceData, "simple", "write");
         IcingaWebTestTool::assertInstanceOf("AgaviExecutionContainer", $modifyAction, "Couldn't create add-preference action");
         $result = $modifyAction->execute();
         $this->assertNotEquals($result->getHttpStatusCode(), "404", "Action for eediting user preferences not found");
         success("\tDeleting preferences suceeded!\n");
         return true;
     } catch (Exception $e) {
         $this->fail("Removing an user preference failed!" . $e->getMessage());
     }
 }
开发者ID:philippjenni,项目名称:icinga-web,代码行数:22,代码来源:icingaUserOperations.php


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