From b1d664c154f2c39d0adfd00972ff2ac55bcdcc88 Mon Sep 17 00:00:00 2001 From: Ron Chaplin Date: Fri, 22 Mar 2024 13:31:11 -0500 Subject: [PATCH 1/3] Initial Livewire setup --- composer.json | 10 ++--- database/factories/UserFactory.php | 41 ------------------- database/migrations/create_users_table.php | 21 ---------- phpunit.xml.dist | 3 ++ resources/views/containers/div.blade.php | 3 ++ src/Components/Containers/Div.php | 13 ++++++ src/LwBits.php | 7 ---- src/Models/User.php | 46 ---------------------- tests/ArchTest.php | 5 --- tests/Feature/Containers/DivTest.php | 9 +++++ tests/TestCase.php | 19 +-------- 11 files changed, 35 insertions(+), 142 deletions(-) delete mode 100644 database/factories/UserFactory.php delete mode 100644 database/migrations/create_users_table.php create mode 100644 resources/views/containers/div.blade.php create mode 100644 src/Components/Containers/Div.php delete mode 100755 src/LwBits.php delete mode 100644 src/Models/User.php delete mode 100644 tests/ArchTest.php create mode 100644 tests/Feature/Containers/DivTest.php diff --git a/composer.json b/composer.json index b3eda21b..7fc7a5c2 100644 --- a/composer.json +++ b/composer.json @@ -17,13 +17,14 @@ ], "require": { "php": "^8.2", - "spatie/laravel-package-tools": "^1.16", - "illuminate/contracts": "^10.0||^11.0" + "illuminate/contracts": "^10.0||^11.0", + "livewire/livewire": "^3.4", + "spatie/laravel-package-tools": "^1.16" }, "require-dev": { + "larastan/larastan": "^2.9", "laravel/pint": "^1.14", "nunomaduro/collision": "^8.1.1||^7.10.0", - "larastan/larastan": "^2.9", "orchestra/testbench": "^9.0.0||^8.22.0", "pestphp/pest": "^2.34", "pestphp/pest-plugin-arch": "^2.7", @@ -35,8 +36,7 @@ }, "autoload": { "psr-4": { - "T73biz\\LwBits\\": "src/", - "T73biz\\LwBits\\Database\\Factories\\": "database/factories/" + "T73biz\\LwBits\\": "src/" } }, "autoload-dev": { diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php deleted file mode 100644 index 2a6dd36e..00000000 --- a/database/factories/UserFactory.php +++ /dev/null @@ -1,41 +0,0 @@ - - */ - public function definition(): array - { - return [ - 'name' => fake()->name(), - 'email' => fake()->unique()->safeEmail(), - 'email_verified_at' => now(), - 'password' => static::$password ??= Hash::make('password'), - 'remember_token' => Str::random(10), - ]; - } - - /** - * Indicate that the model's email address should be unverified. - */ - public function unverified(): static - { - return $this->state(fn (array $attributes) => [ - 'email_verified_at' => null, - ]); - } -} diff --git a/database/migrations/create_users_table.php b/database/migrations/create_users_table.php deleted file mode 100644 index d52f72dd..00000000 --- a/database/migrations/create_users_table.php +++ /dev/null @@ -1,21 +0,0 @@ -id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - } -}; diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c5825e23..840da70d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -35,4 +35,7 @@ ./src + + + diff --git a/resources/views/containers/div.blade.php b/resources/views/containers/div.blade.php new file mode 100644 index 00000000..348b565d --- /dev/null +++ b/resources/views/containers/div.blade.php @@ -0,0 +1,3 @@ +
+{{-- Foo tbol --}} +
diff --git a/src/Components/Containers/Div.php b/src/Components/Containers/Div.php new file mode 100644 index 00000000..dc986828 --- /dev/null +++ b/src/Components/Containers/Div.php @@ -0,0 +1,13 @@ + - */ - protected $fillable = [ - 'name', - 'email', - 'is_active', - 'password', - ]; - - /** - * The attributes that should be hidden for serialization. - * - * @var array - */ - protected $hidden = [ - 'password', - 'remember_token', - ]; - - /** - * Get the attributes that should be cast. - * - * @return array - */ - protected function casts(): array - { - return [ - 'email_verified_at' => 'datetime', - 'password' => 'hashed', - ]; - } -} diff --git a/tests/ArchTest.php b/tests/ArchTest.php deleted file mode 100644 index 87fb64cd..00000000 --- a/tests/ArchTest.php +++ /dev/null @@ -1,5 +0,0 @@ -expect(['dd', 'dump', 'ray']) - ->each->not->toBeUsed(); diff --git a/tests/Feature/Containers/DivTest.php b/tests/Feature/Containers/DivTest.php new file mode 100644 index 00000000..fad5d34e --- /dev/null +++ b/tests/Feature/Containers/DivTest.php @@ -0,0 +1,9 @@ +assertStatus(200); +}); diff --git a/tests/TestCase.php b/tests/TestCase.php index 994beae4..64abb2eb 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,32 +2,17 @@ namespace T73biz\LwBits\Tests; -use Illuminate\Database\Eloquent\Factories\Factory; +use Livewire\LivewireServiceProvider; use Orchestra\Testbench\TestCase as Orchestra; use T73biz\LwBits\LwBitsServiceProvider; class TestCase extends Orchestra { - protected function setUp(): void - { - parent::setUp(); - - Factory::guessFactoryNamesUsing( - fn (string $modelName) => 'T73biz\\LwBits\\Database\\Factories\\'.class_basename($modelName).'Factory' - ); - } - protected function getPackageProviders($app): array { return [ LwBitsServiceProvider::class, + LivewireServiceProvider::class, ]; } - - public function getEnvironmentSetUp($app): void - { - config()->set('database.default', 'testing'); - $migration = include __DIR__.'/../database/migrations/create_users_table.php'; - $migration->up(); - } } From 8815fe2b5a6e1254db305a6a6d0a700e3fd27d55 Mon Sep 17 00:00:00 2001 From: Ron Chaplin Date: Fri, 22 Mar 2024 13:34:04 -0500 Subject: [PATCH 2/3] Fixing php version for phpstan workflow --- .github/workflows/phpstan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index f495e76d..d5db2f14 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -18,7 +18,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.1' + php-version: '8.2' coverage: none - name: Install composer dependencies From 96e4024b20a1b79a345a644c29eb4d1e11efeadb Mon Sep 17 00:00:00 2001 From: Ron Chaplin Date: Fri, 22 Mar 2024 13:36:15 -0500 Subject: [PATCH 3/3] Fixing phpstan workflow --- phpstan.neon.dist | 1 - 1 file changed, 1 deletion(-) diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 489fa4e8..768d4873 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -6,7 +6,6 @@ parameters: paths: - src - config - - database tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true