Example #1
0
 /**
  * @param string $rootResourceId
  * @param array $savedData
  * @param bool $expectedValue
  * @dataProvider isEverythingAllowedWithSavedFromDataProvider
  */
 public function testIsEverythingAllowedWithSavedFromData($rootResourceId, $savedData, $expectedValue)
 {
     $this->registry->expects($this->once())->method('registry')->with(IntegrationController::REGISTRY_KEY_CURRENT_RESOURCE)->willReturn($savedData);
     $this->rootResource->expects($this->any())->method('getId')->will($this->returnValue($rootResourceId));
     $this->webapiBlock = $this->getWebapiBlock();
     $this->assertEquals($expectedValue, $this->webapiBlock->isEverythingAllowed());
 }
 public function testGetTree()
 {
     $this->webapiBlock = $this->getWebapiBlock();
     $resources = [1 => ['children' => [1, 2, 3]]];
     $this->aclResourceProvider->expects($this->once())->method('getAclResources')->will($this->returnValue($resources));
     $rootArray = "rootArrayValue";
     $this->integrationHelper->expects($this->once())->method('mapResources')->with([1, 2, 3])->will($this->returnValue($rootArray));
     $this->assertEquals($rootArray, $this->webapiBlock->getTree());
 }
Example #3
0
 /**
  * @magentoAppArea adminhtml
  */
 public function testToHtmlWithIntegrationData()
 {
     /** @var \Magento\Framework\Registry $coreRegistry */
     $coreRegistry = $this->objectManager->get('\\Magento\\Framework\\Registry');
     $coreRegistry->unregister(Integration::REGISTRY_KEY_CURRENT_INTEGRATION);
     $name = 'nameExample';
     $email = '*****@*****.**';
     $endpoint = 'exampleEndpoint';
     $identityLinkUrl = 'identityLinkUrl';
     $integrationData = [Info::DATA_ID => '1', Info::DATA_NAME => $name, Info::DATA_EMAIL => '*****@*****.**', Info::DATA_ENDPOINT => 'exampleEndpoint', Info::DATA_IDENTITY_LINK_URL => 'identityLinkUrl', Info::DATA_SETUP_TYPE => IntegrationModel::TYPE_MANUAL];
     $coreRegistry->register(Integration::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData);
     $html = $this->block->toHtml();
     $this->assertRegExp("/<input id=\"integration_properties_name\" name=\"name\".*value=\"{$name}\".*type=\"text\".*>/", $html);
     $this->assertRegExp("/<input id=\"integration_properties_email\" name=\"email\".*value=\"{$email}\".*type=\"text\".*>/", $html);
     $this->assertRegExp("/<input id=\"integration_properties_endpoint\" name=\"endpoint\".*value=\"{$endpoint}\".*type=\"text\".*>/", $html);
     $this->assertRegExp("/<input id=\"integration_properties_identity_link_url\" name=\"identity_link_url\".*" . "value=\"{$identityLinkUrl}\".*type=\"text\".*>/", $html);
     $this->assertRegExp('/<input id="integration_properties_consumer_key" name="consumer_key".*type="text".*>/', $this->block->toHtml());
     $this->assertRegExp('/<input id="integration_properties_consumer_secret" name="consumer_secret".*type="text".*>/', $this->block->toHtml());
     $this->assertRegExp('/<input id="integration_properties_token" name="token".*type="text".*>/', $this->block->toHtml());
     $this->assertRegExp('/<input id="integration_properties_token_secret" name="token_secret".*type="text".*>/', $this->block->toHtml());
 }
Example #4
0
 public function testIsHidden()
 {
     $this->assertFalse($this->infoBlock->isHidden());
 }