Esempio n. 1
0
 /**
  * Constructor
  *
  * @param array $aConfig
  * @throws WirecardCEE_QMore_Exception_InvalidArgumentException
  */
 public function __construct(array $aConfig = null)
 {
     $this->_fingerprintOrder = new WirecardCEE_Stdlib_FingerprintOrder();
     //if no config was sent fallback to default config file
     if (is_null($aConfig)) {
         $aConfig = WirecardCEE_QMore_Module::getConfig();
     }
     if (isset($aConfig['WirecardCEEQMoreConfig'])) {
         //we only need the WirecardCEEQMoreConfig here
         $aConfig = $aConfig['WirecardCEEQMoreConfig'];
     }
     //let's store configuration details in internal objects
     $this->oUserConfig = new WirecardCEE_Stdlib_Config($aConfig);
     $this->oClientConfig = new WirecardCEE_Stdlib_Config(WirecardCEE_QMore_Module::getClientConfig());
     //now let's check if the CUSTOMER_ID, SHOP_ID, LANGUAGE and SECRET exist in $this->oUserConfig object that we created from config array
     $sCustomerId = isset($this->oUserConfig->CUSTOMER_ID) ? trim($this->oUserConfig->CUSTOMER_ID) : null;
     $sShopId = isset($this->oUserConfig->SHOP_ID) ? trim($this->oUserConfig->SHOP_ID) : null;
     $sLanguage = isset($this->oUserConfig->LANGUAGE) ? trim($this->oUserConfig->LANGUAGE) : null;
     $sSecret = isset($this->oUserConfig->SECRET) ? trim($this->oUserConfig->SECRET) : null;
     //If not throw the InvalidArgumentException exception!
     if (empty($sCustomerId) || is_null($sCustomerId)) {
         throw new WirecardCEE_QMore_DataStorage_Exception_InvalidArgumentException(sprintf('CUSTOMER_ID passed to %s is invalid.', __METHOD__));
     }
     if (empty($sLanguage) || is_null($sLanguage)) {
         throw new WirecardCEE_QMore_DataStorage_Exception_InvalidArgumentException(sprintf('LANGUAGE passed to %s is invalid.', __METHOD__));
     }
     if (empty($sSecret) || is_null($sSecret)) {
         throw new WirecardCEE_QMore_DataStorage_Exception_InvalidArgumentException(sprintf('SECRET passed to %s is invalid.', __METHOD__));
     }
     //everything ok! let's set the fields
     $this->_setField(self::CUSTOMER_ID, $sCustomerId);
     $this->_setField(self::SHOP_ID, $sShopId);
     $this->_setField(self::LANGUAGE, $sLanguage);
     $this->_setSecret($sSecret);
 }
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new WirecardCEE_QMore_DataStorageClient();
     $this->aUserConfig = WirecardCEE_QMore_Module::getConfig();
     $this->aClientConfig = WirecardCEE_QMore_Module::getClientConfig();
 }
 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->object = new WirecardCEE_QMore_FrontendClient();
     $this->aUserConfig = WirecardCEE_QMore_Module::getConfig();
     $this->aClientConfig = WirecardCEE_QMore_Module::getClientConfig();
     $this->aExpectedRequestData = array(WirecardCEE_QMore_FrontendClient::CUSTOMER_ID => $this->aUserConfig['WirecardCEEQMoreConfig']['CUSTOMER_ID'], WirecardCEE_QMore_FrontendClient::SHOP_ID => $this->aUserConfig['WirecardCEEQMoreConfig']['SHOP_ID'], WirecardCEE_QMore_FrontendClient::LANGUAGE => $this->aUserConfig['WirecardCEEQMoreConfig']['LANGUAGE']);
 }
 public function testUserConfig()
 {
     $aConfig = WirecardCEE_QMore_Module::getConfig();
     $this->assertInternalType('array', $aConfig);
     $this->assertArrayHasKey('WirecardCEEQMoreConfig', $aConfig);
     $this->assertArrayHasKey('CUSTOMER_ID', $aConfig['WirecardCEEQMoreConfig']);
     $this->assertArrayHasKey('SHOP_ID', $aConfig['WirecardCEEQMoreConfig']);
     $this->assertArrayHasKey('LANGUAGE', $aConfig['WirecardCEEQMoreConfig']);
     $this->assertArrayHasKey('SECRET', $aConfig['WirecardCEEQMoreConfig']);
 }
 public function setUp()
 {
     $this->object = new WirecardCEE_QMore_BackendClient();
     $this->aUserConfig = WirecardCEE_QMore_Module::getConfig();
     $this->aClientConfig = WirecardCEE_QMore_Module::getClientConfig();
 }