From 848033427f4f4ce66ebf04e1d85fa2b7994c6f33 Mon Sep 17 00:00:00 2001 From: wverhoogt Date: Wed, 3 Apr 2024 15:45:20 +0200 Subject: [PATCH 01/47] Laravel 10 changes Co-authored-by: Wim Verhoogt --- .github/workflows/tests.yml | 2 +- .gitignore | 2 + composer.json | 26 +++++++++++- modules/backend/composer.json | 2 +- .../tests/classes/NavigationManagerTest.php | 42 +++++++++---------- modules/cms/composer.json | 2 +- modules/system/composer.json | 2 +- modules/system/console/WinterTest.php | 10 ++--- modules/system/tests/bootstrap/TestCase.php | 21 +++++++++- 9 files changed, 76 insertions(+), 33 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6dd83f4063..c57b744e8a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: name: ${{ matrix.operatingSystem }} / JavaScript env: nodeVersion: 16 - phpVersion: '8.0' + phpVersion: '8.1' extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip key: winter-cms-cache-develop steps: diff --git a/.gitignore b/.gitignore index 3582897e81..96199f3e71 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ composer.lock selenium.php /bootstrap/compiled.php .phpunit.result.cache +.phpunit.cache # Hosting ignores php_errors.log @@ -25,6 +26,7 @@ nbproject .idea .vscode _ide_helper.php +*.code-workspace # Other ignores .DS_Store diff --git a/composer.json b/composer.json index de944efaa8..c64974c508 100644 --- a/composer.json +++ b/composer.json @@ -28,13 +28,35 @@ "discord": "https://discord.gg/D5MFSPH6Ux", "source": "https://github.com/wintercms/winter" }, + "repositories": [ + { + "type": "path", + "url": "../winter-dev/modules/system", + "options": { "symlink": false } + }, + { + "type": "path", + "url": "../winter-dev/modules/backend", + "options": { "symlink": false } + }, + { + "type": "path", + "url": "../winter-dev/modules/cms", + "options": { "symlink": false } + }, + { + "type": "path", + "url": "../winter-dev/vendor/winter/storm", + "options": { "symlink": false } + } + ], "require": { - "php": "^8.0.2", + "php": "^8.1", "winter/storm": "dev-develop as 1.2", "winter/wn-system-module": "dev-develop", "winter/wn-backend-module": "dev-develop", "winter/wn-cms-module": "dev-develop", - "laravel/framework": "^9.1", + "laravel/framework": "^10.1", "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { diff --git a/modules/backend/composer.json b/modules/backend/composer.json index 07fb327fd3..0cb5a1d365 100644 --- a/modules/backend/composer.json +++ b/modules/backend/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^8.0.2", "composer/installers": "~1.11.0", - "laravel/framework": "^9.1" + "laravel/framework": "^10.1" }, "replace": { "october/backend": "1.1.*" diff --git a/modules/backend/tests/classes/NavigationManagerTest.php b/modules/backend/tests/classes/NavigationManagerTest.php index 2cdcc13370..91e76df866 100644 --- a/modules/backend/tests/classes/NavigationManagerTest.php +++ b/modules/backend/tests/classes/NavigationManagerTest.php @@ -26,14 +26,14 @@ public function testRegisterMenuItems() $this->assertArrayHasKey('WINTER.TEST.DASHBOARD', $items); $item = $items['WINTER.TEST.DASHBOARD']; - $this->assertObjectHasAttribute('code', $item); - $this->assertObjectHasAttribute('label', $item); - $this->assertObjectHasAttribute('icon', $item); - $this->assertObjectHasAttribute('url', $item); - $this->assertObjectHasAttribute('owner', $item); - $this->assertObjectHasAttribute('order', $item); - $this->assertObjectHasAttribute('permissions', $item); - $this->assertObjectHasAttribute('sideMenu', $item); + $this->assertObjectHasProperty('code', $item); + $this->assertObjectHasProperty('label', $item); + $this->assertObjectHasProperty('icon', $item); + $this->assertObjectHasProperty('url', $item); + $this->assertObjectHasProperty('owner', $item); + $this->assertObjectHasProperty('order', $item); + $this->assertObjectHasProperty('permissions', $item); + $this->assertObjectHasProperty('sideMenu', $item); $this->assertEquals('dashboard', $item->code); $this->assertEquals('Dashboard', $item->label); @@ -66,17 +66,17 @@ public function testListSideMenuItems() $this->assertArrayHasKey('categories', $items); $this->assertIsObject($items['posts']); - $this->assertObjectHasAttribute('code', $items['posts']); - $this->assertObjectHasAttribute('owner', $items['posts']); + $this->assertObjectHasProperty('code', $items['posts']); + $this->assertObjectHasProperty('owner', $items['posts']); $this->assertEquals('posts', $items['posts']->code); $this->assertEquals('Winter.Tester', $items['posts']->owner); - $this->assertObjectHasAttribute('permissions', $items['posts']); + $this->assertObjectHasProperty('permissions', $items['posts']); $this->assertIsArray($items['posts']->permissions); $this->assertCount(1, $items['posts']->permissions); - $this->assertObjectHasAttribute('order', $items['posts']); - $this->assertObjectHasAttribute('order', $items['categories']); + $this->assertObjectHasProperty('order', $items['posts']); + $this->assertObjectHasProperty('order', $items['categories']); $this->assertEquals(100, $items['posts']->order); $this->assertEquals(200, $items['categories']->order); } @@ -195,15 +195,15 @@ public function testAddSideMenuItems() $this->assertArrayHasKey('foo', $items); $this->assertIsObject($items['foo']); - $this->assertObjectHasAttribute('code', $items['foo']); - $this->assertObjectHasAttribute('owner', $items['foo']); - $this->assertObjectHasAttribute('order', $items['foo']); + $this->assertObjectHasProperty('code', $items['foo']); + $this->assertObjectHasProperty('owner', $items['foo']); + $this->assertObjectHasProperty('order', $items['foo']); $this->assertEquals(-1, $items['foo']->order); $this->assertEquals('foo', $items['foo']->code); $this->assertEquals('Winter.Tester', $items['foo']->owner); - $this->assertObjectHasAttribute('permissions', $items['foo']); + $this->assertObjectHasProperty('permissions', $items['foo']); $this->assertIsArray($items['foo']->permissions); $this->assertCount(2, $items['foo']->permissions); $this->assertContains('winter.tester.access_foo', $items['foo']->permissions); @@ -236,15 +236,15 @@ public function testAddSideMenuItemsWithAlias() $this->assertArrayHasKey('foo', $items); $this->assertTrue(is_object($items['foo'])); - $this->assertObjectHasAttribute('code', $items['foo']); - $this->assertObjectHasAttribute('owner', $items['foo']); - $this->assertObjectHasAttribute('order', $items['foo']); + $this->assertObjectHasProperty('code', $items['foo']); + $this->assertObjectHasProperty('owner', $items['foo']); + $this->assertObjectHasProperty('order', $items['foo']); $this->assertEquals(-1, $items['foo']->order); $this->assertEquals('foo', $items['foo']->code); $this->assertEquals('Winter.Tester', $items['foo']->owner); - $this->assertObjectHasAttribute('permissions', $items['foo']); + $this->assertObjectHasProperty('permissions', $items['foo']); $this->assertTrue(is_array($items['foo']->permissions)); $this->assertCount(2, $items['foo']->permissions); $this->assertContains('winter.tester.access_foo', $items['foo']->permissions); diff --git a/modules/cms/composer.json b/modules/cms/composer.json index 9d5fc5d302..a754fbe754 100644 --- a/modules/cms/composer.json +++ b/modules/cms/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^8.0.2", "composer/installers": "~1.11.0", - "laravel/framework": "^9.1" + "laravel/framework": "^10.1" }, "replace": { "october/cms": "1.1.*" diff --git a/modules/system/composer.json b/modules/system/composer.json index e8387cfb4f..1a8436fe57 100644 --- a/modules/system/composer.json +++ b/modules/system/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^8.0.2", "composer/installers": "~1.11.0", - "laravel/framework": "^9.1", + "laravel/framework": "^10.1", "composer/semver": "^3.2" }, "replace": { diff --git a/modules/system/console/WinterTest.php b/modules/system/console/WinterTest.php index 8a0eb2375d..6ce04e42cb 100644 --- a/modules/system/console/WinterTest.php +++ b/modules/system/console/WinterTest.php @@ -33,11 +33,11 @@ class WinterTest extends Command * @var string The console command signature as ignoreValidationErrors causes options not to be registered. */ protected $signature = 'winter:test - {phpunitArgs?* : Arguments to pass through to PHPUnit} - {?--c|configuration= : A specific phpunit xml file} - {?--b|bootstrap= : A custom PHPUnit bootstrap file} - {?--p|plugin=* : List of plugins to test} - {?--m|module=* : List of modules to test} + {phpunitArgs?* : use "--" followed by the arguments to pass through to PHPUnit such as "-- --stop-on-failure"} + {--c|configuration= : A specific phpunit xml file} + {--b|bootstrap= : A custom PHPUnit bootstrap file} + {--p|plugin=* : List of plugins to test} + {--m|module=* : List of modules to test} '; /** diff --git a/modules/system/tests/bootstrap/TestCase.php b/modules/system/tests/bootstrap/TestCase.php index 3bdb052718..84784fe14d 100644 --- a/modules/system/tests/bootstrap/TestCase.php +++ b/modules/system/tests/bootstrap/TestCase.php @@ -78,7 +78,8 @@ public static function assertFileNotExists(string $filename, string $message = ' /** * Stub for `assertRegExp` to allow compatibility with both PHPUnit 8 and 9. * - * @param string $filename + * @param string $pattern + * @param string $string * @param string $message * @return void */ @@ -91,4 +92,22 @@ public static function assertRegExp(string $pattern, string $string, string $mes Assert::assertRegExp($pattern, $string, $message); } + + /** + * Stub for `assertObjectHasAttribute` to allow compatibility with both PHPUnit 9 and 10. + * + * @param string $propertyName + * @param object $object + * @param string $message + * @return void + */ + public static function assertObjectHasAttribute(string $propertyName, $object, string $message = ''): void + { + if (method_exists(Assert::class, 'assertObjectHasProperty')) { + Assert::assertObjectHasProperty($propertyName, $object, $message); + return; + } + + Assert::assertObjectHasAttribute($propertyName, $object, $message); + } } From b56be78c2935fd569334b6f180c8e623b464f2eb Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 3 Apr 2024 15:24:44 -0400 Subject: [PATCH 02/47] update composer for laravel-11 --- composer.json | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/composer.json b/composer.json index c64974c508..b06cb7ae78 100644 --- a/composer.json +++ b/composer.json @@ -28,39 +28,16 @@ "discord": "https://discord.gg/D5MFSPH6Ux", "source": "https://github.com/wintercms/winter" }, - "repositories": [ - { - "type": "path", - "url": "../winter-dev/modules/system", - "options": { "symlink": false } - }, - { - "type": "path", - "url": "../winter-dev/modules/backend", - "options": { "symlink": false } - }, - { - "type": "path", - "url": "../winter-dev/modules/cms", - "options": { "symlink": false } - }, - { - "type": "path", - "url": "../winter-dev/vendor/winter/storm", - "options": { "symlink": false } - } - ], "require": { - "php": "^8.1", - "winter/storm": "dev-develop as 1.2", - "winter/wn-system-module": "dev-develop", - "winter/wn-backend-module": "dev-develop", - "winter/wn-cms-module": "dev-develop", - "laravel/framework": "^10.1", + "php": "^8.2", + "winter/storm": "dev-wip-laravel-11", + "winter/wn-system-module": "dev-wip-laravel-11", + "winter/wn-backend-module": "dev-wip-laravel-11", + "winter/wn-cms-module": "dev-wip-laravel-11", + "laravel/framework": "^11.0", "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { - "phpunit/phpunit": "^9.5.8", "mockery/mockery": "^1.4.4", "fakerphp/faker": "^1.9.2", "squizlabs/php_codesniffer": "^3.2", From a506d96ee60fcd6fe80edf0a354644e2630d7f8a Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 3 Apr 2024 15:30:44 -0400 Subject: [PATCH 03/47] update to laravel 11 in modules composer.json files --- modules/backend/composer.json | 4 ++-- modules/cms/composer.json | 4 ++-- modules/system/composer.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/backend/composer.json b/modules/backend/composer.json index 0cb5a1d365..84acaccf56 100644 --- a/modules/backend/composer.json +++ b/modules/backend/composer.json @@ -23,9 +23,9 @@ } ], "require": { - "php": "^8.0.2", + "php": "^8.2", "composer/installers": "~1.11.0", - "laravel/framework": "^10.1" + "laravel/framework": "^11.0" }, "replace": { "october/backend": "1.1.*" diff --git a/modules/cms/composer.json b/modules/cms/composer.json index a754fbe754..0730af0685 100644 --- a/modules/cms/composer.json +++ b/modules/cms/composer.json @@ -23,9 +23,9 @@ } ], "require": { - "php": "^8.0.2", + "php": "^8.2", "composer/installers": "~1.11.0", - "laravel/framework": "^10.1" + "laravel/framework": "^11.0" }, "replace": { "october/cms": "1.1.*" diff --git a/modules/system/composer.json b/modules/system/composer.json index 1a8436fe57..6543a8039a 100644 --- a/modules/system/composer.json +++ b/modules/system/composer.json @@ -23,9 +23,9 @@ } ], "require": { - "php": "^8.0.2", + "php": "^8.2", "composer/installers": "~1.11.0", - "laravel/framework": "^10.1", + "laravel/framework": "^11.0", "composer/semver": "^3.2" }, "replace": { From 18cd0001bfb9fcf8778ee9d2738d7f59661a2ec2 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 3 Apr 2024 16:45:11 -0400 Subject: [PATCH 04/47] add temporary alias to fix PHPUnit class naming --- modules/cms/tests/classes/ControllerTest.php | 2 +- modules/system/aliases.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/cms/tests/classes/ControllerTest.php b/modules/cms/tests/classes/ControllerTest.php index 16d72cb9ce..abcd338741 100644 --- a/modules/cms/tests/classes/ControllerTest.php +++ b/modules/cms/tests/classes/ControllerTest.php @@ -302,7 +302,7 @@ protected function configAjaxRequestMock($handler, $partials = false) $requestMock = $this ->getMockBuilder('Illuminate\Http\Request') ->disableOriginalConstructor() - ->setMethods(['ajax', 'method', 'header']) + ->onlyMethods(['ajax', 'method', 'header']) ->getMock(); $map = [ diff --git a/modules/system/aliases.php b/modules/system/aliases.php index 3a644a3339..f3e37aff4d 100644 --- a/modules/system/aliases.php +++ b/modules/system/aliases.php @@ -111,4 +111,9 @@ 'October\Rain\Scaffold\Console\CreateReportWidget' => Backend\Console\CreateReportWidget::class, 'October\Rain\Scaffold\Console\CreateTheme' => Cms\Console\CreateTheme::class, 'October\Rain\Scaffold\Console\CreateComponent' => Cms\Console\CreateComponent::class, + + # this is currently required because Illuminate\Foundation\Testing\Concerns\InteractsWithTestCaseLifecycle + # references the wrong Class in newer PHPUnit + # TODO: send a PR to Laravel about this + 'PHPUnit\Metadata\Annotation\Parser\Registry' => 'PHPUnit\Util\Annotation\Registry', ]; From 1b3bae898f07ce4ebbbf5dc6628bf60de029dfcf Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 3 Apr 2024 22:15:58 -0400 Subject: [PATCH 05/47] update test php versions --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c57b744e8a..0ed2ab7778 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,7 +18,7 @@ jobs: name: ${{ matrix.operatingSystem }} / JavaScript env: nodeVersion: 16 - phpVersion: '8.1' + phpVersion: '8.2' extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip key: winter-cms-cache-develop steps: @@ -96,7 +96,7 @@ jobs: max-parallel: 8 matrix: operatingSystem: [ubuntu-latest, windows-latest] - phpVersion: ['8.0', '8.1', '8.2'] + phpVersion: ['8.2', '8.3'] fail-fast: false runs-on: ${{ matrix.operatingSystem }} name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }} From 51c97a311facf51714e63e751b0b26b5ba20b252 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Wed, 3 Apr 2024 22:23:42 -0400 Subject: [PATCH 06/47] update library versions temporarily --- .github/workflows/manifest.yml | 2 +- .github/workflows/tests.yml | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index 72597a5329..5bbbd08f6a 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -11,7 +11,7 @@ jobs: name: Update manifest runs-on: ubuntu-latest env: - phpVersion: '8.1' + phpVersion: '8.2' extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip key: winter-cms-cache-develop steps: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0ed2ab7778..39388bfb41 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,7 +58,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.2" + run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" - name: Switch library dependency (1.2) if: github.head_ref == '1.2' || github.ref == 'refs/heads/1.2' || github.base_ref == '1.2' @@ -135,7 +135,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.2" + run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" - name: Switch library dependency (1.0) if: github.head_ref == '1.0' || github.ref == 'refs/heads/1.0' || github.base_ref == '1.0' @@ -171,10 +171,6 @@ jobs: - name: Run post-update Composer scripts run: php artisan package:discover - - name: Setup problem matchers for PHPUnit - if: matrix.phpVersion == '8.1' - run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: Run Linting and Tests run: | composer lint From 83660ff3febfc2db19ec79ca06ea412759314c77 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Thu, 4 Apr 2024 07:37:35 -0400 Subject: [PATCH 07/47] adjust test for Laravel 11 changes --- .../tests/console/CreateMigrationTest.php | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/modules/system/tests/console/CreateMigrationTest.php b/modules/system/tests/console/CreateMigrationTest.php index 77e30eea71..5e3d56d9bd 100644 --- a/modules/system/tests/console/CreateMigrationTest.php +++ b/modules/system/tests/console/CreateMigrationTest.php @@ -34,46 +34,50 @@ public function testCreateMigration() $columns = [ 'id' => ['type'=>'integer', 'index'=>'primary', 'required'=>true], - 'cb' => ['type'=>'boolean'], - 'switch' => ['type'=>'boolean'], + 'cb' => ['type'=>'tinyint'], + 'switch' => ['type'=>'tinyint'], 'int' => ['type'=>'integer'], 'uint' => ['type'=>'integer', 'required'=>true], - 'double' => ['type'=>'float'], + 'double' => ['type'=>'double'], 'range' => ['type'=>'integer', 'required'=>true], 'datetime' => ['type'=>'datetime'], 'date' => ['type'=>'date', 'required'=>true], 'time' => ['type'=>'time'], 'md' => ['type'=>'text'], 'textarea' => ['type'=>'text'], - 'text' => ['type'=>'string', 'required'=>true], + 'text' => ['type'=>'varchar', 'required'=>true], 'phone_id' => ['type'=>'integer', 'index'=>true, 'required'=>true], 'user_id' => ['type'=>'integer', 'index'=>true, 'required'=>true], 'data' => ['type'=>'text'], 'sort_order' => ['type'=>'integer', 'index'=>true], 'taggable_id' => ['type'=>'integer', 'index'=>'morphable_index'], - 'taggable_type' => ['type'=>'string', 'index'=>'morphable_index'], + 'taggable_type' => ['type'=>'varchar', 'index'=>'morphable_index'], 'created_at' => ['type'=>'datetime'], 'updated_at' => ['type'=>'datetime'], ]; - $table = Schema::getConnection()->getDoctrineSchemaManager()->listTableDetails($this->table); + $schemaBuilder = Schema::getConnection()->getSchemaBuilder(); + + $tableColumns = collect($schemaBuilder->getColumns($this->table)); + $tableIndexes = collect($schemaBuilder->getIndexes($this->table))->pluck('columns', 'name'); foreach ($columns as $name => $definition) { - $this->assertEquals(array_get($definition, 'type'), Schema::getColumnType($this->table, $name)); + $column = $tableColumns->where('name', $name)->first(); + + $this->assertEquals(array_get($definition, 'type'), $column['type_name']); + $this->assertEquals(array_get($definition, 'required', false), !$column['nullable']); // assert an index has been created for the primary, morph and foreign keys if ($indexName = array_get($definition, 'index')) { if ($indexName === true) { $indexName = sprintf("%s_%s_index", $this->table, $name); } - $this->assertTrue($table->hasIndex($indexName)); + $this->assertTrue($schemaBuilder->hasIndex($this->table, $indexName)); - if ($indexName === 'morphable_index') { - $index = $table->getIndex($indexName); - $this->assertTrue(in_array($name, $index->getColumns())); + if ($indexColumns = array_get($indexName, $tableIndexes)) { + $this->assertTrue(in_array($name, $indexColumns)); } } - $this->assertEquals(array_get($definition, 'required', false), $table->getColumn($name)->getNotnull()); } $migration->down(); From c79f260a483c3442e39dc6fc47dbecfb43862209 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Thu, 4 Apr 2024 17:36:55 -0400 Subject: [PATCH 08/47] remove minimum-stability from composer.json and add config.hashing.rehash_on_login=false --- composer.json | 1 - config/hashing.php | 13 +++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b06cb7ae78..83b315ac58 100644 --- a/composer.json +++ b/composer.json @@ -62,7 +62,6 @@ "phpcs --colors -nq --report=\"full\" --extensions=\"php\"" ] }, - "minimum-stability": "dev", "prefer-stable": true, "extra": { "merge-plugin": { diff --git a/config/hashing.php b/config/hashing.php index ad56664fb1..7bf45fba5c 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -48,4 +48,17 @@ 'threads' => 1, 'time' => 4, ], + + /* + |-------------------------------------------------------------------------- + | Password Rehashing + |-------------------------------------------------------------------------- + | + | Laravel 11 will automatically rehash your user's passwords during + | authentication if your hashing algorithm's "work factor" has been updated + | since the password was last hashed. + | + */ + + 'rehash_on_login' => false, ]; From 2d8795d3f5d054526a615c12f8829ea0de8b5bec Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Mon, 15 Apr 2024 17:41:37 -0400 Subject: [PATCH 09/47] add phpunit; update dms/phpunit-arraysubset-asserts version --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 83b315ac58..fd63730f57 100644 --- a/composer.json +++ b/composer.json @@ -38,11 +38,12 @@ "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { + "phpunit/phpunit": "^10.5", "mockery/mockery": "^1.4.4", "fakerphp/faker": "^1.9.2", "squizlabs/php_codesniffer": "^3.2", "php-parallel-lint/php-parallel-lint": "^1.0", - "dms/phpunit-arraysubset-asserts": "^0.1.0|^0.2.1" + "dms/phpunit-arraysubset-asserts": "^0.5.0" }, "scripts": { "post-create-project-cmd": [ From 726825dd8ad5e86c76516979acb36bd2f465af26 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Mon, 15 Apr 2024 17:41:53 -0400 Subject: [PATCH 10/47] migrate phpunit.xml files --- modules/backend/phpunit.xml | 19 +++++------ modules/cms/phpunit.xml | 19 +++++------ modules/system/phpunit.xml | 19 +++++------ phpunit.xml | 68 ++++++++++++++++++------------------- 4 files changed, 60 insertions(+), 65 deletions(-) diff --git a/modules/backend/phpunit.xml b/modules/backend/phpunit.xml index 7c0631aa89..2023f43f78 100644 --- a/modules/backend/phpunit.xml +++ b/modules/backend/phpunit.xml @@ -1,17 +1,16 @@ - - - - ./tests - - + + + ./tests + + diff --git a/modules/cms/phpunit.xml b/modules/cms/phpunit.xml index 4cb34b9f38..bb4330c7dc 100644 --- a/modules/cms/phpunit.xml +++ b/modules/cms/phpunit.xml @@ -1,17 +1,16 @@ - - - - ./tests - - + + + ./tests + + diff --git a/modules/system/phpunit.xml b/modules/system/phpunit.xml index af5eee72a0..66ab407567 100644 --- a/modules/system/phpunit.xml +++ b/modules/system/phpunit.xml @@ -1,17 +1,16 @@ - - - - ./tests - - + + + ./tests + + diff --git a/phpunit.xml b/phpunit.xml index 72f7f52986..b2d613baed 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,39 +1,37 @@ - - - ./modules/ - - - ./modules/backend/routes.php - ./modules/cms/routes.php - ./modules/system/routes.php - ./modules/backend/database - ./modules/cms/database - ./modules/system/database - - - - - ./modules/system - ./modules/cms - ./modules/backend - - - - - - - + + + ./modules/system + ./modules/cms + ./modules/backend + + + + + + + + + + ./modules/ + + + ./modules/backend/routes.php + ./modules/cms/routes.php + ./modules/system/routes.php + ./modules/backend/database + ./modules/cms/database + ./modules/system/database + + From 23770c9126fc133623d1a95f5d73a8b09d9eab29 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Mon, 15 Apr 2024 17:58:20 -0400 Subject: [PATCH 11/47] dependency test --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index fd63730f57..c161678ee9 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,10 @@ }, "require": { "php": "^8.2", - "winter/storm": "dev-wip-laravel-11", - "winter/wn-system-module": "dev-wip-laravel-11", - "winter/wn-backend-module": "dev-wip-laravel-11", - "winter/wn-cms-module": "dev-wip-laravel-11", + "winter/storm": "dev-develop", + "winter/wn-system-module": "dev-develop", + "winter/wn-backend-module": "dev-develop", + "winter/wn-cms-module": "dev-develop", "laravel/framework": "^11.0", "wikimedia/composer-merge-plugin": "~2.1.0" }, From 66778f72ddfbc2283d38a636b65b27697963b57c Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Mon, 15 Apr 2024 18:02:24 -0400 Subject: [PATCH 12/47] revert to wip-laravel-11 branch for now --- composer.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index c161678ee9..fd63730f57 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,10 @@ }, "require": { "php": "^8.2", - "winter/storm": "dev-develop", - "winter/wn-system-module": "dev-develop", - "winter/wn-backend-module": "dev-develop", - "winter/wn-cms-module": "dev-develop", + "winter/storm": "dev-wip-laravel-11", + "winter/wn-system-module": "dev-wip-laravel-11", + "winter/wn-backend-module": "dev-wip-laravel-11", + "winter/wn-cms-module": "dev-wip-laravel-11", "laravel/framework": "^11.0", "wikimedia/composer-merge-plugin": "~2.1.0" }, From b5ecc38279950fa64aa2c2df5663c05c169ad9c5 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 11:13:48 -0400 Subject: [PATCH 13/47] add SQLite minimum requirement to winter:install --- modules/system/console/WinterInstall.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/modules/system/console/WinterInstall.php b/modules/system/console/WinterInstall.php index 5f600f6402..f873e59b89 100644 --- a/modules/system/console/WinterInstall.php +++ b/modules/system/console/WinterInstall.php @@ -7,6 +7,7 @@ use File; use Illuminate\Encryption\Encrypter; use PDO; +use Schema; use Str; use Symfony\Component\Console\Input\InputOption; use System\Classes\UpdateManager; @@ -376,6 +377,16 @@ protected function setupMigrateDatabase() { $this->line('Migrating application and plugins...'); + $connection = Schema::getConnection(); + + if ($connection->getDriverName() === 'sqlite') { + $parts = explode('.', $connection->getServerVersion()); + if (count($parts) < 2 || !($parts[0] == 3 && $parts[1] >= 35)) { + $this->error("SQLite version minimum requirement not met (>= 3.35)"); + exit; + } + }; + try { Db::purge(); From 13e51203ef1f65d4a09612241ebc1598b7cab893 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 11:17:01 -0400 Subject: [PATCH 14/47] use version_compare() method --- modules/system/console/WinterInstall.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/system/console/WinterInstall.php b/modules/system/console/WinterInstall.php index f873e59b89..664f3239af 100644 --- a/modules/system/console/WinterInstall.php +++ b/modules/system/console/WinterInstall.php @@ -380,8 +380,7 @@ protected function setupMigrateDatabase() $connection = Schema::getConnection(); if ($connection->getDriverName() === 'sqlite') { - $parts = explode('.', $connection->getServerVersion()); - if (count($parts) < 2 || !($parts[0] == 3 && $parts[1] >= 35)) { + if (version_compare($connection->getServerVersion(), '3.35', '<')) { $this->error("SQLite version minimum requirement not met (>= 3.35)"); exit; } From 9fa1cf18f5fa53caea375e5afbeea83deb543b63 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 11:47:49 -0400 Subject: [PATCH 15/47] remove phpunit alias; fix deprecation warnings in tests --- modules/system/aliases.php | 5 ----- modules/system/tests/classes/MediaLibraryTest.php | 4 ++-- modules/system/tests/classes/VersionManagerTest.php | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/modules/system/aliases.php b/modules/system/aliases.php index f3e37aff4d..3a644a3339 100644 --- a/modules/system/aliases.php +++ b/modules/system/aliases.php @@ -111,9 +111,4 @@ 'October\Rain\Scaffold\Console\CreateReportWidget' => Backend\Console\CreateReportWidget::class, 'October\Rain\Scaffold\Console\CreateTheme' => Cms\Console\CreateTheme::class, 'October\Rain\Scaffold\Console\CreateComponent' => Cms\Console\CreateComponent::class, - - # this is currently required because Illuminate\Foundation\Testing\Concerns\InteractsWithTestCaseLifecycle - # references the wrong Class in newer PHPUnit - # TODO: send a PR to Laravel about this - 'PHPUnit\Metadata\Annotation\Parser\Registry' => 'PHPUnit\Util\Annotation\Registry', ]; diff --git a/modules/system/tests/classes/MediaLibraryTest.php b/modules/system/tests/classes/MediaLibraryTest.php index ac9e67f6ae..7e7a8c24fa 100644 --- a/modules/system/tests/classes/MediaLibraryTest.php +++ b/modules/system/tests/classes/MediaLibraryTest.php @@ -20,7 +20,7 @@ public function tearDown(): void parent::tearDown(); } - public function invalidPathsProvider() + public static function invalidPathsProvider() { return [ ['./file'], @@ -36,7 +36,7 @@ public function invalidPathsProvider() ]; } - public function validPathsProvider() + public static function validPathsProvider() { return [ ['file'], diff --git a/modules/system/tests/classes/VersionManagerTest.php b/modules/system/tests/classes/VersionManagerTest.php index b4d0463a4c..1023808dd5 100644 --- a/modules/system/tests/classes/VersionManagerTest.php +++ b/modules/system/tests/classes/VersionManagerTest.php @@ -157,7 +157,7 @@ public function testExtractScriptsAndComments($versionInfo, $expectedComments, $ $this->assertEquals($expectedScripts, $scripts); } - public function versionInfoProvider() + public static function versionInfoProvider() { return [ [ From f0984584336fc54d8bfd64a83a00f383d8e355eb Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 12:06:37 -0400 Subject: [PATCH 16/47] test library switcher --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 39388bfb41..220ed42b06 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,7 +58,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" + run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.3" - name: Switch library dependency (1.2) if: github.head_ref == '1.2' || github.ref == 'refs/heads/1.2' || github.base_ref == '1.2' @@ -135,7 +135,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" + run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.3" - name: Switch library dependency (1.0) if: github.head_ref == '1.0' || github.ref == 'refs/heads/1.0' || github.base_ref == '1.0' From d46c368219f86b70bcf1f63c342fa68154cf32bd Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 12:08:36 -0400 Subject: [PATCH 17/47] Revert "test library switcher" This reverts commit f0984584336fc54d8bfd64a83a00f383d8e355eb. --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 220ed42b06..39388bfb41 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,7 +58,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.3" + run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" - name: Switch library dependency (1.2) if: github.head_ref == '1.2' || github.ref == 'refs/heads/1.2' || github.base_ref == '1.2' @@ -135,7 +135,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-develop as 1.3" + run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" - name: Switch library dependency (1.0) if: github.head_ref == '1.0' || github.ref == 'refs/heads/1.0' || github.base_ref == '1.0' From f9433434ed0659045a9a3c49be859b717370f5b7 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 13:01:40 -0400 Subject: [PATCH 18/47] verify SQLite db version requirement in UpdateManager::update() --- composer.json | 2 +- modules/system/classes/UpdateManager.php | 7 +++++++ modules/system/console/WinterInstall.php | 9 --------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/composer.json b/composer.json index fd63730f57..d4a431a807 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ }, "require": { "php": "^8.2", - "winter/storm": "dev-wip-laravel-11", + "winter/storm": "dev-wip-laravel-11 as 1.2", "winter/wn-system-module": "dev-wip-laravel-11", "winter/wn-backend-module": "dev-wip-laravel-11", "winter/wn-cms-module": "dev-wip-laravel-11", diff --git a/modules/system/classes/UpdateManager.php b/modules/system/classes/UpdateManager.php index 8a9569558c..66ac3df32d 100644 --- a/modules/system/classes/UpdateManager.php +++ b/modules/system/classes/UpdateManager.php @@ -135,6 +135,13 @@ public function bindContainerObjects() public function update() { try { + $connection = Schema::getConnection(); + if ($connection->getDriverName() === 'sqlite') { + if (version_compare($connection->getServerVersion(), '3.35', '<')) { + throw new Exception("SQLite version minimum requirement not met (>= 3.35)"); + } + }; + $firstUp = !Schema::hasTable($this->getMigrationTableName()); if ($firstUp) { $this->repository->createRepository(); diff --git a/modules/system/console/WinterInstall.php b/modules/system/console/WinterInstall.php index 664f3239af..327fba0af2 100644 --- a/modules/system/console/WinterInstall.php +++ b/modules/system/console/WinterInstall.php @@ -377,15 +377,6 @@ protected function setupMigrateDatabase() { $this->line('Migrating application and plugins...'); - $connection = Schema::getConnection(); - - if ($connection->getDriverName() === 'sqlite') { - if (version_compare($connection->getServerVersion(), '3.35', '<')) { - $this->error("SQLite version minimum requirement not met (>= 3.35)"); - exit; - } - }; - try { Db::purge(); From 924d57ed5c8945e34ff700f6db033787ebc645e6 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 14:16:18 -0400 Subject: [PATCH 19/47] force twig version 3.8.x until we fix the issue introduced in 3.9.x --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index d4a431a807..e03a44a822 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "winter/wn-backend-module": "dev-wip-laravel-11", "winter/wn-cms-module": "dev-wip-laravel-11", "laravel/framework": "^11.0", + "twig/twig": "~3.8.0", "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { From 2953731610b4b4127f579350a44c349ac49e9e10 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 16 Apr 2024 14:25:00 -0400 Subject: [PATCH 20/47] expand tabs --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e03a44a822..a66dc01164 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "winter/wn-backend-module": "dev-wip-laravel-11", "winter/wn-cms-module": "dev-wip-laravel-11", "laravel/framework": "^11.0", - "twig/twig": "~3.8.0", + "twig/twig": "~3.8.0", "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { From 4ba55dc058fc10a4916b3a96390521402e243bc0 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Sun, 15 Sep 2024 15:50:37 -0400 Subject: [PATCH 21/47] use latest 3.x twig --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 2114ca7899..480af0fe93 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,7 @@ "winter/wn-backend-module": "dev-wip-laravel-11", "winter/wn-cms-module": "dev-wip-laravel-11", "laravel/framework": "^11.0", - "twig/twig": "~3.8.0", + "twig/twig": "^3.14", "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { From e099f7fefd78bcdc6dd28d69a4c225ef87157acc Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Sun, 15 Sep 2024 15:53:10 -0400 Subject: [PATCH 22/47] remove twig dependency, already in storm --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index 480af0fe93..4d5b3353f6 100644 --- a/composer.json +++ b/composer.json @@ -35,7 +35,6 @@ "winter/wn-backend-module": "dev-wip-laravel-11", "winter/wn-cms-module": "dev-wip-laravel-11", "laravel/framework": "^11.0", - "twig/twig": "^3.14", "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { From 285cc1fcb46a1e13ce83f670353abc64d9ef7ca6 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sat, 19 Jul 2025 23:25:36 -0600 Subject: [PATCH 23/47] Fix branch name --- .github/workflows/tests.yml | 4 ++-- composer.json | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b4dc7b9119..7fee09fb98 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -58,7 +58,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" + run: php ./.github/workflows/utilities/library-switcher "dev-wip/1.3 as 1.3" - name: Switch library dependency (1.2) if: github.head_ref == '1.2' || github.ref == 'refs/heads/1.2' || github.base_ref == '1.2' @@ -135,7 +135,7 @@ jobs: - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' - run: php ./.github/workflows/utilities/library-switcher "dev-wip-laravel-11 as 1.2" + run: php ./.github/workflows/utilities/library-switcher "dev-wip/1.3 as 1.3" - name: Switch library dependency (1.0) if: github.head_ref == '1.0' || github.ref == 'refs/heads/1.0' || github.base_ref == '1.0' diff --git a/composer.json b/composer.json index a2435273f1..0951f3156e 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,10 @@ }, "require": { "php": "^8.2", - "winter/storm": "dev-wip-laravel-11 as 1.2", - "winter/wn-system-module": "dev-wip-laravel-11", - "winter/wn-backend-module": "dev-wip-laravel-11", - "winter/wn-cms-module": "dev-wip-laravel-11", + "winter/storm": "dev-wip/1.3 as 1.3", + "winter/wn-system-module": "dev-wip/1.3", + "winter/wn-backend-module": "dev-wip/1.3", + "winter/wn-cms-module": "dev-wip/1.3", "laravel/framework": "^11.0", "wikimedia/composer-merge-plugin": "~2.1.0" }, From a0077f65988b0b5b6e98f995cb3de37ebfe92ae6 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sun, 20 Jul 2025 00:19:32 -0600 Subject: [PATCH 24/47] Fix support for symfony/console 7.2+ by removing our definition for the --silent option --- modules/system/console/asset/mix/MixCompile.php | 1 - modules/system/console/asset/mix/MixCreate.php | 1 - modules/system/console/asset/mix/MixInstall.php | 1 - modules/system/console/asset/mix/MixWatch.php | 1 - modules/system/console/asset/npm/NpmInstall.php | 1 - modules/system/console/asset/npm/NpmRun.php | 1 - modules/system/console/asset/npm/NpmUpdate.php | 1 - modules/system/console/asset/npm/NpmVersion.php | 1 - modules/system/console/asset/vite/ViteCompile.php | 1 - modules/system/console/asset/vite/ViteCreate.php | 1 - modules/system/console/asset/vite/ViteInstall.php | 1 - modules/system/console/asset/vite/ViteWatch.php | 1 - 12 files changed, 12 deletions(-) diff --git a/modules/system/console/asset/mix/MixCompile.php b/modules/system/console/asset/mix/MixCompile.php index 14559cb39d..c86d0faf73 100644 --- a/modules/system/console/asset/mix/MixCompile.php +++ b/modules/system/console/asset/mix/MixCompile.php @@ -19,7 +19,6 @@ class MixCompile extends AssetCompile protected $signature = 'mix:compile {webpackArgs?* : Arguments to pass through to the Webpack CLI} {--f|production : Runs compilation in "production" mode} - {--s|silent : Enables silent mode, no output will be shown.} {--d|disable-tty : Disable tty mode} {--e|stop-on-error : Exit once an error is encountered} {--m|manifest= : Defines package.json to use for compile} diff --git a/modules/system/console/asset/mix/MixCreate.php b/modules/system/console/asset/mix/MixCreate.php index 85e1259aee..437b98562f 100644 --- a/modules/system/console/asset/mix/MixCreate.php +++ b/modules/system/console/asset/mix/MixCreate.php @@ -15,7 +15,6 @@ class MixCreate extends AssetCreate protected $signature = 'mix:create {packageName : The package name to add configuration for} {--no-stubs : Disable stub file generation} - {--s|silent : Enables silent mode, no output will be shown.} {--f|force : Force file overwrites}'; /** diff --git a/modules/system/console/asset/mix/MixInstall.php b/modules/system/console/asset/mix/MixInstall.php index b08d8c4b96..272ad6852a 100644 --- a/modules/system/console/asset/mix/MixInstall.php +++ b/modules/system/console/asset/mix/MixInstall.php @@ -17,7 +17,6 @@ class MixInstall extends AssetInstall {--no-install : Tells Winter not to run npm install after config update.} {--npm= : Defines a custom path to the "npm" binary.} {--d|disable-tty : Disable tty mode.} - {--s|silent : Enables silent mode, no output will be shown.} {--p|package-json= : Defines a custom path to "package.json" file. Must be above the workspace path.}'; /** diff --git a/modules/system/console/asset/mix/MixWatch.php b/modules/system/console/asset/mix/MixWatch.php index 53aee49133..b30b84e7b5 100644 --- a/modules/system/console/asset/mix/MixWatch.php +++ b/modules/system/console/asset/mix/MixWatch.php @@ -17,7 +17,6 @@ class MixWatch extends MixCompile {webpackArgs?* : Arguments to pass through to the Webpack CLI} {--f|production : Runs compilation in "production" mode} {--m|manifest= : Defines package.json to use for compile} - {--s|silent : Enables silent mode, no output will be shown.} {--d|disable-tty : Disable tty mode} {--no-progress : Do not show mix progress}'; diff --git a/modules/system/console/asset/npm/NpmInstall.php b/modules/system/console/asset/npm/NpmInstall.php index da697e42ae..c2e89d917a 100644 --- a/modules/system/console/asset/npm/NpmInstall.php +++ b/modules/system/console/asset/npm/NpmInstall.php @@ -25,7 +25,6 @@ class NpmInstall extends NpmCommand {npmArgs?* : Arguments to pass through to the "npm" binary} {--npm= : Defines a custom path to the "npm" binary} {--d|dev : Install packages in devDependencies} - {--s|silent : Silent mode.} {--disable-tty : Disable tty mode}'; /** diff --git a/modules/system/console/asset/npm/NpmRun.php b/modules/system/console/asset/npm/NpmRun.php index cd45313acd..5bfea734d8 100644 --- a/modules/system/console/asset/npm/NpmRun.php +++ b/modules/system/console/asset/npm/NpmRun.php @@ -19,7 +19,6 @@ class NpmRun extends NpmCommand {script : The name of the script to run, as defined in the package.json "scripts" config.} {additionalArgs?* : Arguments to pass through to the script being run.} {--f|production : Runs the script in "production" mode.} - {--s|silent : Silent mode.} {--disable-tty : Disable tty mode}'; /** diff --git a/modules/system/console/asset/npm/NpmUpdate.php b/modules/system/console/asset/npm/NpmUpdate.php index f578c5c4c1..2668391f2b 100644 --- a/modules/system/console/asset/npm/NpmUpdate.php +++ b/modules/system/console/asset/npm/NpmUpdate.php @@ -25,7 +25,6 @@ class NpmUpdate extends NpmCommand {npmArgs?* : Arguments to pass through to the "npm" binary.} {--npm= : Defines a custom path to the "npm" binary.} {--a|save : Tell npm to update package.json.} - {--s|silent : Silent mode.} {--disable-tty : Disable tty mode}'; /** diff --git a/modules/system/console/asset/npm/NpmVersion.php b/modules/system/console/asset/npm/NpmVersion.php index 78e4a4a0b7..0fda33770c 100644 --- a/modules/system/console/asset/npm/NpmVersion.php +++ b/modules/system/console/asset/npm/NpmVersion.php @@ -19,7 +19,6 @@ class NpmVersion extends NpmCommand */ protected $signature = 'npm:version {--c|compatible : Report compatible version via exit code.} - {--s|silent : Silent mode.} {--disable-tty : Disable tty mode}'; /** diff --git a/modules/system/console/asset/vite/ViteCompile.php b/modules/system/console/asset/vite/ViteCompile.php index eb10fea008..5a40904182 100644 --- a/modules/system/console/asset/vite/ViteCompile.php +++ b/modules/system/console/asset/vite/ViteCompile.php @@ -18,7 +18,6 @@ class ViteCompile extends AssetCompile protected $signature = 'vite:compile {viteArgs?* : Arguments to pass through to the Vite CLI} {--f|production : Runs compilation in "production" mode} - {--s|silent : Enables silent mode, no output will be shown.} {--d|disable-tty : Disable tty mode} {--e|stop-on-error : Exit once an error is encountered} {--m|manifest= : Defines package.json to use for compile} diff --git a/modules/system/console/asset/vite/ViteCreate.php b/modules/system/console/asset/vite/ViteCreate.php index 9067fb82ea..a26829a4a6 100644 --- a/modules/system/console/asset/vite/ViteCreate.php +++ b/modules/system/console/asset/vite/ViteCreate.php @@ -17,7 +17,6 @@ class ViteCreate extends AssetCreate protected $signature = 'vite:create {packageName : The package name to add configuration for} {--no-stubs : Disable stub file generation} - {--s|silent : Enables silent mode, no output will be shown.} {--f|force : Force file overwrites}'; /** diff --git a/modules/system/console/asset/vite/ViteInstall.php b/modules/system/console/asset/vite/ViteInstall.php index 035e7328c8..f21c236715 100644 --- a/modules/system/console/asset/vite/ViteInstall.php +++ b/modules/system/console/asset/vite/ViteInstall.php @@ -19,7 +19,6 @@ class ViteInstall extends AssetInstall {--no-install : Tells Winter not to run npm install after config update.} {--npm= : Defines a custom path to the "npm" binary.} {--d|disable-tty : Disable tty mode.} - {--s|silent : Enables silent mode, no output will be shown.} {--p|package-json= : Defines a custom path to "package.json" file. Must be above the workspace path.}'; /** diff --git a/modules/system/console/asset/vite/ViteWatch.php b/modules/system/console/asset/vite/ViteWatch.php index 2825724793..2175f8a94a 100644 --- a/modules/system/console/asset/vite/ViteWatch.php +++ b/modules/system/console/asset/vite/ViteWatch.php @@ -19,7 +19,6 @@ class ViteWatch extends ViteCompile {viteArgs?* : Arguments to pass through to the Webpack CLI} {--f|production : Runs compilation in "production" mode} {--m|manifest= : Defines package.json to use for compile} - {--s|silent : Enables silent mode, no output will be shown.} {--d|disable-tty : Disable tty mode} {--no-progress : Do not show mix progress}'; From 24661f8cf4e811438b943b8b83431ac31aee0127 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sun, 20 Jul 2025 00:26:25 -0600 Subject: [PATCH 25/47] Remove unused import --- modules/system/console/WinterInstall.php | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/system/console/WinterInstall.php b/modules/system/console/WinterInstall.php index aa9e657568..23cedb057b 100644 --- a/modules/system/console/WinterInstall.php +++ b/modules/system/console/WinterInstall.php @@ -7,7 +7,6 @@ use File; use Illuminate\Encryption\Encrypter; use PDO; -use Schema; use Str; use Symfony\Component\Console\Input\InputOption; use System\Classes\UpdateManager; From 6cb6aaf548089fc4551bb9708a650f8f42d6908e Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Mon, 21 Jul 2025 00:48:18 -0600 Subject: [PATCH 26/47] Target Laravel 12 --- composer.json | 4 ++-- modules/backend/composer.json | 2 +- modules/cms/composer.json | 2 +- modules/system/composer.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 0951f3156e..6bafa8e352 100644 --- a/composer.json +++ b/composer.json @@ -34,11 +34,11 @@ "winter/wn-system-module": "dev-wip/1.3", "winter/wn-backend-module": "dev-wip/1.3", "winter/wn-cms-module": "dev-wip/1.3", - "laravel/framework": "^11.0", + "laravel/framework": "^12.0", "wikimedia/composer-merge-plugin": "~2.1.0" }, "require-dev": { - "phpunit/phpunit": "^10.5", + "phpunit/phpunit": "^11.0", "mockery/mockery": "^1.4.4", "fakerphp/faker": "^1.9.2", "squizlabs/php_codesniffer": "^3.2", diff --git a/modules/backend/composer.json b/modules/backend/composer.json index 84acaccf56..bb0d6050f7 100644 --- a/modules/backend/composer.json +++ b/modules/backend/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^8.2", "composer/installers": "~1.11.0", - "laravel/framework": "^11.0" + "laravel/framework": "^12.0" }, "replace": { "october/backend": "1.1.*" diff --git a/modules/cms/composer.json b/modules/cms/composer.json index 0730af0685..6e59532759 100644 --- a/modules/cms/composer.json +++ b/modules/cms/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^8.2", "composer/installers": "~1.11.0", - "laravel/framework": "^11.0" + "laravel/framework": "^12.0" }, "replace": { "october/cms": "1.1.*" diff --git a/modules/system/composer.json b/modules/system/composer.json index 6543a8039a..3d58afe4e6 100644 --- a/modules/system/composer.json +++ b/modules/system/composer.json @@ -25,7 +25,7 @@ "require": { "php": "^8.2", "composer/installers": "~1.11.0", - "laravel/framework": "^11.0", + "laravel/framework": "^12.0", "composer/semver": "^3.2" }, "replace": { From b4d764271a1e045ca3be5387b5015482dd4c5aa7 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Mon, 21 Jul 2025 00:54:43 -0600 Subject: [PATCH 27/47] Use WIP testing dependencies for now --- composer.json | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 6bafa8e352..49915a8696 100644 --- a/composer.json +++ b/composer.json @@ -43,8 +43,14 @@ "fakerphp/faker": "^1.9.2", "squizlabs/php_codesniffer": "^3.2", "php-parallel-lint/php-parallel-lint": "^1.0", - "dms/phpunit-arraysubset-asserts": "^0.5.0" + "dms/phpunit-arraysubset-asserts": "dev-add-phpunit-11-support" }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/pieterocp/phpunit-arraysubset-asserts" + } + ], "scripts": { "post-create-project-cmd": [ "@php artisan winter:install", From 909dced11cc5acb645cfd5b133339f5d77265828 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 23 Jul 2025 21:57:08 -0600 Subject: [PATCH 28/47] Use composer token in actions --- .github/workflows/manifest.yml | 3 +++ .github/workflows/tests.yml | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index e03b53d42c..68ac736f1a 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -28,6 +28,9 @@ jobs: php-version: ${{ env.phpVersion }} extensions: ${{ env.extensions }} + - name: Configure Composer GitHub token + run: composer config --global --auth github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }} + - name: Install Composer dependencies run: composer install --no-interaction --no-progress --no-scripts diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7fee09fb98..d981887231 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -75,6 +75,9 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: ${{ runner.os }}-composer- + - name: Configure Composer GitHub token + run: composer config --global --auth github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }} + - name: Install Composer dependencies run: composer install --no-interaction --no-progress --no-scripts @@ -160,6 +163,9 @@ jobs: key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} restore-keys: ${{ runner.os }}-composer- + - name: Configure Composer GitHub token + run: composer config --global --auth github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }} + - name: Install Composer dependencies run: composer install --no-interaction --no-progress --no-scripts From 88d294eaa7b5d09831fccf38b8678af2b7364d10 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 23 Jul 2025 23:03:00 -0600 Subject: [PATCH 29/47] Fixes to tests --- .../backend/tests/classes/AuthManagerTest.php | 4 +- .../backend/tests/traits/WidgetMakerTest.php | 7 ++- modules/cms/tests/classes/CmsObjectTest.php | 13 ++-- modules/cms/tests/classes/ControllerTest.php | 61 ++++++++++--------- modules/system/console/WinterTest.php | 6 +- modules/system/tests/ServiceProviderTest.php | 6 +- .../system/tests/classes/MediaLibraryTest.php | 9 +-- .../tests/classes/VersionManagerTest.php | 9 +-- phpunit.xml | 1 + 9 files changed, 57 insertions(+), 59 deletions(-) diff --git a/modules/backend/tests/classes/AuthManagerTest.php b/modules/backend/tests/classes/AuthManagerTest.php index cc112db10c..a637d4ebcd 100644 --- a/modules/backend/tests/classes/AuthManagerTest.php +++ b/modules/backend/tests/classes/AuthManagerTest.php @@ -2,9 +2,10 @@ namespace Backend\Tests\Classes; +use Backend\Classes\AuthManager; +use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Tests\Bootstrap\TestCase; use Winter\Storm\Exception\SystemException; -use Backend\Classes\AuthManager; class AuthManagerTest extends TestCase { @@ -44,6 +45,7 @@ protected function listNewPermissions() public function tearDown(): void { AuthManager::forgetInstance(); + HandleExceptions::flushState(); } public function testListPermissions() diff --git a/modules/backend/tests/traits/WidgetMakerTest.php b/modules/backend/tests/traits/WidgetMakerTest.php index 4d1caf2df9..be125946c3 100644 --- a/modules/backend/tests/traits/WidgetMakerTest.php +++ b/modules/backend/tests/traits/WidgetMakerTest.php @@ -9,6 +9,8 @@ class ExampleTraitClass { use \Backend\Traits\WidgetMaker; + protected Controller $controller; + public function __construct() { $this->controller = new Controller; @@ -35,8 +37,9 @@ public function setUp(): void { parent::setUp(); - $traitName = 'Backend\Traits\WidgetMaker'; - $this->traitObject = $this->getObjectForTrait($traitName); + $this->traitObject = new class { + use \Backend\Traits\WidgetMaker; + }; } public function testTraitObject() diff --git a/modules/cms/tests/classes/CmsObjectTest.php b/modules/cms/tests/classes/CmsObjectTest.php index 61bacb711a..02b83c1170 100644 --- a/modules/cms/tests/classes/CmsObjectTest.php +++ b/modules/cms/tests/classes/CmsObjectTest.php @@ -5,6 +5,7 @@ use System\Tests\Bootstrap\TestCase; use Cms\Classes\CmsObject; use Cms\Classes\Theme; +use PHPUnit\Framework\Attributes\Depends; class TestCmsObject extends CmsObject { @@ -236,9 +237,7 @@ public function testSave() $this->assertEquals($testContents, file_get_contents($destFilePath)); } - /** - * @depends testSave - */ + #[Depends('testSave')] public function testRename() { $theme = Theme::load('apitest'); @@ -265,9 +264,7 @@ public function testRename() $this->assertEquals($testContents, file_get_contents($destFilePath)); } - /** - * @depends testRename - */ + #[Depends('testRename')] public function testSaveSameName() { $theme = Theme::load('apitest'); @@ -288,9 +285,7 @@ public function testSaveSameName() $this->assertEquals($testContents, file_get_contents($filePath)); } - /** - * @depends testRename - */ + #[Depends('testRename')] public function testRenameToExistingFile() { $this->expectException(\Winter\Storm\Exception\ApplicationException::class); diff --git a/modules/cms/tests/classes/ControllerTest.php b/modules/cms/tests/classes/ControllerTest.php index abcd338741..6a098d6f52 100644 --- a/modules/cms/tests/classes/ControllerTest.php +++ b/modules/cms/tests/classes/ControllerTest.php @@ -2,12 +2,13 @@ namespace Cms\Tests\Classes; -use Cms; -use Request; -use System\Tests\Bootstrap\TestCase; -use Cms\Classes\Theme; use Cms\Classes\Controller; +use Cms\Classes\Theme; +use Cms\Facades\Cms; +use Illuminate\Support\Facades\Cache; +use Illuminate\Support\Facades\Request; use System\Helpers\View; +use System\Tests\Bootstrap\TestCase; use Winter\Storm\Halcyon\Model; use Winter\Storm\Support\Facades\Config; @@ -79,7 +80,7 @@ public function testThemeCombineAssets(): void $cacheKey = 'combiner.' . str_before(basename($url), '-'); // Load the cached config - $combinerConfig = \Cache::get($cacheKey); + $combinerConfig = Cache::get($cacheKey); $this->assertIsString($combinerConfig); // Decode the config @@ -299,30 +300,32 @@ public function testChildThemePageLifeCycle() protected function configAjaxRequestMock($handler, $partials = false) { - $requestMock = $this - ->getMockBuilder('Illuminate\Http\Request') - ->disableOriginalConstructor() - ->onlyMethods(['ajax', 'method', 'header']) - ->getMock(); - - $map = [ - ['X_WINTER_REQUEST_HANDLER', null, $handler], - ['X_WINTER_REQUEST_PARTIALS', null, $partials], - ]; - - $requestMock->expects($this->any()) - ->method('ajax') - ->will($this->returnValue(true)); - - $requestMock->expects($this->any()) - ->method('method') - ->will($this->returnValue('POST')); - - $requestMock->expects($this->any()) - ->method('header') - ->will($this->returnValueMap($map)); - - return $requestMock; + return new class($handler, $partials) extends \Illuminate\Http\Request { + protected $handler; + protected $partials; + public function __construct($handler, $partials) + { + $this->handler = $handler; + $this->partials = $partials; + parent::__construct(); + } + public function ajax() + { + return true; + } + public function method() + { + return 'POST'; + } + public function header($key = null, $default = null) + { + return match ($key) { + 'X_WINTER_REQUEST_HANDLER' => $this->handler, + 'X_WINTER_REQUEST_PARTIALS' => $this->partials, + default => $default, + }; + } + }; } public function testAjaxHandlerNotFound() diff --git a/modules/system/console/WinterTest.php b/modules/system/console/WinterTest.php index 0cd676ab14..afd6afe940 100644 --- a/modules/system/console/WinterTest.php +++ b/modules/system/console/WinterTest.php @@ -1,6 +1,7 @@ - 'Dummy value', ]; Log::info($message, $details); - $latestLog = Db::table('system_event_logs')->latest()->first(); + $latestLog = DB::table('system_event_logs')->latest()->first(); $this->assertEquals($message, $latestLog->message); $this->assertEquals($details, json_decode($latestLog->details, true)); } diff --git a/modules/system/tests/classes/MediaLibraryTest.php b/modules/system/tests/classes/MediaLibraryTest.php index 7e7a8c24fa..751f989f46 100644 --- a/modules/system/tests/classes/MediaLibraryTest.php +++ b/modules/system/tests/classes/MediaLibraryTest.php @@ -4,6 +4,7 @@ use System\Tests\Bootstrap\TestCase; use Illuminate\Filesystem\FilesystemAdapter; +use PHPUnit\Framework\Attributes\DataProvider; use System\Classes\MediaLibrary; class MediaLibraryTest extends TestCase @@ -61,18 +62,14 @@ public static function validPathsProvider() ]; } - /** - * @dataProvider invalidPathsProvider - */ + #[DataProvider('invalidPathsProvider')] public function testInvalidPathsOnValidatePath($path) { $this->expectException('ApplicationException'); MediaLibrary::validatePath($path); } - /** - * @dataProvider validPathsProvider - */ + #[DataProvider('validPathsProvider')] public function testValidPathsOnValidatePath($path) { $result = MediaLibrary::validatePath($path); diff --git a/modules/system/tests/classes/VersionManagerTest.php b/modules/system/tests/classes/VersionManagerTest.php index 1023808dd5..b760e3d617 100644 --- a/modules/system/tests/classes/VersionManagerTest.php +++ b/modules/system/tests/classes/VersionManagerTest.php @@ -2,6 +2,7 @@ namespace System\Tests\Classes; +use PHPUnit\Framework\Attributes\DataProvider; use System\Tests\Bootstrap\TestCase; use System\Classes\VersionManager; @@ -138,13 +139,7 @@ public function testGetNewFileVersions() $this->assertArrayHasKey('1.5.1', $result); } - /** - * @dataProvider versionInfoProvider - * - * @param $versionInfo - * @param $expectedComments - * @param $expectedScripts - */ + #[DataProvider('versionInfoProvider')] public function testExtractScriptsAndComments($versionInfo, $expectedComments, $expectedScripts) { $manager = VersionManager::instance(); diff --git a/phpunit.xml b/phpunit.xml index b2d613baed..ffb9f4bfbf 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,6 +20,7 @@ + From e07cdc1452e2b389f8355e19cb27054038627b53 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 23 Jul 2025 23:20:08 -0600 Subject: [PATCH 30/47] More PHPUnit fixes --- modules/system/tests/classes/SourceManifestTest.php | 5 +++-- modules/system/tests/console/WinterUtilTest.php | 3 +++ modules/system/tests/console/asset/mix/MixCreateTest.php | 3 +++ modules/system/tests/console/asset/mix/MixInstallTest.php | 3 +++ modules/system/tests/console/asset/npm/NpmInstallTest.php | 3 +++ modules/system/tests/console/asset/npm/NpmUpdateTest.php | 3 +++ modules/system/tests/console/asset/vite/ViteCreateTest.php | 2 ++ 7 files changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/system/tests/classes/SourceManifestTest.php b/modules/system/tests/classes/SourceManifestTest.php index 3b3ed20ea3..b5a692bdec 100644 --- a/modules/system/tests/classes/SourceManifestTest.php +++ b/modules/system/tests/classes/SourceManifestTest.php @@ -2,10 +2,10 @@ namespace System\Tests\Classes; +use System\Classes\FileManifest; +use System\Classes\SourceManifest; use System\Tests\Bootstrap\TestCase; use Winter\Storm\Argon\Argon; -use System\Classes\SourceManifest; -use System\Classes\FileManifest; class SourceManifestTest extends TestCase { @@ -53,6 +53,7 @@ public function tearDown(): void { Argon::setTestNow(); $this->deleteManifest(); + parent::tearDown(); } public function testCreateManifest() diff --git a/modules/system/tests/console/WinterUtilTest.php b/modules/system/tests/console/WinterUtilTest.php index f604ba9439..63c42c2913 100644 --- a/modules/system/tests/console/WinterUtilTest.php +++ b/modules/system/tests/console/WinterUtilTest.php @@ -2,6 +2,7 @@ namespace System\Tests\Console; +use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Tests\Bootstrap\TestCase; class WinterUtilTest extends TestCase @@ -94,5 +95,7 @@ protected function tearDown(): void } $this->artisan('winter:util compile lang')->execute(); + + HandleExceptions::flushState(); } } diff --git a/modules/system/tests/console/asset/mix/MixCreateTest.php b/modules/system/tests/console/asset/mix/MixCreateTest.php index f9fcb1f747..0e4771b624 100644 --- a/modules/system/tests/console/asset/mix/MixCreateTest.php +++ b/modules/system/tests/console/asset/mix/MixCreateTest.php @@ -2,6 +2,7 @@ namespace System\Tests\Console\Asset\Mix; +use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\PluginManager; use System\Tests\Bootstrap\TestCase; use Winter\Storm\Support\Facades\File; @@ -230,5 +231,7 @@ public function tearDown(): void File::delete($file); } } + + HandleExceptions::flushState(); } } diff --git a/modules/system/tests/console/asset/mix/MixInstallTest.php b/modules/system/tests/console/asset/mix/MixInstallTest.php index 1494610628..f77249da5a 100644 --- a/modules/system/tests/console/asset/mix/MixInstallTest.php +++ b/modules/system/tests/console/asset/mix/MixInstallTest.php @@ -2,6 +2,7 @@ namespace System\Tests\Console\Asset\Mix; +use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\Asset\PackageManager; use System\Tests\Bootstrap\TestCase; use Winter\Storm\Exception\SystemException; @@ -208,6 +209,8 @@ public function tearDown(): void File::delete($this->lockPath); } + HandleExceptions::flushState(); + parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/npm/NpmInstallTest.php b/modules/system/tests/console/asset/npm/NpmInstallTest.php index 611ab20df7..581844081b 100644 --- a/modules/system/tests/console/asset/npm/NpmInstallTest.php +++ b/modules/system/tests/console/asset/npm/NpmInstallTest.php @@ -2,6 +2,7 @@ namespace System\Tests\Console\Asset\Npm; +use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\Asset\PackageManager; use System\Tests\Bootstrap\TestCase; use System\Tests\Console\Asset\NpmTestTrait; @@ -204,6 +205,8 @@ public function tearDown(): void } } + HandleExceptions::flushState(); + parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/npm/NpmUpdateTest.php b/modules/system/tests/console/asset/npm/NpmUpdateTest.php index 38b63d9827..b04c596614 100644 --- a/modules/system/tests/console/asset/npm/NpmUpdateTest.php +++ b/modules/system/tests/console/asset/npm/NpmUpdateTest.php @@ -2,6 +2,7 @@ namespace System\tests\console\asset\npm; +use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\Asset\PackageManager; use System\Tests\Bootstrap\TestCase; use System\Tests\Console\Asset\NpmTestTrait; @@ -99,6 +100,8 @@ public function tearDown(): void } } + HandleExceptions::flushState(); + parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/vite/ViteCreateTest.php b/modules/system/tests/console/asset/vite/ViteCreateTest.php index cdcfc855ae..db09c2f5b8 100644 --- a/modules/system/tests/console/asset/vite/ViteCreateTest.php +++ b/modules/system/tests/console/asset/vite/ViteCreateTest.php @@ -230,5 +230,7 @@ public function tearDown(): void File::delete($file); } } + + parent::tearDown(); } } From 16b668d77f57d3ec254e773be7cf7f64e8766e61 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Thu, 24 Jul 2025 13:51:10 +0800 Subject: [PATCH 31/47] Apply Github token through Setup PHP action, change concurrency settings --- .github/workflows/manifest.yml | 4 +- .github/workflows/tests.yml | 79 ++++------------------------------ 2 files changed, 10 insertions(+), 73 deletions(-) diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index 68ac736f1a..08310eee5c 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -27,9 +27,7 @@ jobs: with: php-version: ${{ env.phpVersion }} extensions: ${{ env.extensions }} - - - name: Configure Composer GitHub token - run: composer config --global --auth github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }} + github-token: ${{ secrets.COMPOSER_GITHUB_TOKEN }} - name: Install Composer dependencies run: composer install --no-interaction --no-progress --no-scripts diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d981887231..5197e00469 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,6 +7,11 @@ on: - develop pull_request: + +concurrency: + group: tests-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + jobs: frontendTests: strategy: @@ -22,34 +27,15 @@ jobs: extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip key: winter-cms-cache-develop steps: - - name: Cancel previous incomplete runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Checkout changes - uses: actions/checkout@v3 - - - name: Setup extension cache - id: extcache - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ env.phpVersion }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v3 - with: - path: ${{ steps.extcache.outputs.dir }} - key: ${{ steps.extcache.outputs.key }} - restore-keys: ${{ steps.extcache.outputs.key }} + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ env.phpVersion }} extensions: ${{ env.extensions }} + github-token: ${{ secrets.COMPOSER_GITHUB_TOKEN }} - name: Install Node uses: actions/setup-node@v3 @@ -64,20 +50,6 @@ jobs: if: github.head_ref == '1.2' || github.ref == 'refs/heads/1.2' || github.base_ref == '1.2' run: php ./.github/workflows/utilities/library-switcher "1.2.x-dev as 1.2" - - name: Setup dependency cache - id: composercache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composercache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Configure Composer GitHub token - run: composer config --global --auth github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }} - - name: Install Composer dependencies run: composer install --no-interaction --no-progress --no-scripts @@ -107,34 +79,15 @@ jobs: extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip key: winter-cms-cache-develop steps: - - name: Cancel previous incomplete runs - uses: styfle/cancel-workflow-action@0.8.0 - with: - access_token: ${{ github.token }} - - name: Checkout changes - uses: actions/checkout@v2 - - - name: Setup extension cache - id: extcache - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.phpVersion }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v3 - with: - path: ${{ steps.extcache.outputs.dir }} - key: ${{ steps.extcache.outputs.key }} - restore-keys: ${{ steps.extcache.outputs.key }} + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.phpVersion }} extensions: ${{ env.extensions }} + github-token: ${{ secrets.COMPOSER_GITHUB_TOKEN }} - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' @@ -152,20 +105,6 @@ jobs: if: github.head_ref == '1.2' || github.ref == 'refs/heads/1.2' || github.base_ref == '1.2' run: php ./.github/workflows/utilities/library-switcher "1.2.x-dev as 1.2" - - name: Setup dependency cache - id: composercache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Cache dependencies - uses: actions/cache@v3 - with: - path: ${{ steps.composercache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: ${{ runner.os }}-composer- - - - name: Configure Composer GitHub token - run: composer config --global --auth github-oauth.github.com ${{ secrets.COMPOSER_GITHUB_TOKEN }} - - name: Install Composer dependencies run: composer install --no-interaction --no-progress --no-scripts From ec09b560821bf4d244712383db107066851c333d Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Thu, 24 Jul 2025 13:57:12 +0800 Subject: [PATCH 32/47] Although documented, the "github-token" doesn't exist yet. Cleanup. --- .github/workflows/manifest.yml | 9 +++------ .github/workflows/tests.yml | 19 ++++++------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index 08310eee5c..522a735073 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -15,9 +15,7 @@ jobs: name: Update manifest runs-on: ubuntu-latest env: - phpVersion: "8.4" - extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip - key: winter-cms-cache-develop + GITHUB_TOKEN: ${{ secrets.COMPOSER_GITHUB_TOKEN }} steps: - name: Checkout changes uses: actions/checkout@v4 @@ -25,9 +23,8 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ env.phpVersion }} - extensions: ${{ env.extensions }} - github-token: ${{ secrets.COMPOSER_GITHUB_TOKEN }} + php-version: 8.4 + extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip - name: Install Composer dependencies run: composer install --no-interaction --no-progress --no-scripts diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5197e00469..8f4d629793 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -7,7 +7,6 @@ on: - develop pull_request: - concurrency: group: tests-${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false @@ -22,10 +21,7 @@ jobs: runs-on: ${{ matrix.operatingSystem }} name: ${{ matrix.operatingSystem }} / JavaScript env: - nodeVersion: 16 - phpVersion: '8.2' - extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip - key: winter-cms-cache-develop + GITHUB_TOKEN: ${{ secrets.COMPOSER_GITHUB_TOKEN }} steps: - name: Checkout changes uses: actions/checkout@v4 @@ -33,14 +29,13 @@ jobs: - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: ${{ env.phpVersion }} - extensions: ${{ env.extensions }} - github-token: ${{ secrets.COMPOSER_GITHUB_TOKEN }} + php-version: 8.2 + extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip - name: Install Node uses: actions/setup-node@v3 with: - node-version: ${{ env.nodeVersion }} + node-version: 16 - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' @@ -76,8 +71,7 @@ jobs: runs-on: ${{ matrix.operatingSystem }} name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }} env: - extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip - key: winter-cms-cache-develop + GITHUB_TOKEN: ${{ secrets.COMPOSER_GITHUB_TOKEN }} steps: - name: Checkout changes uses: actions/checkout@v4 @@ -86,8 +80,7 @@ jobs: uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.phpVersion }} - extensions: ${{ env.extensions }} - github-token: ${{ secrets.COMPOSER_GITHUB_TOKEN }} + extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip - name: Switch library dependency (develop) if: github.ref == 'refs/heads/develop' || github.base_ref == 'develop' From 4ac01e83a1a336f92bf6c15a8bb304c93032d48d Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 25 Jul 2025 12:36:06 -0600 Subject: [PATCH 33/47] Fix issue caused by symfony polluting the environment https://github.com/symfony/symfony/pull/53632 made it so that the --silent option is now provided & managed by the symfony core itself which would have been all well and good, except for the fact that since https://github.com/symfony/symfony/pull/24425 symfony has been persisting the selected verbosity layer in the environment. This means that if you have a test that calls a command with the --silent flag set, and then it's followed by a test that relies on the --silent flag not being set, that second test (and any future test that expects the --silent flag not to be set) will also fail. This leads to all sorts of headaches around tests failing depending on the order they are run in, whether or not you're running a single test case or multiple, or even whether the environment you're running the tests in actually supports putenv(). Massive credit to @jaxwilko for finding the issue and coming up with the solution. --- .../system/tests/bootstrap/PluginTestCase.php | 9 +----- modules/system/tests/bootstrap/TestCase.php | 28 ++++++++++++++++++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/modules/system/tests/bootstrap/PluginTestCase.php b/modules/system/tests/bootstrap/PluginTestCase.php index 5acaa26d5e..b78877be37 100644 --- a/modules/system/tests/bootstrap/PluginTestCase.php +++ b/modules/system/tests/bootstrap/PluginTestCase.php @@ -39,11 +39,7 @@ abstract class PluginTestCase extends TestCase */ public function createApplication() { - $app = require __DIR__ . '/../../../../bootstrap/app.php'; - $app->make('Illuminate\Contracts\Console\Kernel')->bootstrap(); - - $app['cache']->setDefaultDriver('array'); - $app->setLocale('en'); + $app = parent::createApplication(); $app->singleton('backend.auth', function ($app) { $app['auth.loaded'] = true; @@ -60,9 +56,6 @@ public function createApplication() $app['config']->set('database.default', 'testing'); } - // Set random encryption key - $app['config']->set('app.key', bin2hex(random_bytes(16))); - // Modify the plugin path away from the test context $app->setPluginsPath(realpath(base_path() . Config::get('cms.pluginsPath'))); diff --git a/modules/system/tests/bootstrap/TestCase.php b/modules/system/tests/bootstrap/TestCase.php index 84784fe14d..d697ef2d04 100644 --- a/modules/system/tests/bootstrap/TestCase.php +++ b/modules/system/tests/bootstrap/TestCase.php @@ -2,8 +2,11 @@ namespace System\Tests\Bootstrap; -use ReflectionClass; +use Illuminate\Contracts\Console\Kernel; +use Illuminate\Contracts\Events\Dispatcher; +use Illuminate\Contracts\Foundation\Application; use PHPUnit\Framework\Assert; +use ReflectionClass; class TestCase extends \Illuminate\Foundation\Testing\TestCase { @@ -24,6 +27,29 @@ public function createApplication() // Set random encryption key $app['config']->set('app.key', bin2hex(random_bytes(16))); + // Override the Kernel call method to prevent symfony shell verbosity breaking scripts. + // @see: https://github.com/symfony/symfony/pull/53632 + // @see: https://github.com/symfony/symfony/pull/24425 + $app->bind(Kernel::class, function (Application $app) { + return new class($app, $app->make(Dispatcher::class)) extends \Winter\Storm\Foundation\Console\Kernel + { + public function call($command, array $parameters = [], $outputBuffer = null) + { + $result = parent::call($command, $parameters, $outputBuffer); + + $shellVerbosity = 0; + + if (\function_exists('putenv')) { + @putenv('SHELL_VERBOSITY=' . $shellVerbosity); + } + + $_ENV['SHELL_VERBOSITY'] = $_SERVER['SHELL_VERBOSITY'] = $shellVerbosity; + + return $result; + } + }; + }); + return $app; } From 6fcddee38f712b52f3d6475a93e8928e9af760d1 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 25 Jul 2025 15:44:53 -0600 Subject: [PATCH 34/47] Ensure parent tearDown is called --- modules/system/tests/console/CreateCommandTest.php | 3 +-- modules/system/tests/console/CreateMigrationTest.php | 9 ++++++--- modules/system/tests/console/WinterUtilTest.php | 3 +-- modules/system/tests/console/asset/mix/MixCreateTest.php | 3 +-- .../system/tests/console/asset/mix/MixInstallTest.php | 3 --- .../system/tests/console/asset/npm/NpmInstallTest.php | 3 --- modules/system/tests/console/asset/npm/NpmUpdateTest.php | 3 --- .../system/tests/console/asset/vite/ViteInstallTest.php | 1 + 8 files changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/system/tests/console/CreateCommandTest.php b/modules/system/tests/console/CreateCommandTest.php index 4bb186ba4a..b65947f17d 100644 --- a/modules/system/tests/console/CreateCommandTest.php +++ b/modules/system/tests/console/CreateCommandTest.php @@ -2,9 +2,8 @@ namespace System\Tests\Console; -use File; -use InvalidArgumentException; use System\Tests\Bootstrap\TestCase; +use Winter\Storm\Support\Facades\File; class CreateCommandTest extends TestCase { diff --git a/modules/system/tests/console/CreateMigrationTest.php b/modules/system/tests/console/CreateMigrationTest.php index 5e3d56d9bd..bac810e607 100644 --- a/modules/system/tests/console/CreateMigrationTest.php +++ b/modules/system/tests/console/CreateMigrationTest.php @@ -2,13 +2,16 @@ namespace System\Tests\Console; -use File; -use Illuminate\Database\Schema\Blueprint; -use Schema; use System\Tests\Bootstrap\PluginTestCase; +use Winter\Storm\Support\Facades\File; +use Winter\Storm\Support\Facades\Schema; class CreateMigrationTest extends PluginTestCase { + protected ?string $versionFile = null; + protected ?string $versionFolder = null; + protected ?string $table = null; + public function setUp(): void { parent::setUp(); diff --git a/modules/system/tests/console/WinterUtilTest.php b/modules/system/tests/console/WinterUtilTest.php index 63c42c2913..f0ecb84d8b 100644 --- a/modules/system/tests/console/WinterUtilTest.php +++ b/modules/system/tests/console/WinterUtilTest.php @@ -2,7 +2,6 @@ namespace System\Tests\Console; -use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Tests\Bootstrap\TestCase; class WinterUtilTest extends TestCase @@ -96,6 +95,6 @@ protected function tearDown(): void $this->artisan('winter:util compile lang')->execute(); - HandleExceptions::flushState(); + parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/mix/MixCreateTest.php b/modules/system/tests/console/asset/mix/MixCreateTest.php index 0e4771b624..5247147269 100644 --- a/modules/system/tests/console/asset/mix/MixCreateTest.php +++ b/modules/system/tests/console/asset/mix/MixCreateTest.php @@ -2,7 +2,6 @@ namespace System\Tests\Console\Asset\Mix; -use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\PluginManager; use System\Tests\Bootstrap\TestCase; use Winter\Storm\Support\Facades\File; @@ -232,6 +231,6 @@ public function tearDown(): void } } - HandleExceptions::flushState(); + parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/mix/MixInstallTest.php b/modules/system/tests/console/asset/mix/MixInstallTest.php index f77249da5a..1494610628 100644 --- a/modules/system/tests/console/asset/mix/MixInstallTest.php +++ b/modules/system/tests/console/asset/mix/MixInstallTest.php @@ -2,7 +2,6 @@ namespace System\Tests\Console\Asset\Mix; -use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\Asset\PackageManager; use System\Tests\Bootstrap\TestCase; use Winter\Storm\Exception\SystemException; @@ -209,8 +208,6 @@ public function tearDown(): void File::delete($this->lockPath); } - HandleExceptions::flushState(); - parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/npm/NpmInstallTest.php b/modules/system/tests/console/asset/npm/NpmInstallTest.php index 581844081b..611ab20df7 100644 --- a/modules/system/tests/console/asset/npm/NpmInstallTest.php +++ b/modules/system/tests/console/asset/npm/NpmInstallTest.php @@ -2,7 +2,6 @@ namespace System\Tests\Console\Asset\Npm; -use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\Asset\PackageManager; use System\Tests\Bootstrap\TestCase; use System\Tests\Console\Asset\NpmTestTrait; @@ -205,8 +204,6 @@ public function tearDown(): void } } - HandleExceptions::flushState(); - parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/npm/NpmUpdateTest.php b/modules/system/tests/console/asset/npm/NpmUpdateTest.php index b04c596614..38b63d9827 100644 --- a/modules/system/tests/console/asset/npm/NpmUpdateTest.php +++ b/modules/system/tests/console/asset/npm/NpmUpdateTest.php @@ -2,7 +2,6 @@ namespace System\tests\console\asset\npm; -use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Classes\Asset\PackageManager; use System\Tests\Bootstrap\TestCase; use System\Tests\Console\Asset\NpmTestTrait; @@ -100,8 +99,6 @@ public function tearDown(): void } } - HandleExceptions::flushState(); - parent::tearDown(); } } diff --git a/modules/system/tests/console/asset/vite/ViteInstallTest.php b/modules/system/tests/console/asset/vite/ViteInstallTest.php index 7d97ccf107..b985a7e397 100644 --- a/modules/system/tests/console/asset/vite/ViteInstallTest.php +++ b/modules/system/tests/console/asset/vite/ViteInstallTest.php @@ -12,6 +12,7 @@ class ViteInstallTest extends TestCase protected string $jsonPath; protected string $lockPath; protected string $backupPath; + protected string $fixturePath; public function setUp(): void { From 3da0830cf5cb7447bd3ed3bdbf6339f45220374c Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 25 Jul 2025 15:56:38 -0600 Subject: [PATCH 35/47] Fix CMS ComponentManagerTest Laravel 12 changed the way that dependencies are injected. See https://laravel.com/docs/12.x/upgrade#container-class-dependency-resolution, https://github.com/laravel/framework/pull/53522 (originally rejected in https://github.com/laravel/framework/issues/33955). Default values are now preferred over resolvable typehints. --- .../fixtures/plugins/winter/tester/components/Comments.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/system/tests/fixtures/plugins/winter/tester/components/Comments.php b/modules/system/tests/fixtures/plugins/winter/tester/components/Comments.php index ab22ce6d41..b13aee80dd 100644 --- a/modules/system/tests/fixtures/plugins/winter/tester/components/Comments.php +++ b/modules/system/tests/fixtures/plugins/winter/tester/components/Comments.php @@ -8,7 +8,7 @@ class Comments extends ComponentBase { private $users; - public function __construct(CodeBase $cmsObject = null, $properties = [], Users $users = null) + public function __construct(?CodeBase $cmsObject = null, $properties = [], Users $users) { parent::__construct($cmsObject, $properties); $this->users = $users; From 29120484de2f5e168db0695f025632f11ccf9737 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 25 Jul 2025 16:23:03 -0600 Subject: [PATCH 36/47] Code style fixes --- modules/cms/classes/ComponentManager.php | 10 ++++++---- .../plugins/winter/tester/components/Comments.php | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/cms/classes/ComponentManager.php b/modules/cms/classes/ComponentManager.php index 5388c53ac4..01858ce7c1 100644 --- a/modules/cms/classes/ComponentManager.php +++ b/modules/cms/classes/ComponentManager.php @@ -1,9 +1,11 @@ -users = $users; From 626a4dd645674b236adf6cb19ea21494a79a59d0 Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Sat, 26 Jul 2025 09:31:30 +0800 Subject: [PATCH 37/47] Use PHP 8.4 for devcontainer --- .devcontainer/Dockerfile | 2 +- .devcontainer/devcontainer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 97448ed0a2..c36fcff488 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM php:8.3-apache-bookworm +FROM php:8.4-apache-bookworm # Install PHP extensions ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index d27806e135..bf35d0cdab 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,7 +1,7 @@ // For format details, see https://aka.ms/devcontainer.json. For config options, see the // README at: https://github.com/devcontainers/templates/tree/main/src/debian { - "name": "Winter on PHP 8.3", + "name": "Winter 1.3 on PHP 8.4", "build": { "dockerfile": "./Dockerfile", "context": "." @@ -13,7 +13,7 @@ "username": "vscode", "userUid": "1000", "userGid": "1000", - "upgradePackages": "true" + "upgradePackages": "false" }, "ghcr.io/devcontainers/features/node:1": { "version": "22" From c41c070803539b980994e3a5dbedc7bf1aeb9ff1 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 25 Jul 2025 21:49:01 -0600 Subject: [PATCH 38/47] Fix tests Skipped tests still run their tearDown() method. Related: https://github.com/sebastianbergmann/phpunit/pull/6281 --- modules/backend/tests/classes/AuthManagerTest.php | 3 +-- modules/system/tests/console/asset/mix/MixInstallTest.php | 8 ++++---- modules/system/tests/console/asset/npm/NpmInstallTest.php | 8 ++++---- modules/system/tests/console/asset/npm/NpmUpdateTest.php | 8 ++++---- .../system/tests/console/asset/vite/ViteInstallTest.php | 8 ++++---- 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/modules/backend/tests/classes/AuthManagerTest.php b/modules/backend/tests/classes/AuthManagerTest.php index a637d4ebcd..a4a528718b 100644 --- a/modules/backend/tests/classes/AuthManagerTest.php +++ b/modules/backend/tests/classes/AuthManagerTest.php @@ -3,7 +3,6 @@ namespace Backend\Tests\Classes; use Backend\Classes\AuthManager; -use Illuminate\Foundation\Bootstrap\HandleExceptions; use System\Tests\Bootstrap\TestCase; use Winter\Storm\Exception\SystemException; @@ -45,7 +44,7 @@ protected function listNewPermissions() public function tearDown(): void { AuthManager::forgetInstance(); - HandleExceptions::flushState(); + parent::tearDown(); } public function testListPermissions() diff --git a/modules/system/tests/console/asset/mix/MixInstallTest.php b/modules/system/tests/console/asset/mix/MixInstallTest.php index 1494610628..9127977153 100644 --- a/modules/system/tests/console/asset/mix/MixInstallTest.php +++ b/modules/system/tests/console/asset/mix/MixInstallTest.php @@ -18,16 +18,16 @@ public function setUp(): void { parent::setUp(); - if (!File::exists(base_path('node_modules'))) { - $this->markTestSkipped('This test requires node_modules to be installed'); - } - // Define some helpful paths $this->fixturePath = base_path('modules/system/tests'); $this->jsonPath = $this->fixturePath . '/package.json'; $this->lockPath = $this->fixturePath . '/package-lock.json'; $this->backupPath = $this->fixturePath . '/package-testing.json'; + if (!File::exists(base_path('node_modules'))) { + $this->markTestSkipped('This test requires node_modules to be installed'); + } + // Add our testing theme because it won't be auto discovered PackageManager::instance()->registerPackage( 'theme-assettest', diff --git a/modules/system/tests/console/asset/npm/NpmInstallTest.php b/modules/system/tests/console/asset/npm/NpmInstallTest.php index 611ab20df7..8b28c57894 100644 --- a/modules/system/tests/console/asset/npm/NpmInstallTest.php +++ b/modules/system/tests/console/asset/npm/NpmInstallTest.php @@ -20,16 +20,16 @@ public function setUp(): void { parent::setUp(); - if (!File::exists(base_path('node_modules'))) { - $this->markTestSkipped('This test requires node_modules to be installed'); - } - // Define some helpful paths $this->themePath = base_path('modules/system/tests/fixtures/themes/npmtest'); $this->jsonPath = $this->themePath . '/package.json'; $this->lockPath = $this->themePath . '/package-lock.json'; $this->backupPath = $this->themePath . '/package.backup.json'; + if (!File::exists(base_path('node_modules'))) { + $this->markTestSkipped('This test requires node_modules to be installed'); + } + // Add our testing theme because it won't be auto discovered PackageManager::instance()->registerPackage( 'theme-npmtest', diff --git a/modules/system/tests/console/asset/npm/NpmUpdateTest.php b/modules/system/tests/console/asset/npm/NpmUpdateTest.php index 38b63d9827..7a509c2847 100644 --- a/modules/system/tests/console/asset/npm/NpmUpdateTest.php +++ b/modules/system/tests/console/asset/npm/NpmUpdateTest.php @@ -20,16 +20,16 @@ public function setUp(): void { parent::setUp(); - if (!File::exists(base_path('node_modules'))) { - $this->markTestSkipped('This test requires node_modules to be installed'); - } - // Define some helpful paths $this->themePath = base_path('modules/system/tests/fixtures/themes/npmtest'); $this->jsonPath = $this->themePath . '/package.json'; $this->lockPath = $this->themePath . '/package-lock.json'; $this->backupPath = $this->themePath . '/package.backup.json'; + if (!File::exists(base_path('node_modules'))) { + $this->markTestSkipped('This test requires node_modules to be installed'); + } + // Add our testing theme because it won't be auto discovered PackageManager::instance()->registerPackage( 'theme-npmtest', diff --git a/modules/system/tests/console/asset/vite/ViteInstallTest.php b/modules/system/tests/console/asset/vite/ViteInstallTest.php index b985a7e397..e2138116bc 100644 --- a/modules/system/tests/console/asset/vite/ViteInstallTest.php +++ b/modules/system/tests/console/asset/vite/ViteInstallTest.php @@ -18,16 +18,16 @@ public function setUp(): void { parent::setUp(); - if (!File::exists(base_path('node_modules'))) { - $this->markTestSkipped('This test requires node_modules to be installed'); - } - // Define some helpful paths $this->fixturePath = base_path('modules/system/tests'); $this->jsonPath = $this->fixturePath . '/package.json'; $this->lockPath = $this->fixturePath . '/package-lock.json'; $this->backupPath = $this->fixturePath . '/package-testing.json'; + if (!File::exists(base_path('node_modules'))) { + $this->markTestSkipped('This test requires node_modules to be installed'); + } + // Add our testing theme because it won't be auto discovered PackageManager::instance()->registerPackage( 'theme-assettest', From c4cc0263aa8684f3a7e5df299d5af93724e98ea8 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 25 Jul 2025 22:25:38 -0700 Subject: [PATCH 39/47] Update .github/workflows/tests.yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8f4d629793..c77050a41f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,7 +9,7 @@ on: concurrency: group: tests-${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: false + cancel-in-progress: true jobs: frontendTests: From 2a61061decd030fc8f7e3dffb5b409bc68654ebd Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 25 Jul 2025 23:33:50 -0600 Subject: [PATCH 40/47] Remove support for PHPUnit < 11 --- .../system/console/scaffold/test/phpunit.stub | 12 ++---- modules/system/tests/bootstrap/TestCase.php | 41 +++---------------- phpunit.xml | 4 -- 3 files changed, 9 insertions(+), 48 deletions(-) diff --git a/modules/system/console/scaffold/test/phpunit.stub b/modules/system/console/scaffold/test/phpunit.stub index e7877ce389..e1ab1fedca 100644 --- a/modules/system/console/scaffold/test/phpunit.stub +++ b/modules/system/console/scaffold/test/phpunit.stub @@ -1,13 +1,7 @@ - diff --git a/modules/system/tests/bootstrap/TestCase.php b/modules/system/tests/bootstrap/TestCase.php index d697ef2d04..dd324fe061 100644 --- a/modules/system/tests/bootstrap/TestCase.php +++ b/modules/system/tests/bootstrap/TestCase.php @@ -85,55 +85,26 @@ public static function setProtectedProperty($object, $name, $value) } /** - * Stub for `assertFileNotExists` to allow compatibility with both PHPUnit 8 and 9. - * - * @param string $filename - * @param string $message - * @return void + * Stub for `assertFileNotExists` */ public static function assertFileNotExists(string $filename, string $message = ''): void { - if (method_exists(Assert::class, 'assertFileDoesNotExist')) { - Assert::assertFileDoesNotExist($filename, $message); - return; - } - - Assert::assertFileNotExists($filename, $message); + Assert::assertFileDoesNotExist($filename, $message); } /** - * Stub for `assertRegExp` to allow compatibility with both PHPUnit 8 and 9. - * - * @param string $pattern - * @param string $string - * @param string $message - * @return void + * Stub for `assertRegExp` */ public static function assertRegExp(string $pattern, string $string, string $message = ''): void { - if (method_exists(Assert::class, 'assertMatchesRegularExpression')) { - Assert::assertMatchesRegularExpression($pattern, $string, $message); - return; - } - - Assert::assertRegExp($pattern, $string, $message); + Assert::assertMatchesRegularExpression($pattern, $string, $message); } /** - * Stub for `assertObjectHasAttribute` to allow compatibility with both PHPUnit 9 and 10. - * - * @param string $propertyName - * @param object $object - * @param string $message - * @return void + * Stub for `assertObjectHasAttribute` */ public static function assertObjectHasAttribute(string $propertyName, $object, string $message = ''): void { - if (method_exists(Assert::class, 'assertObjectHasProperty')) { - Assert::assertObjectHasProperty($propertyName, $object, $message); - return; - } - - Assert::assertObjectHasAttribute($propertyName, $object, $message); + Assert::assertObjectHasProperty($propertyName, $object, $message); } } diff --git a/phpunit.xml b/phpunit.xml index ffb9f4bfbf..a53e3ba0c2 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,12 +1,8 @@ From 8093c30709e41ce0eb32d337358327cc41220352 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sun, 27 Jul 2025 23:18:56 -0600 Subject: [PATCH 41/47] L12 changes to config/app.php --- config/app.php | 53 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/config/app.php b/config/app.php index e4a78cb57e..812bd0942f 100644 --- a/config/app.php +++ b/config/app.php @@ -2,6 +2,32 @@ return [ + /* + |-------------------------------------------------------------------------- + | Application Name + |-------------------------------------------------------------------------- + | + | This value is the name of your application. This value is used when the + | framework needs to place the application's name in a notification or + | any other location as required by the application or its packages. + | + */ + + 'name' => env('APP_NAME', 'Winter CMS'), + + /* + |-------------------------------------------------------------------------- + | Application Environment + |-------------------------------------------------------------------------- + | + | This value determines the "environment" your application is currently + | running in. This may determine how you prefer to configure various + | services the application utilizes. Set this in your ".env" file. + | + */ + + 'env' => env('APP_ENV', 'production'), + /* |-------------------------------------------------------------------------- | Application Debug Mode @@ -20,20 +46,7 @@ | */ - 'debug' => env('APP_DEBUG', true), - - /* - |-------------------------------------------------------------------------- - | Application Name - |-------------------------------------------------------------------------- - | - | This value is the name of your application. This value is used when the - | framework needs to place the application's name in a notification or - | any other location as required by the application or its packages. - | - */ - - 'name' => env('APP_NAME', 'Winter CMS'), + 'debug' => (bool) env('APP_DEBUG', true), /* |-------------------------------------------------------------------------- @@ -42,7 +55,7 @@ | | This URL is used by the console to properly generate URLs when using | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. + | the application so that it's available within Artisan commands. | */ @@ -183,7 +196,6 @@ | will be used by the PHP date and date-time functions. We have gone | ahead and set this to a sensible default for you out of the box. | - | | -------- STOP! -------- | Before you change this value, consider carefully if that is actually | what you want to do. It is HIGHLY recommended that this is always set @@ -264,9 +276,16 @@ | */ - 'key' => env('APP_KEY'), 'cipher' => 'AES-256-CBC', + 'key' => env('APP_KEY'), + + 'previous_keys' => [ + ...array_filter( + explode(',', (string) env('APP_PREVIOUS_KEYS', '')) + ), + ], + /* |-------------------------------------------------------------------------- | Autoloaded Service Providers From 7513797a0e5f972474bdc5ab14052ffe86387704 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Sun, 27 Jul 2025 23:19:13 -0600 Subject: [PATCH 42/47] Support testing all plugins or all modules --- modules/system/console/WinterTest.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/system/console/WinterTest.php b/modules/system/console/WinterTest.php index afd6afe940..0c5846fae4 100644 --- a/modules/system/console/WinterTest.php +++ b/modules/system/console/WinterTest.php @@ -104,6 +104,9 @@ public function handle() foreach (['module', 'plugin'] as $type) { if ($this->option($type)) { foreach ($this->option($type) as $target) { + if (empty($target)) { + continue; + } $target = strtolower($target); if (!isset($configs[$type . 's'][$target])) { throw new ApplicationException(sprintf( @@ -126,7 +129,14 @@ public function handle() } // default to running all defined configs found - foreach (['modules', 'plugins'] as $type) { + $types = [ + 'modules' => count($this->option('module')), + 'plugins' => count($this->option('plugin')), + ]; + foreach ($types as $type => $count) { + if (!$count) { + continue; + } foreach ($configs[$type] as $name => $config) { $this->info( $type === 'plugins' From 64c1a41a82833df9ccefa26896e7152edf013a66 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 9 Sep 2025 13:56:55 -0400 Subject: [PATCH 43/47] use Arr::first method directly --- modules/backend/controllers/Index.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/backend/controllers/Index.php b/modules/backend/controllers/Index.php index 8b6abed758..ddffeccf42 100644 --- a/modules/backend/controllers/Index.php +++ b/modules/backend/controllers/Index.php @@ -6,6 +6,8 @@ use Backend\Classes\Controller; use Backend\Widgets\ReportContainer; +use Winter\Storm\Support\Arr; + /** * Dashboard controller * @@ -75,7 +77,7 @@ protected function checkPermissionRedirect() $true = function () { return true; }; - if ($first = array_first(BackendMenu::listMainMenuItems(), $true)) { + if ($first = Arr::first(BackendMenu::listMainMenuItems(), $true)) { return Redirect::intended($first->url); } return Backend::redirect('backend/users/myaccount'); From 497d518440f4c7103a29714b765b1b0dc92780c1 Mon Sep 17 00:00:00 2001 From: Marc Jauvin Date: Tue, 9 Sep 2025 14:23:48 -0400 Subject: [PATCH 44/47] remove useless callback --- modules/backend/controllers/Index.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/modules/backend/controllers/Index.php b/modules/backend/controllers/Index.php index ddffeccf42..aad9782de2 100644 --- a/modules/backend/controllers/Index.php +++ b/modules/backend/controllers/Index.php @@ -74,10 +74,7 @@ protected function initReportContainer() protected function checkPermissionRedirect() { if (!$this->user->hasAccess('backend.access_dashboard')) { - $true = function () { - return true; - }; - if ($first = Arr::first(BackendMenu::listMainMenuItems(), $true)) { + if ($first = Arr::first(BackendMenu::listMainMenuItems())) { return Redirect::intended($first->url); } return Backend::redirect('backend/users/myaccount'); From 83ff1cb2f411dfc100e72cd0b955433be6a01f86 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 15 Oct 2025 15:00:26 -0600 Subject: [PATCH 45/47] Delete .devcontainer/Dockerfile --- .devcontainer/Dockerfile | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 .devcontainer/Dockerfile diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index c36fcff488..0000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,9 +0,0 @@ -FROM php:8.4-apache-bookworm - -# Install PHP extensions -ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/ - -RUN install-php-extensions @composer gd intl zip xdebug - -# Enable Apache2 rewrite module -RUN a2enmod rewrite From 58057d0c5060d1221ac39c232b517a2b4e1226bb Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Wed, 19 Nov 2025 15:25:41 -0600 Subject: [PATCH 46/47] Allow running winter:test with no options --- modules/system/console/WinterTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/system/console/WinterTest.php b/modules/system/console/WinterTest.php index 0c5846fae4..5a96ead94c 100644 --- a/modules/system/console/WinterTest.php +++ b/modules/system/console/WinterTest.php @@ -128,10 +128,10 @@ public function handle() return $exitCode; } - // default to running all defined configs found + // default to running all defined configs found, run all tests if no options provided $types = [ - 'modules' => count($this->option('module')), - 'plugins' => count($this->option('plugin')), + 'modules' => count($this->option('module')) + !$this->option('plugin'), + 'plugins' => count($this->option('plugin')) + !$this->option('module'), ]; foreach ($types as $type => $count) { if (!$count) { From 01e205219cd49ecd04d0eaa0ac0ce195fe0fd067 Mon Sep 17 00:00:00 2001 From: Damien MATHIEU Date: Fri, 2 Jan 2026 07:58:12 +0100 Subject: [PATCH 47/47] Add env calls to app.locale, fallback_locale, faker_locale (#1434) --- config/app.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/app.php b/config/app.php index 812bd0942f..e1ec05c6eb 100644 --- a/config/app.php +++ b/config/app.php @@ -237,7 +237,7 @@ | */ - 'locale' => 'en', + 'locale' => env('APP_LOCALE', 'en'), /* |-------------------------------------------------------------------------- @@ -250,7 +250,7 @@ | */ - 'fallback_locale' => 'en', + 'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'), /* |-------------------------------------------------------------------------- @@ -263,7 +263,7 @@ | */ - 'faker_locale' => 'en_US', + 'faker_locale' => env('APP_FAKER_LOCALE', 'en_US'), /* |--------------------------------------------------------------------------