mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 04:04:34 -04:00
Fixes for tests
This commit is contained in:
parent
e80c296d29
commit
7a8fb8f486
@ -27,6 +27,7 @@ class SubscriptionFactory extends Factory
|
|||||||
return [
|
return [
|
||||||
'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY,
|
'frequency_id' => RecurringInvoice::FREQUENCY_MONTHLY,
|
||||||
'name' => $this->faker->company(),
|
'name' => $this->faker->company(),
|
||||||
|
'steps' => "cart,auth.login-or-register",
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -221,7 +221,7 @@ class SubscriptionApiTest extends TestCase
|
|||||||
|
|
||||||
$this->assertFalse($i);
|
$this->assertFalse($i);
|
||||||
|
|
||||||
$count = Invoice::whereNotNull('subscription_id')->count();
|
$count = Invoice::whereNotNull('subscription_id')->whereIn('company_id', [$c2->id, $c->id])->count();
|
||||||
|
|
||||||
$this->assertEquals(2, $count);
|
$this->assertEquals(2, $count);
|
||||||
|
|
||||||
@ -415,11 +415,12 @@ class SubscriptionApiTest extends TestCase
|
|||||||
'company_id' => $this->company->id,
|
'company_id' => $this->company->id,
|
||||||
'user_id' => $this->user->id,
|
'user_id' => $this->user->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
$response = $this->withHeaders([
|
$response = $this->withHeaders([
|
||||||
'X-API-SECRET' => config('ninja.api_secret'),
|
'X-API-SECRET' => config('ninja.api_secret'),
|
||||||
'X-API-TOKEN' => $this->token,
|
'X-API-TOKEN' => $this->token,
|
||||||
])->post('/api/v1/subscriptions', ['product_ids' => $product->hashed_id, 'allow_cancellation' => true, 'name' => Str::random(5)]);
|
])->post('/api/v1/subscriptions', ['steps' => "cart,auth.login-or-register",'product_ids' => $product->hashed_id, 'allow_cancellation' => true, 'name' => Str::random(5)]);
|
||||||
|
|
||||||
// nlog($response);
|
// nlog($response);
|
||||||
$response->assertStatus(200);
|
$response->assertStatus(200);
|
||||||
@ -434,14 +435,14 @@ class SubscriptionApiTest extends TestCase
|
|||||||
|
|
||||||
$response1 = $this
|
$response1 = $this
|
||||||
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token])
|
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token])
|
||||||
->post('/api/v1/subscriptions', ['product_ids' => $product->hashed_id, 'name' => Str::random(5)])
|
->post('/api/v1/subscriptions', ['steps' => "cart,auth.login-or-register",'product_ids' => $product->hashed_id, 'name' => Str::random(5)])
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->json();
|
->json();
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
$response2 = $this
|
$response2 = $this
|
||||||
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token])
|
->withHeaders(['X-API-SECRET' => config('ninja.api_secret'), 'X-API-TOKEN' => $this->token])
|
||||||
->put('/api/v1/subscriptions/'.$response1['data']['id'], ['allow_cancellation' => true])
|
->put('/api/v1/subscriptions/'.$response1['data']['id'], ['steps' => "cart,auth.login-or-register",'allow_cancellation' => true])
|
||||||
->assertStatus(200)
|
->assertStatus(200)
|
||||||
->json();
|
->json();
|
||||||
// }catch(ValidationException $e) {
|
// }catch(ValidationException $e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user