public function setUp()
 {
     $this->connector = \Ezypay\Ezypay::driver('Curl', array('base_url' => BASE_URL, 'apiKey' => API_KEY));
     $validation = new \Ezypay\Validation\Validation();
     //$this->resource = \Ezypay\Ezypay::resource('Subscription', $this->connector,$validation);
     $this->resultProducer = new \Ezypay\Result\ResultProducer($this->connector, $validation, 'Customer');
 }
 /**
  * @dataProvider dataProvider
  */
 public function testFindByIDSettings($resurceType, $findById)
 {
     if (empty($findById) || empty($findById['ID'])) {
         $this->markTestSkipped('Skipped test for ' . $resurceType . ' . findAll data is not setted.');
     }
     $resource = \Ezypay\Ezypay::resource($resurceType, $this->connector, $this->validation);
     $resource->findById($findById['ID']);
     $this->assertAttributeEquals(BASE_URL, 'base_url', $this->connector, 'Failed. Base url not correct' . $resurceType);
     $this->assertAttributeEquals($findById['method'], 'method', $this->connector, 'Failed. Method is not correct' . $resurceType);
     $this->assertAttributeEquals($findById['url'] . '/' . $findById['ID'], 'url', $this->connector, 'Failed. Url is not correct' . $resurceType);
 }
 /**
  * Test Customer's findAll method with parameters
  *
  * @dataProvider dataProviderWithParameters
  */
 public function testFindAllSettingsWithParms($resurceType, $findAllData)
 {
     if (empty($findAllData) || empty($findAllData['data'])) {
         $this->markTestSkipped('Skipped test for ' . $resurceType . ' . findAll data is not setted.');
     }
     $resource = \Ezypay\Ezypay::resource($resurceType, $this->connector, $this->validation);
     $resource->findAll($findAllData['data']);
     $this->assertAttributeEquals(BASE_URL, 'base_url', $this->connector, 'Failed. Base url not correct' . $resurceType);
     $this->assertAttributeEquals($findAllData['method'], 'method', $this->connector, 'Failed. Method is not correct' . $resurceType);
     $this->assertAttributeEquals($findAllData['url'] . '?' . http_build_query($findAllData['data']), 'url', $this->connector, 'Failed. Url is not correct' . $resurceType);
 }
 /**
  * Test create method
  *
  * @dataProvider dataProvider
  */
 public function testCreate($resourceType, $createData)
 {
     if (empty($createData) || empty($createData['data'])) {
         $this->markTestSkipped('Skipped test for ' . $resourceType . '- not setted create data');
     }
     /**
      * @var  $resource resourceInterfaceCreate
      */
     $resource = \Ezypay\Ezypay::resource($resourceType, $this->connector, $this->validation);
     $resource->create($createData['data']);
     $this->assertAttributeEquals(BASE_URL, 'base_url', $this->connector, 'Failed. Base url not correct' . $resourceType);
     $this->assertAttributeEquals($createData['method'], 'method', $this->connector, 'Failed. Method is not correct' . $resourceType);
     $this->assertAttributeEquals($createData['url'], 'url', $this->connector, 'Failed. Url is not correct' . $resourceType);
     $this->assertAttributeEquals($createData['data'], 'data', $this->connector, 'Failed. Data is not same', 0.0, 10, true);
 }
 /**
  * Test delete() method of InvoiceItem resource
  */
 public function testDelete()
 {
     $id = '0215a60f-6d6b-4f21-9af8-15d76e815fe5';
     /**
      * @var $connector DriverInterface
      */
     $connector = \Ezypay\Ezypay::driver('Curl', array('base_url' => BASE_URL, 'apiKey' => API_KEY));
     $validation = new \Ezypay\Validation\Validation();
     /**
      * @var $resource \Ezypay\Resource\InvoiceItem
      */
     $resource = \Ezypay\Ezypay::resource('InvoiceItem', $connector, $validation);
     $resource->delete($id);
     $this->assertAttributeEquals(BASE_URL, 'base_url', $connector, 'Failed. Base url not correct');
     $this->assertAttributeEquals('DELETE', 'method', $connector, 'Failed. Method is not correct');
     $this->assertAttributeEquals('invoiceitems/' . $id, 'url', $connector, 'Failed. Url is not correct');
 }
 /**
  * Test Customer findByReferenceId method
  */
 public function testFindByReferenceID()
 {
     /**
      * @var $connector DriverInterface
      */
     $connector = \Ezypay\Ezypay::driver('Curl', array('base_url' => BASE_URL, 'apiKey' => API_KEY));
     $validation = new Ezypay\Validation\Validation();
     $id = 123456;
     /**
      * @var $resource resourceInterfaceCustomer
      */
     $resource = \Ezypay\Ezypay::resource('Customer', $connector, $validation);
     $resource->findByReferenceId($id);
     $this->assertAttributeEquals(BASE_URL, 'base_url', $connector, 'Failed. Base url not correct');
     $this->assertAttributeEquals('GET', 'method', $connector, 'Failed. Method is not correct');
     $this->assertAttributeEquals('customers/reference/' . $id, 'url', $connector, 'Failed. Url is not correct');
 }
 /**
  * Test update method
  *
  * @dataProvider dataProvider
  * @param $resourceType
  * @param $updateData
  */
 public function testUpdate($resourceType, $updateData)
 {
     if (empty($updateData) || empty($updateData['ID']) || empty($updateData['data'])) {
         $this->markTestSkipped('Skipped test for ' . $resourceType . ' - not setted data');
     }
     /**
      * @var $resource resourceInterfaceUpdate
      */
     $resource = \Ezypay\Ezypay::resource($resourceType, $this->connector, $this->validation);
     $resource->update($updateData['ID'], $updateData['data']);
     $this->assertAttributeEquals(BASE_URL, 'base_url', $this->connector, 'Failed. Base url not correct' . $resourceType);
     $this->assertAttributeEquals($updateData['method'], 'method', $this->connector, 'Failed. Method is not correct' . $resourceType);
     if ($resourceType !== 'Subscription') {
         $this->assertAttributeEquals($updateData['url'] . '/' . $updateData['ID'], 'url', $this->connector, 'Failed. Url is not correct' . $resourceType);
         $this->assertAttributeEquals($updateData['data'], 'data', $this->connector, 'Failed. Data is not same', 0.0, 10, true);
     } else {
         $this->assertAttributeEquals($updateData['url'] . '/' . $updateData['ID'] . '/paymentmethod/' . $updateData['data']['paymentmethodId'], 'url', $this->connector, 'Failed. Url is not correct' . $resourceType);
     }
     $this->assertTrue(true);
 }
 /**
  * @return DriverInterface
  */
 public function setUp()
 {
     $this->connector = \Ezypay\Ezypay::driver('Curl', array('base_url' => BASE_URL, 'apiKey' => API_KEY));
     $validation = new \Ezypay\Validation\Validation();
     $this->resource = \Ezypay\Ezypay::resource('Plan', $this->connector, $validation);
 }
 /**
  * Test default resourceType property
  *
  * @dataProvider dataProvider
  */
 public function testDefaultResourceType($resurceType)
 {
     $resource = \Ezypay\Ezypay::resource($resurceType, $this->connector, $this->validation);
     $this->assertAttributeEquals($resurceType, 'resourceType', $resource, 'Failed. Default resource type isn\'t correct ' . $resurceType);
 }
Example #10
0
 /**
  * Test instace
  */
 public function testCreateDriver()
 {
     $connector = \Ezypay\Ezypay::driver("Curl", array('base_url' => BASE_URL, 'apiKey' => API_KEY));
     $this->assertInstanceOf('\\Ezypay\\Driver\\Curl', $connector);
 }