- test refactoring

- removed laravel/cashier
This commit is contained in:
Čarodej
2021-11-06 16:07:31 +01:00
parent 1f5f0a7fbb
commit 18ff8a6dc7
6 changed files with 43 additions and 674 deletions

View File

@@ -21,7 +21,6 @@
"intervention/image": "^2.7.0",
"jaybizzle/laravel-crawler-detect": "^1.2",
"kyslik/column-sortable": "^6.4.1",
"laravel/cashier": "^12.15.0",
"laravel/fortify": "^1.8.3",
"laravel/framework": "^8.69.0",
"laravel/sanctum": "^2.12.1",

522
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "55ff7f93c928985bf9c8a81809291442",
"content-hash": "3e928c0cb691924da4de217296c323e2",
"packages": [
{
"name": "amphp/amp",
@@ -1808,78 +1808,6 @@
],
"time": "2020-05-25T17:44:05+00:00"
},
{
"name": "dompdf/dompdf",
"version": "v1.0.2",
"source": {
"type": "git",
"url": "https://github.com/dompdf/dompdf.git",
"reference": "8768448244967a46d6e67b891d30878e0e15d25c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/8768448244967a46d6e67b891d30878e0e15d25c",
"reference": "8768448244967a46d6e67b891d30878e0e15d25c",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-mbstring": "*",
"phenx/php-font-lib": "^0.5.2",
"phenx/php-svg-lib": "^0.3.3",
"php": "^7.1 || ^8.0"
},
"require-dev": {
"mockery/mockery": "^1.3",
"phpunit/phpunit": "^7.5 || ^8 || ^9",
"squizlabs/php_codesniffer": "^3.5"
},
"suggest": {
"ext-gd": "Needed to process images",
"ext-gmagick": "Improves image processing performance",
"ext-imagick": "Improves image processing performance",
"ext-zlib": "Needed for pdf stream compression"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-develop": "0.7-dev"
}
},
"autoload": {
"psr-4": {
"Dompdf\\": "src/"
},
"classmap": [
"lib/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
},
{
"name": "Brian Sweeney",
"email": "eclecticgeek@gmail.com"
},
{
"name": "Gabriel Bull",
"email": "me@gabrielbull.com"
}
],
"description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
"homepage": "https://github.com/dompdf/dompdf",
"support": {
"issues": "https://github.com/dompdf/dompdf/issues",
"source": "https://github.com/dompdf/dompdf/tree/v1.0.2"
},
"time": "2021-01-08T14:18:52+00:00"
},
{
"name": "dragonmantank/cron-expression",
"version": "v3.1.0",
@@ -3040,85 +2968,6 @@
},
"time": "2021-07-09T12:15:54+00:00"
},
{
"name": "laravel/cashier",
"version": "v12.15.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/cashier-stripe.git",
"reference": "5eddb87418469e26d5945420b77f87b5eb57609a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/cashier-stripe/zipball/5eddb87418469e26d5945420b77f87b5eb57609a",
"reference": "5eddb87418469e26d5945420b77f87b5eb57609a",
"shasum": ""
},
"require": {
"dompdf/dompdf": "^0.8.6|^1.0.1",
"ext-json": "*",
"illuminate/console": "^6.0|^7.0|^8.0",
"illuminate/contracts": "^6.0|^7.0|^8.0",
"illuminate/database": "^6.0|^7.0|^8.0",
"illuminate/http": "^6.0|^7.0|^8.0",
"illuminate/log": "^6.0|^7.0|^8.0",
"illuminate/notifications": "^6.0|^7.0|^8.0",
"illuminate/routing": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"illuminate/view": "^6.0|^7.0|^8.0",
"moneyphp/money": "^3.2",
"nesbot/carbon": "^2.0",
"php": "^7.2.5|^8.0",
"stripe/stripe-php": "^7.39",
"symfony/http-kernel": "^4.3|^5.0",
"symfony/polyfill-intl-icu": "^1.22.1"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "^4.0|^5.0|^6.0",
"phpunit/phpunit": "^8.0|^9.0"
},
"suggest": {
"ext-intl": "Allows for more locales besides the default \"en\" when formatting money values."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "12.x-dev"
},
"laravel": {
"providers": [
"Laravel\\Cashier\\CashierServiceProvider"
]
}
},
"autoload": {
"psr-4": {
"Laravel\\Cashier\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Taylor Otwell",
"email": "taylor@laravel.com"
}
],
"description": "Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.",
"keywords": [
"billing",
"laravel",
"stripe"
],
"support": {
"issues": "https://github.com/laravel/cashier/issues",
"source": "https://github.com/laravel/cashier"
},
"time": "2021-06-22T15:19:19+00:00"
},
{
"name": "laravel/fortify",
"version": "v1.8.3",
@@ -4276,92 +4125,6 @@
"relative": true
}
},
{
"name": "moneyphp/money",
"version": "v3.3.1",
"source": {
"type": "git",
"url": "https://github.com/moneyphp/money.git",
"reference": "122664c2621a95180a13c1ac81fea1d2ef20781e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/moneyphp/money/zipball/122664c2621a95180a13c1ac81fea1d2ef20781e",
"reference": "122664c2621a95180a13c1ac81fea1d2ef20781e",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": ">=5.6"
},
"require-dev": {
"cache/taggable-cache": "^0.4.0",
"doctrine/instantiator": "^1.0.5",
"ext-bcmath": "*",
"ext-gmp": "*",
"ext-intl": "*",
"florianv/exchanger": "^1.0",
"florianv/swap": "^3.0",
"friends-of-phpspec/phpspec-code-coverage": "^3.1.1 || ^4.3",
"moneyphp/iso-currencies": "^3.2.1",
"php-http/message": "^1.4",
"php-http/mock-client": "^1.0.0",
"phpspec/phpspec": "^3.4.3",
"phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.5.18 || ^8.5",
"psr/cache": "^1.0",
"symfony/phpunit-bridge": "^4"
},
"suggest": {
"ext-bcmath": "Calculate without integer limits",
"ext-gmp": "Calculate without integer limits",
"ext-intl": "Format Money objects with intl",
"florianv/exchanger": "Exchange rates library for PHP",
"florianv/swap": "Exchange rates library for PHP",
"psr/cache-implementation": "Used for Currency caching"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Money\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Mathias Verraes",
"email": "mathias@verraes.net",
"homepage": "http://verraes.net"
},
{
"name": "Márk Sági-Kazár",
"email": "mark.sagikazar@gmail.com"
},
{
"name": "Frederik Bosch",
"email": "f.bosch@genkgo.nl"
}
],
"description": "PHP implementation of Fowler's Money pattern",
"homepage": "http://moneyphp.org",
"keywords": [
"Value Object",
"money",
"vo"
],
"support": {
"issues": "https://github.com/moneyphp/money/issues",
"source": "https://github.com/moneyphp/money/tree/master"
},
"time": "2020-03-18T17:49:59+00:00"
},
{
"name": "monolog/monolog",
"version": "2.3.5",
@@ -5285,92 +5048,6 @@
},
"time": "2021-02-23T14:00:09+00:00"
},
{
"name": "phenx/php-font-lib",
"version": "0.5.2",
"source": {
"type": "git",
"url": "https://github.com/PhenX/php-font-lib.git",
"reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/ca6ad461f032145fff5971b5985e5af9e7fa88d8",
"reference": "ca6ad461f032145fff5971b5985e5af9e7fa88d8",
"shasum": ""
},
"require-dev": {
"phpunit/phpunit": "^4.8.35 || ^5 || ^6 || ^7"
},
"type": "library",
"autoload": {
"psr-4": {
"FontLib\\": "src/FontLib"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse, export and make subsets of different types of font files.",
"homepage": "https://github.com/PhenX/php-font-lib",
"support": {
"issues": "https://github.com/PhenX/php-font-lib/issues",
"source": "https://github.com/PhenX/php-font-lib/tree/0.5.2"
},
"time": "2020-03-08T15:31:32+00:00"
},
{
"name": "phenx/php-svg-lib",
"version": "0.3.4",
"source": {
"type": "git",
"url": "https://github.com/PhenX/php-svg-lib.git",
"reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/f627771eb854aa7f45f80add0f23c6c4d67ea0f2",
"reference": "f627771eb854aa7f45f80add0f23c6c4d67ea0f2",
"shasum": ""
},
"require": {
"php": "^7.4 || ^8.0",
"sabberworm/php-css-parser": "^8.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"Svg\\": "src/Svg"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-3.0"
],
"authors": [
{
"name": "Fabien Ménager",
"email": "fabien.menager@gmail.com"
}
],
"description": "A library to read, parse and export to PDF SVG files.",
"homepage": "https://github.com/PhenX/php-svg-lib",
"support": {
"issues": "https://github.com/PhenX/php-svg-lib/issues",
"source": "https://github.com/PhenX/php-svg-lib/tree/0.3.4"
},
"time": "2021-10-18T02:13:32+00:00"
},
{
"name": "php-cs-fixer/diff",
"version": "v2.0.2",
@@ -6896,55 +6573,6 @@
],
"time": "2021-09-25T23:10:38+00:00"
},
{
"name": "sabberworm/php-css-parser",
"version": "8.3.1",
"source": {
"type": "git",
"url": "https://github.com/sabberworm/PHP-CSS-Parser.git",
"reference": "d217848e1396ef962fb1997cf3e2421acba7f796"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sabberworm/PHP-CSS-Parser/zipball/d217848e1396ef962fb1997cf3e2421acba7f796",
"reference": "d217848e1396ef962fb1997cf3e2421acba7f796",
"shasum": ""
},
"require": {
"php": ">=5.3.2"
},
"require-dev": {
"codacy/coverage": "^1.4",
"phpunit/phpunit": "~4.8"
},
"type": "library",
"autoload": {
"psr-0": {
"Sabberworm\\CSS": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Raphael Schweikert"
}
],
"description": "Parser for CSS Files written in PHP",
"homepage": "http://www.sabberworm.com/blog/2010/6/10/php-css-parser",
"keywords": [
"css",
"parser",
"stylesheet"
],
"support": {
"issues": "https://github.com/sabberworm/PHP-CSS-Parser/issues",
"source": "https://github.com/sabberworm/PHP-CSS-Parser/tree/8.3.1"
},
"time": "2020-06-01T09:10:00+00:00"
},
{
"name": "sebastian/cli-parser",
"version": "1.0.1",
@@ -8584,67 +8212,6 @@
},
"time": "2021-10-06T00:40:59+00:00"
},
{
"name": "stripe/stripe-php",
"version": "v7.100.0",
"source": {
"type": "git",
"url": "https://github.com/stripe/stripe-php.git",
"reference": "3dfc3dcd5d967a14d2852f34e544188af5f9b799"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/stripe/stripe-php/zipball/3dfc3dcd5d967a14d2852f34e544188af5f9b799",
"reference": "3dfc3dcd5d967a14d2852f34e544188af5f9b799",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"php": ">=5.6.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "2.17.1",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^5.7",
"squizlabs/php_codesniffer": "^3.3",
"symfony/process": "~3.4"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"psr-4": {
"Stripe\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Stripe and contributors",
"homepage": "https://github.com/stripe/stripe-php/contributors"
}
],
"description": "Stripe PHP Library",
"homepage": "https://stripe.com/",
"keywords": [
"api",
"payment processing",
"stripe"
],
"support": {
"issues": "https://github.com/stripe/stripe-php/issues",
"source": "https://github.com/stripe/stripe-php/tree/v7.100.0"
},
"time": "2021-10-11T20:05:45+00:00"
},
{
"name": "swiftmailer/swiftmailer",
"version": "v6.3.0",
@@ -9964,93 +9531,6 @@
],
"time": "2021-05-27T12:26:48+00:00"
},
{
"name": "symfony/polyfill-intl-icu",
"version": "v1.23.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-icu.git",
"reference": "4a80a521d6176870b6445cfb469c130f9cae1dda"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/4a80a521d6176870b6445cfb469c130f9cae1dda",
"reference": "4a80a521d6176870b6445cfb469c130f9cae1dda",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"suggest": {
"ext-intl": "For best performance and support of other locales than \"en\""
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "1.23-dev"
},
"thanks": {
"name": "symfony/polyfill",
"url": "https://github.com/symfony/polyfill"
}
},
"autoload": {
"files": [
"bootstrap.php"
],
"psr-4": {
"Symfony\\Polyfill\\Intl\\Icu\\": ""
},
"classmap": [
"Resources/stubs"
],
"exclude-from-classmap": [
"/Tests/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for intl's ICU-related data and classes",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"icu",
"intl",
"polyfill",
"portable",
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-intl-icu/tree/v1.23.0"
},
"funding": [
{
"url": "https://symfony.com/sponsor",
"type": "custom"
},
{
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2021-05-24T10:04:56+00:00"
},
{
"name": "symfony/polyfill-intl-idn",
"version": "v1.23.0",

View File

@@ -1,43 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSubscriptionsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscriptions', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('user_id');
$table->string('name');
$table->string('stripe_id');
$table->string('stripe_status');
$table->string('stripe_plan')->nullable();
$table->integer('quantity')->nullable();
$table->timestamp('trial_ends_at')->nullable();
$table->timestamp('ends_at')->nullable();
$table->timestamps();
$table->index(['user_id', 'stripe_status']);
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('subscriptions');
}
}

View File

@@ -1,39 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateSubscriptionItemsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('subscription_items', function (Blueprint $table) {
$table->bigIncrements('id');
$table->unsignedBigInteger('subscription_id');
$table->string('stripe_id')->index();
$table->string('stripe_plan');
$table->integer('quantity')->nullable();
$table->timestamps();
$table->unique(['subscription_id', 'stripe_plan']);
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('subscription_items');
}
}

View File

@@ -43,7 +43,6 @@ class User extends Authenticatable implements MustVerifyEmail
use HasApiTokens;
use Notifiable;
use HasFactory;
use Billable;
use Sortable;
protected $guarded = [

View File

@@ -20,10 +20,8 @@ class TeamManagementTest extends TestCase
*/
public function it_get_team_folder_invite()
{
$inviter = User::factory()
->create();
$member = User::factory()
[$inviter, $member] = User::factory()
->count(2)
->create();
$invitation = TeamFolderInvitation::factory()
@@ -135,11 +133,8 @@ class TeamManagementTest extends TestCase
*/
public function it_invite_member_into_team_folder()
{
$user = User::factory()
->create();
$members = User::factory()
->count(2)
[$user, $member_1, $member_2] = User::factory()
->count(3)
->create();
$folder = Folder::factory()
@@ -160,12 +155,12 @@ class TeamManagementTest extends TestCase
->insert([
[
'parent_id' => $folder->id,
'user_id' => $members[0]->id,
'user_id' => $member_1->id,
'permission' => 'can-edit',
],
[
'parent_id' => $folder->id,
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-edit',
],
]);
@@ -175,11 +170,11 @@ class TeamManagementTest extends TestCase
->patchJson("/api/teams/folders/{$folder->id}", [
'members' => [
[
'id' => $members[0]->id,
'id' => $member_1->id,
'permission' => 'can-edit',
],
[
'id' => $members[1]->id,
'id' => $member_2->id,
'permission' => 'can-edit',
],
],
@@ -214,11 +209,8 @@ class TeamManagementTest extends TestCase
*/
public function it_delete_invited_member_from_team_folder()
{
$user = User::factory()
->create();
$members = User::factory()
->count(2)
[$user, $member_1, $member_2] = User::factory()
->count(3)
->create();
$folder = Folder::factory()
@@ -247,12 +239,12 @@ class TeamManagementTest extends TestCase
->insert([
[
'parent_id' => $folder->id,
'user_id' => $members[0]->id,
'user_id' => $member_1->id,
'permission' => 'can-edit',
],
[
'parent_id' => $folder->id,
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-edit',
],
]);
@@ -262,11 +254,11 @@ class TeamManagementTest extends TestCase
->patchJson("/api/teams/folders/{$folder->id}", [
'members' => [
[
'id' => $members[0]->id,
'id' => $member_1->id,
'permission' => 'can-edit',
],
[
'id' => $members[1]->id,
'id' => $member_2->id,
'permission' => 'can-view',
],
],
@@ -293,13 +285,8 @@ class TeamManagementTest extends TestCase
*/
public function it_remove_member_from_team_folder()
{
$user = User::factory()
->create();
$member = User::factory()
->create();
$deletedMember = User::factory()
[$user, $member, $deletedMember] = User::factory()
->count(3)
->create();
$folder = Folder::factory()
@@ -417,11 +404,8 @@ class TeamManagementTest extends TestCase
*/
public function it_update_member_permission_in_team_folder()
{
$user = User::factory()
->create();
$members = User::factory()
->count(2)
[$user, $member_1, $member_2] = User::factory()
->count(3)
->create();
$folder = Folder::factory()
@@ -434,12 +418,12 @@ class TeamManagementTest extends TestCase
->insert([
[
'parent_id' => $folder->id,
'user_id' => $members[0]->id,
'user_id' => $member_1->id,
'permission' => 'can-edit',
],
[
'parent_id' => $folder->id,
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-edit',
],
]);
@@ -449,11 +433,11 @@ class TeamManagementTest extends TestCase
->patchJson("/api/teams/folders/{$folder->id}", [
'members' => [
[
'id' => $members[0]->id,
'id' => $member_1->id,
'permission' => 'can-edit',
],
[
'id' => $members[1]->id,
'id' => $member_2->id,
'permission' => 'can-view',
],
],
@@ -462,7 +446,7 @@ class TeamManagementTest extends TestCase
->assertCreated();
$this->assertDatabaseHas('team_folder_members', [
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-view',
]);
}
@@ -472,11 +456,8 @@ class TeamManagementTest extends TestCase
*/
public function member_try_update_permission_in_team_folder()
{
$user = User::factory()
->create();
$members = User::factory()
->count(2)
[$user, $member_1, $member_2] = User::factory()
->count(3)
->create();
$folder = Folder::factory()
@@ -489,28 +470,28 @@ class TeamManagementTest extends TestCase
->insert([
[
'parent_id' => $folder->id,
'user_id' => $members[0]->id,
'user_id' => $member_1->id,
'permission' => 'can-edit',
],
[
'parent_id' => $folder->id,
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-edit',
],
]);
$this
->actingAs(
User::find($members[0]->id)
User::find($member_1->id)
)
->patchJson("/api/teams/folders/{$folder->id}", [
'members' => [
[
'id' => $members[0]->id,
'id' => $member_1->id,
'permission' => 'can-edit',
],
[
'id' => $members[1]->id,
'id' => $member_2->id,
'permission' => 'can-view',
],
],
@@ -519,7 +500,7 @@ class TeamManagementTest extends TestCase
->assertForbidden();
$this->assertDatabaseHas('team_folder_members', [
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-edit',
]);
}
@@ -529,11 +510,8 @@ class TeamManagementTest extends TestCase
*/
public function it_dissolve_team_folder()
{
$user = User::factory()
->create();
$members = User::factory()
->count(2)
[$user, $member_1, $member_2] = User::factory()
->count(3)
->create();
$folder = Folder::factory()
@@ -560,12 +538,12 @@ class TeamManagementTest extends TestCase
->insert([
[
'parent_id' => $folder->id,
'user_id' => $members[0]->id,
'user_id' => $member_1->id,
'permission' => 'can-edit',
],
[
'parent_id' => $folder->id,
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-edit',
],
]);
@@ -593,10 +571,8 @@ class TeamManagementTest extends TestCase
*/
public function it_leave_team_folder()
{
$user = User::factory()
->create();
$member = User::factory()
[$user, $member] = User::factory()
->count(2)
->create();
$folder = Folder::factory()
@@ -703,11 +679,8 @@ class TeamManagementTest extends TestCase
*/
public function member_try_dissolve_team_folder()
{
$user = User::factory()
->create();
$members = User::factory()
->count(2)
[$user, $member_1, $member_2] = User::factory()
->count(3)
->create();
$folder = Folder::factory()
@@ -727,19 +700,19 @@ class TeamManagementTest extends TestCase
->insert([
[
'parent_id' => $folder->id,
'user_id' => $members[0]->id,
'user_id' => $member_1->id,
'permission' => 'can-edit',
],
[
'parent_id' => $folder->id,
'user_id' => $members[1]->id,
'user_id' => $member_2->id,
'permission' => 'can-edit',
],
]);
$this
->actingAs(
User::find($members[0]->id)
User::find($member_1->id)
)
->deleteJson("/api/teams/folders/{$folder->id}")
->assertForbidden();