makeTestData(); $this->withoutMiddleware( ThrottleRequests::class ); if (config('ninja.testvars.travis') !== false) { $this->markTestSkipped('Skip test for Travis'); } } public function testPreviewRoute() { $data = $this->getData(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/preview/', $data); $response->assertStatus(200); } public function testPurchaseOrderPreviewRoute() { $data = $this->getData(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/preview/purchase_order', $data); $response->assertStatus(200); } public function testPurchaseOrderPreviewHtmlResponse() { $data = $this->getData(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/preview/purchase_order?html=true', $data); $response->assertStatus(200); } public function testPreviewHtmlResponse() { $data = $this->getData(); $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token, ])->post('/api/v1/preview?html=true', $data); $response->assertStatus(200); } private function getData() { $data = [ 'entity_type' => 'invoice', 'entity_id' => '', 'design' => [ 'name' => '', 'design' => [ 'includes' => '', 'header' => '', 'body' => '
', 'product' => '', 'task' => '', 'footer' => '', ], ], 'is_custom' => 1, ]; return $data; } }