Added dashboard data to API tests

This commit is contained in:
Hillel Coren 2016-11-06 14:00:37 +02:00
parent 31d5e28b69
commit 0a20460242

View File

@ -39,13 +39,13 @@ class APICest
$data->contact = new stdClass; $data->contact = new stdClass;
$data->contact->email = $this->faker->safeEmail; $data->contact->email = $this->faker->safeEmail;
$clientId = $this->createEntity('client', $data); $clientId = $this->createEntity('client', $data);
$this->listEntities('client'); $this->listEntities('clients');
$data = new stdClass; $data = new stdClass;
$data->client_id = $clientId; $data->client_id = $clientId;
$data->description = $this->faker->realText(100); $data->description = $this->faker->realText(100);
$this->createEntity('task', $data); $this->createEntity('task', $data);
$this->listEntities('task'); $this->listEntities('tasks');
$lineItem = new stdClass; $lineItem = new stdClass;
$lineItem->qty = $this->faker->numberBetween(1, 10); $lineItem->qty = $this->faker->numberBetween(1, 10);
@ -56,33 +56,35 @@ class APICest
$lineItem $lineItem
]; ];
$invoiceId = $this->createEntity('invoice', $data); $invoiceId = $this->createEntity('invoice', $data);
$this->listEntities('invoice'); $this->listEntities('invoices');
$data = new stdClass; $data = new stdClass;
$data->invoice_id = $invoiceId; $data->invoice_id = $invoiceId;
$data->amount = 1; $data->amount = 1;
$this->createEntity('payment', $data); $this->createEntity('payment', $data);
$this->listEntities('payment'); $this->listEntities('payments');
$data = new stdClass; $data = new stdClass;
$data->name = $this->faker->word; $data->name = $this->faker->word;
$data->rate = $this->faker->numberBetween(1, 10); $data->rate = $this->faker->numberBetween(1, 10);
$this->createEntity('tax_rate', $data); $this->createEntity('tax_rate', $data);
$this->listEntities('tax_rate'); $this->listEntities('tax_rates');
$data = new stdClass; $data = new stdClass;
$data->product_key = $this->faker->word; $data->product_key = $this->faker->word;
$data->notes = $this->faker->realText(100); $data->notes = $this->faker->realText(100);
$this->createEntity('product', $data); $this->createEntity('product', $data);
$this->listEntities('product'); $this->listEntities('products');
$data = new stdClass; $data = new stdClass;
$data->name = $this->faker->word; $data->name = $this->faker->word;
$data->vendor_contacts = []; $data->vendor_contacts = [];
$this->createEntity('vendor', $data); $this->createEntity('vendor', $data);
$this->listEntities('vendor'); $this->listEntities('vendors');
$this->listEntities('accounts');
$this->listEntities('dashboard');
$this->listEntities('account');
} }
private function createEntity($entityType, $data) private function createEntity($entityType, $data)
@ -99,8 +101,8 @@ class APICest
private function listEntities($entityType) private function listEntities($entityType)
{ {
Debug::debug("List {$entityType}s"); Debug::debug("List {$entityType}");
$response = $this->sendRequest("{$entityType}s", null, 'GET'); $response = $this->sendRequest("{$entityType}", null, 'GET');
PHPUnit_Framework_Assert::assertGreaterThan(0, count($response->data)); PHPUnit_Framework_Assert::assertGreaterThan(0, count($response->data));