public function testFailureGetErrors() { $this->_200ErrorResponse(); $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $this->object->getErrors()); foreach ($this->object->getErrors() as $error) { $this->assertInstanceOf('WirecardCEE_Stdlib_Error', $error); } $this->assertEquals($this->object->getNumberOfErrors(), count($this->object->getErrors())); }
/** * * @throws WirecardCEE_QMore_Exception_InvalidArgumentException */ public function read() { $aMissingFields = new ArrayObject(); if (!$this->_isFieldSet(self::CUSTOMER_ID)) { $aMissingFields->append(self::CUSTOMER_ID); } // check if storageId has been set from outside. If not fallback to // response and see if response can give us storageId if (!$this->_isFieldSet(self::STORAGE_ID)) { if (!$this->oInitResponse instanceof WirecardCEE_QMore_DataStorage_Response_Initiation) { throw new WirecardCEE_QMore_Exception_BadMethodCallException(sprintf("StorageId hasn't been found. Use 'initiate()' or 'setStorageId()'! Thrown in %s", __METHOD__)); } $sStorageId = $this->oInitResponse->getStorageId(); if (empty($sStorageId) || is_null($sStorageId)) { $aMissingFields->append(self::STORAGE_ID); } else { $this->setStorageId($sStorageId); } } //Are there any errors in the $aMissingFields object? //If so throw the InvalidArgumentException and print all the fields that are missing! if ($aMissingFields->count()) { throw new WirecardCEE_QMore_Exception_InvalidArgumentException(sprintf("Could not initiate DataStorage Read! Missing mandatory field(s): %s; thrown in %s", implode(", ", (array) $aMissingFields), __METHOD__)); } $_dataStorageRead = new WirecardCEE_QMore_DataStorage_Request_Read($this->oUserConfig->toArray()); $this->oDataStorageReadResponse = $_dataStorageRead->read($this->_requestData[self::STORAGE_ID]); return $this->oDataStorageReadResponse; }