本文整理汇总了PHP中Resource::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Resource::get方法的具体用法?PHP Resource::get怎么用?PHP Resource::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resource
/**
* The resource associated with the request
* @return Resource
*/
public function resource()
{
if (!$this->_route->resource_name()) {
return NULL;
}
return Resource::get($this->_route->resource_name())->param($this->param());
}
示例2: testContextualMenuDisappearAfterChangingWorkspace
/**
* Scenario : The contextual menu should disappear after changing workspace
* Given I am logged in as Ada on the password workspace
* And I right click on a password
* Then I should see the contextual menu
* When I go to user workspace
* Then I should not see the contextual menu anymore
* When I right click on a user
* Then I should see the contextual menu
* When I go to password workspace
* Then I should not see the contextual menu
* When I right click again on the previous password where I had clicked.
* Then I should see again the contextual menu
*/
public function testContextualMenuDisappearAfterChangingWorkspace()
{
// Given I am Ada
$user = User::get('ada');
// And I am logged in on the password workspace
$this->setClientConfig($user);
$this->loginAs($user);
// When I right click on a password I own
$resource = Resource::get(array('user' => 'ada', 'permission' => 'owner'));
$this->rightClickPassword($resource['id']);
// Then I can see the contextual menu
$this->assertVisible('js_contextual_menu');
// When I change workspace
$this->gotoWorkspace('user');
// Then I shouldn't see the contextual menu anymore
$this->assertNotVisible('js_contextual_menu');
// And I right click on user betty
$betty = User::get(array('user' => 'betty'));
$this->rightClickUser($betty['id']);
// Then I can see the contextual menu
$this->assertVisible('js_contextual_menu');
// When I change workspace
$this->gotoWorkspace('password');
// Then I shouldn't see the contextual menu anymore
$this->assertNotVisible('js_contextual_menu');
// And I right click on the password I clicked before.
$this->rightClickPassword($resource['id']);
// Then I can see the contextual menu
$this->assertVisible('js_contextual_menu');
}
开发者ID:passbolt,项目名称:passbolt_selenium,代码行数:44,代码来源:PASSBOLT-1103_ContextualMenuDisappearAfterChangingWorkspaceTest.php
示例3: testNoEncryptionOnResourceNameEdit
/**
* Scenario: As a user editing my password encryption should not happen if do not edit the secret
* @throws Exception
*/
public function testNoEncryptionOnResourceNameEdit()
{
// Reset database at the end of test.
$this->resetDatabaseWhenComplete();
// Given I am Ada
$user = User::get('ada');
$this->setClientConfig($user);
// And I am logged in on the password workspace
$this->loginAs($user);
// And I am editing the name, description, uri, username of a password I own
$resource = Resource::get(array('user' => 'ada', 'permission' => 'owner'));
$r['id'] = $resource['id'];
$r['description'] = 'this is a new description';
$r['name'] = 'newname';
$r['username'] = 'newusername';
$r['uri'] = 'http://newuri.com';
$this->gotoEditPassword($r['id']);
$this->inputText('js_field_name', $r['name']);
$this->inputText('js_field_username', $r['username']);
$this->inputText('js_field_uri', $r['uri']);
$this->inputText('js_field_description', $r['description']);
// And I click the submit button
$this->click('.edit-password-dialog input[type=submit]');
// For one second, every 1/10 seconds, check that the popup is not visible.
for ($i = 0; $i < 10; $i++) {
$this->assertNotVisible('passbolt-iframe-progress-dialog');
usleep(100000);
}
// Then I should see a success notification message saying the password is updated.
$this->assertNotification('app_resources_edit_success');
}
开发者ID:passbolt,项目名称:passbolt_selenium,代码行数:35,代码来源:PASSBOLT-1040_NoEncryptionOnResourceNameEditTest.php
示例4: request
/**
* Executes request on link.
*
* @param string $url
* @param string $method
* @param array $postfields
* @return null|string
*/
private function request($url, $method = 'GET', $postfields = [])
{
switch (strtolower($method)) {
case "get":
return $this->ch->get($url);
break;
case "post":
return $this->ch->post($url, $postfields);
break;
}
return null;
}
示例5: testMasterPasswordRemember
/**
* Scenario : As a user I can have my passphrase remembered by the system.
*
* Given I am Ada
* And I am logged in on the password workspace
* When I click on a password in the list
* And I click on the link 'copy password'
* Then I should see the passphrase dialog.
* And I should see a checkbox remember my passphrase.
* When I enter my passphrase from keyboard only
* Then The password should have been copied to clipboard
* When I click on another password in the list
* And I click on the link 'copy password'
* Then I should see the passphrase dialog
* When I enter my passphrase from keyboard only
* And I check the remember checkbox
* Then The password should have been copied to clipboard
* When I click on another password in the list
* And I click again on the copy button in the action bar
* Then The password should have been copied to clipboard
*/
function testMasterPasswordRemember()
{
// Given I am Ada
$user = User::get('ada');
$this->setClientConfig($user);
// And I am logged in on the password workspace
$this->loginAs($user);
// When I click on a password in the list
$rsA = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.apache')));
$this->clickPassword($rsA['id']);
// And I click on the link 'copy password'
$this->click('js_wk_menu_secretcopy_button');
// Then I should see the passphrase dialog.
$this->assertMasterPasswordDialog($user);
// And I should see a checkbox remember my passphrase
$this->goIntoMasterPasswordIframe();
$this->assertVisible('js_remember_master_password');
$this->goOutOfIframe();
// When I enter my passphrase from keyboard only
$this->enterMasterPassword($user['MasterPassword'], false);
// Then The password should have been copied to clipboard
$this->waitCompletion();
$this->assertClipboard($rsA['password']);
// When I click on another password in the list
$rsB = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.bower')));
$this->clickPassword($rsB['id']);
// And I click on the link 'copy password'
$this->click('js_wk_menu_secretcopy_button');
// Then I should see the passphrase dialog
$this->assertMasterPasswordDialog($user);
// When I enter my passphrase from keyboard only
// And I check the remember checkbox
$this->enterMasterPassword($user['MasterPassword'], true);
// Then The password should have been copied to clipboard
$this->waitCompletion();
$this->assertClipboard($rsB['password']);
// When I click on another password in the list
$rsC = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.centos')));
$this->clickPassword($rsC['id']);
// And I click on the link 'copy password'
$this->click('js_wk_menu_secretcopy_button');
// Then The password should have been copied to clipboard
$this->waitCompletion();
$this->assertClipboard($rsC['password']);
}
示例6: _resource
private function _resource(Resource $resource)
{
$resource_string = "\n" . Minion_CLI::color(' ' . $resource->name(), 'green');
if ($this->_options['actions'] !== FALSE) {
$resource_string .= $this->_resource_actions($resource);
} elseif ($this->_options['uris'] !== FALSE) {
$resource_string .= $this->_resource_uris($resource);
}
foreach ($resource->children() as $child_resource_name) {
$resource_string .= "\n" . ' ' . Minion_CLI::color(substr($child_resource_name, strlen($resource->name()) + 1), 'cyan');
if ($this->_options['actions'] !== FALSE) {
$resource_string .= $this->_resource_actions(Resource::get($child_resource_name), ' ');
} elseif ($this->_options['uris'] !== FALSE) {
$resource_string .= $this->_resource_uris(Resource::get($child_resource_name), ' ');
}
}
$resource_string .= "\n";
return $resource_string;
}
示例7: testCantSelectMultiplePasswords
/**
* Scenario: As LU I can't select multiple passwprd
*
* Given I am Ada
* And I am logged in on the password workspace
* When I click on a password checkbox
* Then I should see the password selected
* When I click on another password checkbox
* Then I should see only the last password selected
*
*/
public function testCantSelectMultiplePasswords()
{
// Given I am Ada
$user = User::get('ada');
$this->setClientConfig($user);
// And I am logged on the password workspace
$this->loginAs($user);
// When I click on a user checkbox
$rsA = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.apache')));
$this->click('multiple_select_checkbox_' . $rsA['id']);
// Then I should see it selected
$this->isPasswordSelected($rsA['id']);
// When click on another user checkbox
$rsG = Resource::get(array('user' => 'ada', 'id' => Uuid::get('resource.id.gnupg')));
$this->click('multiple_select_checkbox_' . $rsG['id']);
// Then I should see only the last user selected
$this->assertPasswordSelected($rsG['id']);
$this->assertPasswordNotSelected($rsA['id']);
}
示例8: testContextualMenuMustCloseAfterClick
/**
* The contextual menu should close after a click / not remain open.
* Given I am Ada
* And the database is in the default state
* And I am logged in on the password workspace
* And I right click on an item I own
* Then I can see the contextual menu
* When I click on the edit link
* Then I cannot see the contextual menu
*/
public function testContextualMenuMustCloseAfterClick()
{
// Reset database at the end of test.
$this->resetDatabaseWhenComplete();
// Given I am Ada
$user = User::get('ada');
$resource = Resource::get(array('user' => 'ada'));
$this->setClientConfig($user);
// And I am logged in on the password workspace
$this->loginAs($user);
// And I right click on an item I own
$this->rightClickPassword($resource['id']);
// Then I can see the contextual menu
$this->assertVisible('js_contextual_menu');
// When I click on the edit link
$this->click('#js_password_browser_menu_edit a');
// Then I cannot see the contextual menu
$this->assertNotVisible('js_contextual_menu');
}
示例9: testOnClickSessionExpiredManualRedirect
public function testOnClickSessionExpiredManualRedirect()
{
// Given I am Ada
$user = User::get('ada');
$this->setClientConfig($user);
// Reduce the session timeout to accelerate the test
PassboltServer::setExtraConfig(['Session' => ['timeout' => 0.25]]);
// And I am logged in on the password workspace
$this->loginAs($user);
sleep(15);
// When I click on a password I own
$resource = Resource::get(array('user' => 'ada', 'permission' => 'owner'));
$this->clickPassword($resource['id']);
// Then I should see the session expired dialog
$this->assertSessionExpiredDialog();
// When I click on Redirect now
$this->click('confirm-button');
// Then I should see the login page
$this->waitUntilISee('.plugin-check.' . $this->_browser['type'] . '.success');
}
示例10: load
public function load()
{
parent::load();
//$this->view->ruler = $this->generateRuler($this->view->start_time, $this->view->end_time);
$this->view->rgs = $this->rgs;
//message("success", "Hello there");
$model = new ResourceGroup();
$this->view->resource_groups = $model->getindex();
$resource_model = new Resource();
$resource_service_model = new ResourceServices();
$this->view->resources = array();
$this->view->services = array();
foreach ($this->rgs as $rg) {
foreach ($rg as $rid => $resource) {
//load resource detail
$recs = $resource_model->get(array("resource_id" => $rid));
$this->view->resources[$rid] = $recs[0];
//load service info
$params = array("resource_id" => $rid);
$this->view->services[$rid] = $resource_service_model->get($params);
}
}
}
示例11: get
public function get(\Engine\IResponse $response)
{
parent::get($response);
$response->sendData(["url" => $this->url->getUrl(), "method" => $this->method->getMethod(), "get" => $this->get, "Provider\\Test" => $this->provider->get("Test")->checkIfWorking()]);
}
示例12: testCopyPasswordToClipboardViaSidebarSecretCopy
/**
* Scenario: As a user I can copy my password to clipboard by clicking on the password preview in the sidebar
*
* Given I am Ada
* And I am logged in on the password workspace
* When I click on the resource row in the grid
* And I click on a the copy secret password link in the sidebar
* And I enter my passphrase
* Then the password is copied to clipboard
*/
public function testCopyPasswordToClipboardViaSidebarSecretCopy()
{
// Given I am Ada
$user = User::get('ada');
$resource = Resource::get(array('user' => 'ada'));
$this->setClientConfig($user);
// And I am logged in on the password workspace
$this->loginAs($user);
// When I click on the resource row in the grid
$this->clickPassword($resource['id']);
// And I click on a the copy secret password link in the sidebar
$this->click('sidebar_secret_copy_' . $resource['id']);
// And I enter my passphrase
$this->enterMasterPassword($user['MasterPassword']);
// Then I can see a success message saying the username was copied to clipboard
$this->assertNotification('plugin_secret_copy_success');
// Then the password is copied to clipboard
$this->assertClipboard($resource['password']);
}
示例13: cleanup
/**
*
*/
public static function cleanup()
{
// remove database tmp table
$db = Resource::get();
$db->query("DROP TABLE IF EXISTS `" . self::$tmpTable . "`");
//delete tmp data
recursiveDelete(PIMCORE_SYSTEM_TEMP_DIRECTORY . "/update", true);
}
示例14: testCommentAddEmailNotification
/**
* Scenario : As a user I should receive an email notification when I write a comment.
* Given I am Ada
* And I am logged in
* And I click on a password
* Then I should see the section comments in the sidebar
* And I should see the comment form with a submit button
* Given I am enter a comment in the textearea
* And I click on the send button
* Then I should see a notification saying that the comment has been added
* When I access the last email sent to a person the password is shared with (not me)
* Then I should see that the title contains 'myname' commented on 'resourcename'
* And I should see that the email contains the resource name
* And I should see that the email containe the comment content
*/
public function testCommentAddEmailNotification()
{
// Reset database at the end of test.
$this->resetDatabaseWhenComplete();
// Define comment.
$comment = 'this is a comment';
// Given I am Ada
$user = User::get('ada');
$this->setClientConfig($user);
// And I am logged in on the password workspace
$this->loginAs($user);
// Make sure the password field is not visible
$this->assertNotVisible($this->commentFormSelector);
// When I click on a password I own
$resource = Resource::get(array('user' => 'ada', 'permission' => 'owner'));
$this->clickPassword($resource['id']);
// Enter comment and submit.
$this->postCommentInSidebar($comment);
// Access last email sent to Betty.
$this->getUrl('seleniumTests/showLastEmail/' . urlencode(User::get('betty')['Username']));
// The email title should be:
$this->assertMetaTitleContains(sprintf('%s commented on %s', $user['FirstName'], $resource['name']));
// I should see the resource name in the email.
$this->assertElementContainsText('bodyTable', $user['FirstName'] . ' ' . $user['LastName']);
// I should see the resource name in the email.
$this->assertElementContainsText('bodyTable', $comment);
// I should see the comment in the email
$this->assertElementContainsText('bodyTable', $comment);
}
示例15: testCloseRestoreTabAndEditPassword
/**
* @group no-saucelabs
*
* Scenario: As LU I should be able to edit a password after I close and restore the passbolt tab
* Given I am Ada
* And I am on second tab
* And I am logged in on the passwords workspace
* When I close and restore the tab
* Then I should be able to edit a password
*
* @throws Exception
*/
public function testCloseRestoreTabAndEditPassword()
{
// Reset database at the end of test.
$this->resetDatabaseWhenComplete();
// Given I am Ada
$user = User::get('ada');
$this->setClientConfig($user);
// And I am on second tab
$this->openNewTab();
// And I am logged in on the password workspace
$this->loginAs($user);
// When I close and restore the tab
$this->closeAndRestoreTab();
$this->waitCompletion();
// Then I should be able to edit a password
$r1 = Resource::get(array('user' => 'betty', 'permission' => 'update'));
$r2 = array('id' => $r1['id'], 'password' => 'our_brand_new_password');
$this->editPassword($r2, $user);
}