Example #1
0
 /**
  * Checks required items
  * Checks variables type
  * Checks if store type exist in code list
  *
  * @param $store
  *
  * @throws InvalidStoreTypeException
  * @throws MissingRequiredDataException
  */
 private function validateStore($store)
 {
     if (!$this->checkRequiredItems($this->requiredStoreItems, $store)) {
         throw new MissingRequiredDataException('Store must contain all required data');
     }
     $this->checkVariableType($store[PaymentDeliveryService::STORE_TYPE], self::TYPE_INTEGER);
     $this->checkVariableType($store[PaymentDeliveryService::STORE_ID], self::TYPE_INTEGER);
     if (!$this->storeTypeCodes->isValid($store[PaymentDeliveryService::STORE_TYPE])) {
         throw new InvalidStoreTypeException('Cannot found type from store in code list');
     }
 }
Example #2
0
 /**
  * @dataProvider existCodeProvider
  *
  * @param $code
  * @param $expected
  */
 public function testExistCode($code, $expected)
 {
     $storeTypeCodes = new StoreType();
     $this->assertSame($expected, $storeTypeCodes->isValid($code));
 }