當前位置: 首頁>>代碼示例>>PHP>>正文


PHP App\ConfigInterface類代碼示例

本文整理匯總了PHP中Magento\Backend\App\ConfigInterface的典型用法代碼示例。如果您正苦於以下問題:PHP ConfigInterface類的具體用法?PHP ConfigInterface怎麽用?PHP ConfigInterface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ConfigInterface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 public function __construct(\Magento\Backend\App\ConfigInterface $backendConfig, \Symfony\Component\Yaml\Parser $yamlParser, \Magento\Framework\Filesystem $filesystem, \Magento\Config\Model\Config\Factory $configFactory)
 {
     $this->_yamlParser = $yamlParser;
     $this->_backendConfig = $backendConfig;
     $this->_directory = $filesystem->getDirectoryWrite(DirectoryList::ROOT);
     $this->_folderLocation = str_replace('###MAGE_BASE###', $this->_getBaseDir(), $this->_backendConfig->getValue(self::XML_SYSTEM_PATH));
     $this->_configFactory = $configFactory;
 }
開發者ID:jzahedieh,項目名稱:Magento2-FileConfigurator,代碼行數:8,代碼來源:Yaml.php

示例2: __construct

 /**
  * @param \Magento\Framework\App\Helper\Context $context
  * @param \Magento\Framework\Registry $coreRegistry
  * @param \Magento\Framework\ObjectManager\ConfigInterface $config
  */
 public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\ObjectManager\ConfigInterface $config, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\Framework\Module\ModuleListInterface $moduleList, \Magento\Framework\Module\ResourceInterface $moduleResource, \Magento\Framework\Module\ModuleList\Loader $loader, \Magento\Framework\Xml\Parser $parser, \Magento\Framework\Filesystem\Driver\File $driver, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\App\ProductMetadataInterface $productMetadata, \Magento\Framework\ObjectManagerInterface $objectManager)
 {
     $this->_backendConfig = $backendConfig;
     $this->moduleList = $moduleList;
     $this->moduleResource = $moduleResource;
     $this->_loader = $loader;
     $this->parser = $parser;
     $this->driver = $driver;
     $this->_objectManager = $objectManager;
     $this->urlBuilder = $urlBuilder;
     $this->productMetadata = $productMetadata;
     $this->_allowedFeedType = explode(',', $backendConfig->getValue(\Ced\DevTool\Model\Feed::XML_FEED_TYPES));
     parent::__construct($context);
 }
開發者ID:dineshmalekar,項目名稱:Magento2-Developer-Debug-Tool,代碼行數:19,代碼來源:Feed.php

示例3: testCheckUpdate

 /**
  * @dataProvider checkUpdateDataProvider
  * @param bool $callInbox
  * @param string $curlRequest
  */
 public function testCheckUpdate($callInbox, $curlRequest)
 {
     $mockName = 'Test Product Name';
     $mockVersion = '0.0.0';
     $mockEdition = 'Test Edition';
     $mockUrl = 'http://test-url';
     $this->productMetadata->expects($this->once())->method('getName')->willReturn($mockName);
     $this->productMetadata->expects($this->once())->method('getVersion')->willReturn($mockVersion);
     $this->productMetadata->expects($this->once())->method('getEdition')->willReturn($mockEdition);
     $this->urlBuilder->expects($this->once())->method('getUrl')->with('*/*/*')->willReturn($mockUrl);
     $configValues = ['timeout' => 2, 'useragent' => $mockName . '/' . $mockVersion . ' (' . $mockEdition . ')', 'referer' => $mockUrl];
     $lastUpdate = 0;
     $this->cacheManager->expects($this->once())->method('load')->will($this->returnValue($lastUpdate));
     $this->curlFactory->expects($this->at(0))->method('create')->will($this->returnValue($this->curl));
     $this->curl->expects($this->once())->method('setConfig')->with($configValues)->willReturnSelf();
     $this->curl->expects($this->once())->method('read')->will($this->returnValue($curlRequest));
     $this->backendConfig->expects($this->at(0))->method('getValue')->will($this->returnValue('1'));
     $this->backendConfig->expects($this->once())->method('isSetFlag')->will($this->returnValue(false));
     $this->backendConfig->expects($this->at(1))->method('getValue')->will($this->returnValue('http://feed.magento.com'));
     $this->deploymentConfig->expects($this->once())->method('get')->with(ConfigOptionsListConstants::CONFIG_PATH_INSTALL_DATE)->will($this->returnValue('Sat, 6 Sep 2014 16:46:11 UTC'));
     if ($callInbox) {
         $this->inboxFactory->expects($this->once())->method('create')->will($this->returnValue($this->inboxModel));
         $this->inboxModel->expects($this->once())->method('parse')->will($this->returnSelf());
     } else {
         $this->inboxFactory->expects($this->never())->method('create');
         $this->inboxModel->expects($this->never())->method('parse');
     }
     $this->feed->checkUpdate();
 }
