Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-34 - update PHPStan for user factories. Updated user seeder handling. #35

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ composer cloc
```

```
➜ playground-test git:(develop) ✗ composer cloc
➜ playground-test git:(feature/GH-34) composer cloc
> cloc --exclude-dir=output,vendor .
151 text files.
88 unique files.
64 files ignored.
158 text files.
93 unique files.
66 files ignored.

github.com/AlDanial/cloc v 1.98 T=0.11 s (795.4 files/s, 87907.6 lines/s)
github.com/AlDanial/cloc v 1.98 T=0.15 s (615.0 files/s, 67029.5 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
PHP 79 1703 2037 5209
PHP 84 1767 2117 5473
XML 4 0 15 294
YAML 1 5 0 275
Markdown 3 35 0 88
JSON 1 0 0 65
JSON 1 0 0 67
-------------------------------------------------------------------------------
SUM: 88 1743 2052 5931
SUM: 93 1807 2132 6197
-------------------------------------------------------------------------------
```

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"playground",
"test"
],
"homepage": "https://gammamatrix-playground.readthedocs.io/",
"homepage": "https://github.com/gammamatrix/playground-test",
"license": "MIT",
"authors": [
{
Expand Down
70 changes: 69 additions & 1 deletion config/playground-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,62 @@
declare(strict_types=1);

return [
'password' => env('PLAYGROUND_TEST_PASSWORD', 'password'),

/*
|--------------------------------------------------------------------------
| Credentials for testing
|--------------------------------------------------------------------------
|
| If the password is empty, a random value will be set.
|
| For extra security, a password hash may be set in
| PLAYGROUND_TEST_PASSWORD; and then PLAYGROUND_TEST_PASSWORD_ENCRYPTED must
| be set to true.
|
*/

'password' => env('PLAYGROUND_TEST_PASSWORD', ''),

'password_encrypted' => (bool) env('PLAYGROUND_TEST_PASSWORD_ENCRYPTED', false),

/*
|--------------------------------------------------------------------------
| Roles and Privileges
|--------------------------------------------------------------------------
|
| with_role: users.role string
| with_roles: users.roles role[]
| with_privileges: users.privileges privilege[]
|
| All privileges: ['*']
|
*/

'with_active' => (bool) env('PLAYGROUND_TEST_WITH_ACTIVE', true),

'with_description' => (bool) env('PLAYGROUND_TEST_WITH_DESCRIPTION', true),

'with_privileges' => (bool) env('PLAYGROUND_TEST_WITH_PRIVILEGES', true),

'with_role' => (bool) env('PLAYGROUND_TEST_WITH_ROLE', true),

'with_roles' => (bool) env('PLAYGROUND_TEST_WITH_ROLES', true),

'with_status' => (bool) env('PLAYGROUND_TEST_WITH_STATUS', true),

/*
|--------------------------------------------------------------------------
| Users
|--------------------------------------------------------------------------
|
|
*/

'users' => [
'admin' => [
'env' => 'TEST_EMAIL_ADMIN',
'name' => 'Admin Nimda',
'privileges' => [],
'role' => 'admin',
'roles' => [
'user',
Expand All @@ -21,6 +71,7 @@
'client' => [
'env' => 'TEST_EMAIL_CLIENT',
'name' => 'Client Tneilc',
'privileges' => [],
'role' => 'client',
'roles' => [],
'description' => 'User: client',
Expand All @@ -29,6 +80,7 @@
'client-admin' => [
'env' => 'TEST_EMAIL_CLIENT_ADMIN',
'name' => 'Client Admin Nimda Tneilc',
'privileges' => [],
'role' => 'client',
'roles' => [
'client-admin',
Expand All @@ -39,6 +91,7 @@
'partner' => [
'env' => 'TEST_EMAIL_PARTNER',
'name' => 'Partner Rentrap',
'privileges' => [],
'role' => 'partner',
'roles' => [],
'description' => 'User: partner',
Expand All @@ -47,6 +100,7 @@
'partner-admin' => [
'env' => 'TEST_EMAIL_PARTNER_ADMIN',
'name' => 'Partner Admin Nimd Rentrap',
'privileges' => [],
'role' => 'partner',
'roles' => [
'partner-admin',
Expand All @@ -57,6 +111,7 @@
'sales' => [
'env' => 'TEST_EMAIL_SALES',
'name' => 'Sales Selas',
'privileges' => [],
'role' => 'sales',
'roles' => [
'user',
Expand All @@ -68,6 +123,7 @@
'env' => 'TEST_EMAIL_SALES_ADMIN',
'role' => 'sales',
'name' => 'Sales Admin Nimda Troppus',
'privileges' => [],
'roles' => [
'user',
'sales-admin',
Expand All @@ -78,6 +134,7 @@
'support' => [
'env' => 'TEST_EMAIL_SUPPORT',
'name' => 'Support Troppus',
'privileges' => [],
'role' => 'support',
'roles' => [
'user',
Expand All @@ -88,6 +145,7 @@
'support-admin' => [
'env' => 'TEST_EMAIL_SUPPORT_ADMIN',
'name' => 'Support Admin Nimda Troppus',
'privileges' => [],
'role' => 'support',
'roles' => [
'user',
Expand All @@ -99,6 +157,7 @@
'vendor' => [
'env' => 'TEST_EMAIL_VENDOR',
'name' => 'Vendor Rodnev',
'privileges' => [],
'role' => 'vendor',
'roles' => [
'user',
Expand All @@ -109,6 +168,7 @@
'vendor-admin' => [
'env' => 'TEST_EMAIL_VENDOR_ADMIN',
'name' => 'Vendor Admin Nimda Rodnev',
'privileges' => [],
'role' => 'vendor',
'roles' => [
'user',
Expand All @@ -120,6 +180,7 @@
'manager' => [
'env' => 'TEST_EMAIL_MANAGER',
'name' => 'Manager Reganam',
'privileges' => [],
'role' => 'manager',
'roles' => [
'user',
Expand All @@ -132,6 +193,7 @@
'manager-admin' => [
'env' => 'TEST_EMAIL_MANAGER_ADMIN',
'name' => 'Manager Admin Nimda Reganam',
'privileges' => [],
'role' => 'manager',
'roles' => [
'user',
Expand All @@ -145,6 +207,7 @@
'wheel' => [
'env' => 'TEST_EMAIL_WHEEL',
'name' => 'Wheel Leehw',
'privileges' => [],
'role' => 'admin',
'roles' => [
'root',
Expand All @@ -155,6 +218,9 @@
'root' => [
'env' => 'TEST_EMAIL_ROOT',
'name' => 'Root Toor',
'privileges' => [
'*',
],
'role' => 'root',
'roles' => [],
'description' => 'User: root',
Expand All @@ -163,6 +229,7 @@
'user' => [
'env' => 'TEST_EMAIL_USER',
'name' => 'User Resu',
'privileges' => [],
'role' => 'user',
'roles' => [],
'description' => 'User: user',
Expand All @@ -171,6 +238,7 @@
'user-admin' => [
'env' => 'TEST_EMAIL_USER_ADMIN',
'name' => 'User Admin Nimda Resu',
'privileges' => [],
'role' => 'user',
'roles' => [
'user',
Expand Down
5 changes: 0 additions & 5 deletions database/factories/DefaultUserFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
*/
class DefaultUserFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var class-string<DefaultUser>
*/
protected $model = DefaultUser::class;

/**
Expand Down
4 changes: 2 additions & 2 deletions database/factories/UserWithSanctumFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

declare(strict_types=1);
/**
* Playground
*/

declare(strict_types=1);
namespace Database\Factories\Playground\Test\Models;

use Illuminate\Database\Eloquent\Factories\Factory;
Expand Down
4 changes: 2 additions & 2 deletions database/factories/UserWithWithoutSanctumContractFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

declare(strict_types=1);
/**
* Playground
*/

declare(strict_types=1);
namespace Database\Factories\Playground\Test\Models;

use Illuminate\Database\Eloquent\Factories\Factory;
Expand Down
4 changes: 2 additions & 2 deletions database/factories/WidgetFactory.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

declare(strict_types=1);
/**
* Playground
*/

declare(strict_types=1);
namespace Database\Factories\Playground\Test\Models;

use Illuminate\Database\Eloquent\Factories\Factory;
Expand Down
Loading