namespaces refactoring

This commit is contained in:
Peter Papp
2021-07-18 17:21:37 +02:00
parent a1778eab52
commit 8f77a497b5
162 changed files with 1242 additions and 1418 deletions

View File

@@ -1,11 +1,9 @@
<?php
namespace Tests\Domain\Subscriptions;
use Domain\Settings\Models\User;
use Illuminate\Support\Str;
use Laravel\Sanctum\Sanctum;
use Tests\TestCase;
use Laravel\Sanctum\Sanctum;
use Domain\Settings\Models\User;
class SubscriptionTest extends TestCase
{
@@ -30,15 +28,15 @@ class SubscriptionTest extends TestCase
// Define test plan to subscribe
$this->plan = [
'data' => [
'id' => "business-pack",
'type' => "plans",
'id' => 'business-pack',
'type' => 'plans',
'attributes' => [
'name' => "Business Packs",
'description' => "When your business start grow up.",
'price' => "$44.99",
'name' => 'Business Packs',
'description' => 'When your business start grow up.',
'price' => '$44.99',
'capacity' => 1000,
'capacity_formatted' => "1TB",
'currency' => "USD",
'capacity_formatted' => '1TB',
'currency' => 'USD',
'tax_rates' => [],
],
],
@@ -69,7 +67,7 @@ class SubscriptionTest extends TestCase
->getJson('/api/user/subscription/setup-intent')
->assertStatus(201)
->assertJsonFragment([
"object" => "setup_intent"
'object' => 'setup_intent',
]);
$this->assertDatabaseMissing('users', [
@@ -88,19 +86,19 @@ class SubscriptionTest extends TestCase
$this
->actingAs($user)
->postJson('/api/user/subscription/upgrade', [
'billing' => $this->billing,
'plan' => $this->plan,
'payment' => [
'type' => 'stripe',
],
])->assertStatus(204);
'billing' => $this->billing,
'plan' => $this->plan,
'payment' => [
'type' => 'stripe',
],
])->assertStatus(204);
$this->assertDatabaseHas('subscriptions', [
'stripe_status' => 'active'
'stripe_status' => 'active',
]);
$this->assertDatabaseHas('user_settings', [
'storage_capacity' => 1000
'storage_capacity' => 1000,
]);
}
@@ -126,7 +124,7 @@ class SubscriptionTest extends TestCase
->assertStatus(204);
$this->assertDatabaseMissing('subscriptions', [
'ends_at' => null
'ends_at' => null,
]);
}
@@ -155,7 +153,7 @@ class SubscriptionTest extends TestCase
->assertStatus(204);
$this->assertDatabaseHas('subscriptions', [
'ends_at' => null
'ends_at' => null,
]);
}
@@ -180,22 +178,22 @@ class SubscriptionTest extends TestCase
$this->getJson('/api/user/subscription')
->assertStatus(200)
->assertExactJson([
"data" => [
"id" => "business-pack",
"type" => "subscription",
"attributes" => [
"incomplete" => false,
"active" => true,
"canceled" => false,
"name" => "Business Packs",
"capacity" => 1000,
"capacity_formatted" => "1TB",
"slug" => "business-pack",
"canceled_at" => format_date(now(), '%d. %B. %Y'),
"created_at" => format_date(now(), '%d. %B. %Y'),
"ends_at" => format_date(now()->addMonth(), '%d. %B. %Y'),
]
]
'data' => [
'id' => 'business-pack',
'type' => 'subscription',
'attributes' => [
'incomplete' => false,
'active' => true,
'canceled' => false,
'name' => 'Business Packs',
'capacity' => 1000,
'capacity_formatted' => '1TB',
'slug' => 'business-pack',
'canceled_at' => format_date(now(), '%d. %B. %Y'),
'created_at' => format_date(now(), '%d. %B. %Y'),
'ends_at' => format_date(now()->addMonth(), '%d. %B. %Y'),
],
],
]);
}
}