開發者ID:koliaGI,項目名稱:magento2,代碼行數:34,代碼來源:FeedTest.php

示例4: getFrontName

 /**
  * Retrieve area front name
  *
  * @return string
  */
 public function getFrontName()
 {
     $isCustomPathUsed = (bool) (string) $this->config->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_PATH);
     if ($isCustomPathUsed) {
         return (string) $this->config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH);
     }
     return $this->defaultFrontName;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:13,代碼來源:FrontNameResolver.php

示例5: getFrontName

 /**
  * Retrieve area front name
  *
  * @param bool $checkHost If true, verify front name is valid for this url (hostname is correct)
  * @return string|bool
  */
 public function getFrontName($checkHost = false)
 {
     if ($checkHost && !$this->isHostBackend()) {
         return false;
     }
     $isCustomPathUsed = (bool)(string)$this->config->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_PATH);
     if ($isCustomPathUsed) {
         return (string)$this->config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH);
     }
     return $this->defaultFrontName;
 }
開發者ID:razbakov,項目名稱:magento2,代碼行數:17,代碼來源:FrontNameResolver.php

示例6: _canShowNotification

 /**
  * Check verification result and return true if system must to show notification message
  *
  * @return bool
  */
 private function _canShowNotification()
 {
     if ($this->_cache->load(self::VERIFICATION_RESULT_CACHE_KEY)) {
         return false;
     }
     if ($this->_isFileAccessible()) {
         return true;
     }
     $adminSessionLifetime = (int) $this->_backendConfig->getValue('admin/security/session_lifetime');
     $this->_cache->save(true, self::VERIFICATION_RESULT_CACHE_KEY, [], $adminSessionLifetime);
     return false;
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:17,代碼來源:Security.php

示例7: authenticate

    /**
     * Authenticate user name and password and save loaded record
     *
     * @param string $username
     * @param string $password
     * @return bool
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function authenticate($username, $password)
    {
        $config = $this->_config->isSetFlag('admin/security/use_case_sensitive_login');
        $result = false;

        try {
            $this->_eventManager->dispatch(
                'admin_user_authenticate_before',
                ['username' => $username, 'user' => $this]
            );
            $this->loadByUsername($username);
            $sensitive = $config ? $username == $this->getUsername() : true;
            if ($sensitive && $this->getId()) {
                $result = $this->verifyIdentity($password);
            }

            $this->_eventManager->dispatch(
                'admin_user_authenticate_after',
                ['username' => $username, 'password' => $password, 'user' => $this, 'result' => $result]
            );
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            $this->unsetData();
            throw $e;
        }

        if (!$result) {
            $this->unsetData();
        }
        return $result;
    }
開發者ID:razbakov,項目名稱:magento2,代碼行數:38,代碼來源:User.php

示例8: testAuthenticateException

 /**
  * @expectedException \Magento\Framework\Exception\LocalizedException
  * @return void
  */
 public function testAuthenticateException()
 {
     $username = 'username';
     $password = 'password';
     $config = 'config';
     $this->configMock->expects($this->once())->method('isSetFlag')->with('admin/security/use_case_sensitive_login')->willReturn($config);
     $this->eventManagerMock->expects($this->any())->method('dispatch');
     $this->resourceMock->expects($this->once())->method('loadByUsername')->willThrowException(new \Magento\Framework\Exception\LocalizedException(__()));
     $this->model->authenticate($username, $password);
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:14,代碼來源:UserTest.php

示例9: prolong

 /**
  * Set session UpdatedAt to current time and update cookie expiration time
  *
  * @return void
  */
 public function prolong()
 {
     $lifetime = $this->_config->getValue(self::XML_PATH_SESSION_LIFETIME);
     $currentTime = time();
     $this->setUpdatedAt($currentTime);
     $cookieValue = $this->_cookie->get($this->getName());
     if ($cookieValue) {
         $this->_cookie->set($this->getName(), $cookieValue, $lifetime, $this->sessionConfig->getCookiePath(), $this->sessionConfig->getCookieDomain(), $this->sessionConfig->getCookieSecure(), $this->sessionConfig->getCookieHttpOnly());
     }
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:15,代碼來源:Session.php

示例10: prolong

 /**
  * Set session UpdatedAt to current time and update cookie expiration time
  *
  * @return void
  */
 public function prolong()
 {
     $lifetime = $this->_config->getValue(self::XML_PATH_SESSION_LIFETIME);
     $currentTime = time();
     $this->setUpdatedAt($currentTime);
     $cookieValue = $this->cookieManager->getCookie($this->getName());
     if ($cookieValue) {
         $cookieMetadata = $this->cookieMetadataFactory->createPublicCookieMetadata()->setDuration($lifetime)->setPath($this->sessionConfig->getCookiePath())->setDomain($this->sessionConfig->getCookieDomain())->setSecure($this->sessionConfig->getCookieSecure())->setHttpOnly($this->sessionConfig->getCookieHttpOnly());
         $this->cookieManager->setPublicCookie($this->getName(), $cookieValue, $cookieMetadata);
     }
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:16,代碼來源:Session.php

示例11: testTrackAdminPassword

 public function testTrackAdminPassword()
 {
     $newPW = "mYn3wpassw0rd";
     $uid = 123;
     /** @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject $eventObserverMock */
     $eventObserverMock = $this->getMockBuilder('Magento\\Framework\\Event\\Observer')->disableOriginalConstructor()->setMethods([])->getMock();
     /** @var \Magento\Framework\Event|\PHPUnit_Framework_MockObject_MockObject */
     $eventMock = $this->getMockBuilder('Magento\\Framework\\Event')->disableOriginalConstructor()->setMethods(['getObject'])->getMock();
     /** @var \Magento\User\Model\User|\PHPUnit_Framework_MockObject_MockObject $userMock */
     $userMock = $this->getMockBuilder('Magento\\User\\Model\\User')->disableOriginalConstructor()->setMethods(['getId', 'getPassword', 'getForceNewPassword'])->getMock();
     $eventObserverMock->expects($this->once())->method('getEvent')->willReturn($eventMock);
     $eventMock->expects($this->once())->method('getObject')->willReturn($userMock);
     $userMock->expects($this->once())->method('getId')->willReturn($uid);
     $userMock->expects($this->once())->method('getPassword')->willReturn($newPW);
     $this->configInterfaceMock->expects($this->atLeastOnce())->method('getValue')->willReturn(1);
     $userMock->expects($this->once())->method('getForceNewPassword')->willReturn(false);
     /** @var \Magento\Framework\Message\Collection|\PHPUnit_Framework_MockObject_MockObject $collectionMock */
     $collectionMock = $this->getMockBuilder('Magento\\Framework\\Message\\Collection')->disableOriginalConstructor()->setMethods([])->getMock();
     $this->managerInterfaceMock->expects($this->once())->method('getMessages')->willReturn($collectionMock);
     $this->authSessionMock->expects($this->once())->method('unsPciAdminUserIsPasswordExpired')->willReturn(null);
     $this->model->execute($eventObserverMock);
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:22,代碼來源:TrackAdminNewPasswordObserverTest.php

示例12: isLoggedIn

 /**
  * Check if user is logged in
  *
  * @return boolean
  */
 public function isLoggedIn()
 {
     $lifetime = $this->_config->getValue(self::XML_PATH_SESSION_LIFETIME);
     $currentTime = time();
     /* Validate admin session lifetime that should be more than 60 seconds */
     if ($lifetime >= 60 && $this->getUpdatedAt() < $currentTime - $lifetime) {
         return false;
     }
     if ($this->getUser() && $this->getUser()->getId()) {
         return true;
     }
     return false;
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:18,代碼來源:Session.php

示例13: testCustomerHasFailedMaxNumberOfAttempts

 /**
  * @return void
  */
 public function testCustomerHasFailedMaxNumberOfAttempts()
 {
     $customerId = 1;
     $date = new \DateTime();
     $date->modify('-500 second');
     $formattedDate = $date->format('Y-m-d H:i:s');
     $this->backendConfigMock->expects($this->exactly(2))->method('getValue')->withConsecutive([\Magento\Customer\Helper\AccountManagement::LOCKOUT_THRESHOLD_PATH], [\Magento\Customer\Helper\AccountManagement::MAX_FAILURES_PATH])->willReturnOnConsecutiveCalls(10, 5);
     $this->customerRegistryMock->expects($this->once())->method('retrieveSecureData')->with($customerId)->willReturn($this->customerSecure);
     $this->customerSecure->expects($this->once())->method('getFailuresNum')->willReturn(5);
     $this->customerSecure->expects($this->once())->method('getFirstFailure')->willReturn($formattedDate);
     $this->customerSecure->expects($this->once())->method('setLockExpires');
     $this->customerSecure->expects($this->once())->method('setFailuresNum');
     $this->helper->processCustomerLockoutData($customerId);
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:17,代碼來源:AccountManagementTest.php

示例14: testForceAdminPasswordChange

 public function testForceAdminPasswordChange()
 {
     /** @var \Magento\Framework\Event\Observer|\PHPUnit_Framework_MockObject_MockObject $eventObserverMock */
     $eventObserverMock = $this->getMockBuilder('Magento\\Framework\\Event\\Observer')->disableOriginalConstructor()->setMethods([])->getMock();
     /** @var \Magento\Framework\Event|\PHPUnit_Framework_MockObject_MockObject */
     $eventMock = $this->getMockBuilder('Magento\\Framework\\Event')->disableOriginalConstructor()->setMethods(['getControllerAction', 'getRequest'])->getMock();
     $this->configInterfaceMock->expects($this->atLeastOnce())->method('getValue')->willReturn(1);
     $this->authSessionMock->expects($this->once())->method('isLoggedIn')->willReturn(true);
     $eventObserverMock->expects($this->atLeastOnce())->method('getEvent')->willReturn($eventMock);
     /** @var \Magento\Framework\App\Action\Action $controllerMock */
     $controllerMock = $this->getMockBuilder('Magento\\Framework\\App\\Action\\AbstractAction')->disableOriginalConstructor()->setMethods(['getRedirect', 'getRequest'])->getMockForAbstractClass();
     /** @var \Magento\Framework\App\RequestInterface $requestMock */
     $requestMock = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->disableOriginalConstructor()->setMethods(['getFullActionName', 'setDispatched'])->getMockForAbstractClass();
     $eventMock->expects($this->once())->method('getControllerAction')->willReturn($controllerMock);
     $eventMock->expects($this->once())->method('getRequest')->willReturn($requestMock);
     $this->authSessionMock->expects($this->once())->method('getPciAdminUserIsPasswordExpired')->willReturn(true);
     $requestMock->expects($this->once())->method('getFullActionName')->willReturn('not_in_array');
     $this->authSessionMock->expects($this->once())->method('clearStorage');
     $this->sessionMock->expects($this->once())->method('clearStorage');
     $this->managerInterfaceMock->expects($this->once())->method('addErrorMessage');
     $controllerMock->expects($this->once())->method('getRequest')->willReturn($requestMock);
     $requestMock->expects($this->once())->method('setDispatched')->willReturn(false);
     $this->model->execute($eventObserverMock);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:24,代碼來源:ForceAdminPasswordChangeObserverTest.php

示例15: testSendPasswordResetConfirmationEmail

 public function testSendPasswordResetConfirmationEmail()
 {
     $storeId = 0;
     $email = 'test@example.com';
     $firstName = 'Foo';
     $lastName = 'Bar';
     $this->_model->setEmail($email);
     $this->_model->setFirstname($firstName);
     $this->_model->setLastname($lastName);
     $this->_configMock->expects($this->at(0))->method('getValue')->with(\Magento\User\Model\User::XML_PATH_FORGOT_EMAIL_TEMPLATE)->will($this->returnValue('templateId'));
     $this->_configMock->expects($this->at(1))->method('getValue')->with(\Magento\User\Model\User::XML_PATH_FORGOT_EMAIL_IDENTITY)->will($this->returnValue('sender'));
     $this->_transportBuilderMock->expects($this->once())->method('setTemplateOptions')->will($this->returnSelf());
     $this->_transportBuilderMock->expects($this->once())->method('setTemplateVars')->with(['user' => $this->_model, 'store' => $this->_storetMock])->will($this->returnSelf());
     $this->_transportBuilderMock->expects($this->once())->method('addTo')->with($this->equalTo($email), $this->equalTo($firstName . ' ' . $lastName))->will($this->returnSelf());
     $this->_transportBuilderMock->expects($this->once())->method('setFrom')->with('sender')->will($this->returnSelf());
     $this->_transportBuilderMock->expects($this->once())->method('setTemplateIdentifier')->with('templateId')->will($this->returnSelf());
     $this->_transportBuilderMock->expects($this->once())->method('getTransport')->will($this->returnValue($this->_transportMock));
     $this->_transportMock->expects($this->once())->method('sendMessage');
     $this->_storeManagerMock->expects($this->once())->method('getStore')->with($storeId)->will($this->returnValue($this->_storetMock));
     $this->assertInstanceOf('\\Magento\\User\\Model\\User', $this->_model->sendPasswordResetConfirmationEmail());
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:21,代碼來源:UserTest.php


注:本文中的Magento\Backend\App\ConfigInterface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。