getClassName(); $testName = $this->getName(); $operationString = file_get_contents(__DIR__ . "/../resources/$className/$testName.json"); $this->operation = json_decode($operationString, true); $this->response = true; if (array_key_exists('body', $this->operation['response'])) { $this->response = json_encode($this->operation['response']['body']); } Setup::SetUpForFunctionalTests($this); } /** * Returns just the classname of the test you are executing. It removes the namespaces. * @return string */ public function getClassName() { return join('', array_slice(explode('\\', get_class($this)), -1)); } public function testCreate() { $request = $this->operation['request']['body']; $obj = new Payout($request); if (Setup::$mode != 'mock') { $obj->getSenderBatchHeader()->setSenderBatchId(uniqid()); } PayoutsFunctionalTest::$batchId = $obj->getSenderBatchHeader()->getSenderBatchId(); $params = array('sync_mode' => 'true'); $result = $obj->create($params, null, $this->mockPayPalRestCall); $this->assertNotNull($result); $this->assertEquals(PayoutsFunctionalTest::$batchId, $result->getBatchHeader()->getSenderBatchHeader()->getSenderBatchId()); return $result; } /** * @depends testCreate * @param $payoutBatch PayoutBatch * @return PayoutBatch */ public function testGet($payoutBatch) { $result = Payout::get($payoutBatch->getBatchHeader()->getPayoutBatchId(), null, $this->mockPayPalRestCall); $this->assertNotNull($result); $this->assertNotNull($result->getBatchHeader()->getBatchStatus()); $this->assertEquals(PayoutsFunctionalTest::$batchId, $result->getBatchHeader()->getSenderBatchHeader()->getSenderBatchId()); return $result; } /** * @depends testCreate * @param $payoutBatch PayoutBatch * @return PayoutBatch */ public function testGetItem($payoutBatch) { $item = $payoutBatch->getItems()[0]; $result = PayoutItem::get($item->getPayoutItemId(), null, $this->mockPayPalRestCall); $this->assertNotNull($result); $this->assertEquals($item->getPayoutItemId(), $result->getPayoutItemId()); $this->assertEquals($item->getPayoutBatchId(), $result->getPayoutBatchId()); $this->assertEquals($item->getTransactionId(), $result->getTransactionId()); $this->assertEquals($item->getPayoutItemFee(), $result->getPayoutItemFee()); } }