Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Laravel 11 migration #1094

Open
wants to merge 30 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8480334
Laravel 10 changes
wverhoogt Apr 3, 2024
b56be78
update composer for laravel-11
mjauvin Apr 3, 2024
a506d96
update to laravel 11 in modules composer.json files
mjauvin Apr 3, 2024
18cd000
add temporary alias to fix PHPUnit class naming
mjauvin Apr 3, 2024
1b3bae8
update test php versions
mjauvin Apr 4, 2024
51c97a3
update library versions temporarily
mjauvin Apr 4, 2024
83660ff
adjust test for Laravel 11 changes
mjauvin Apr 4, 2024
c79f260
remove minimum-stability from composer.json and add config.hashing.re…
mjauvin Apr 4, 2024
2d8795d
add phpunit; update dms/phpunit-arraysubset-asserts version
mjauvin Apr 15, 2024
726825d
migrate phpunit.xml files
mjauvin Apr 15, 2024
23770c9
dependency test
mjauvin Apr 15, 2024
66778f7
revert to wip-laravel-11 branch for now
mjauvin Apr 15, 2024
b5ecc38
add SQLite minimum requirement to winter:install
mjauvin Apr 16, 2024
13e5120
use version_compare() method
mjauvin Apr 16, 2024
9fa1cf1
remove phpunit alias; fix deprecation warnings in tests
mjauvin Apr 16, 2024
f098458
test library switcher
mjauvin Apr 16, 2024
d46c368
Revert "test library switcher"
mjauvin Apr 16, 2024
f943343
verify SQLite db version requirement in UpdateManager::update()
mjauvin Apr 16, 2024
924d57e
force twig version 3.8.x until we fix the issue introduced in 3.9.x
mjauvin Apr 16, 2024
2953731
expand tabs
mjauvin Apr 16, 2024
eb2dc00
Merge branch 'develop' into wip-laravel-11
mjauvin May 14, 2024
4076d17
Merge branch 'develop' into wip-laravel-11
mjauvin Jul 3, 2024
8c38ed7
Merge branch 'develop' into wip-laravel-11
mjauvin Jul 3, 2024
4ba55dc
use latest 3.x twig
mjauvin Sep 15, 2024
e099f7f
remove twig dependency, already in storm
mjauvin Sep 15, 2024
e9b4a0a
Merge branch 'develop' into wip-laravel-11
jaxwilko Sep 20, 2024
ea440b8
Merge branch 'develop' into wip-laravel-11
LukeTowers Sep 26, 2024
c6e1209
Merge branch 'develop' into wip-laravel-11
mjauvin Oct 5, 2024
de72b46
Merge branch 'develop' into merge-develop
mjauvin Oct 21, 2024
059c4c5
Merge branch 'develop' into wip-laravel-11
mjauvin Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: ${{ matrix.operatingSystem }} / JavaScript
env:
nodeVersion: 16
phpVersion: '8.0'
phpVersion: '8.2'
extensions: curl, fileinfo, gd, mbstring, openssl, pdo, pdo_sqlite, sqlite3, xml, zip
key: winter-cms-cache-develop
steps:
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
max-parallel: 8
matrix:
operatingSystem: [ubuntu-latest, windows-latest]
phpVersion: ['8.0', '8.1', '8.2', '8.3']
phpVersion: ['8.2', '8.3']
fail-fast: false
runs-on: ${{ matrix.operatingSystem }}
name: ${{ matrix.operatingSystem }} / PHP ${{ matrix.phpVersion }}
Expand Down Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ composer.lock
selenium.php
/bootstrap/compiled.php
.phpunit.result.cache
.phpunit.cache

# Hosting ignores
php_errors.log
Expand All @@ -26,6 +27,7 @@ nbproject
.vscode
!.devcontainer/.vscode
_ide_helper.php
*.code-workspace

# Other ignores
.DS_Store
Expand Down
17 changes: 8 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@
"source": "https://github.com/wintercms/winter"
},
"require": {
"php": "^8.0.2",
"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",
"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",
"laravel/framework": "^11.0",
"wikimedia/composer-merge-plugin": "~2.1.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5.8",
"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": [
Expand All @@ -65,7 +65,6 @@
"phpcs --colors -nq --report=\"full\" --extensions=\"php\""
]
},
"minimum-stability": "dev",
"prefer-stable": true,
"extra": {
"merge-plugin": {
Expand Down
13 changes: 13 additions & 0 deletions config/hashing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
4 changes: 2 additions & 2 deletions modules/backend/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
}
],
"require": {
"php": "^8.0.2",
"php": "^8.2",
"composer/installers": "~1.11.0",
"laravel/framework": "^9.1"
"laravel/framework": "^11.0"
},
"replace": {
"october/backend": "1.1.*"
Expand Down
19 changes: 9 additions & 10 deletions modules/backend/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
backupStaticProperties="false"
cacheDirectory=".phpunit.cache"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
>
<testsuites>
<testsuite name="Winter Backend Module">
<directory>./tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Winter Backend Module">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
4 changes: 2 additions & 2 deletions modules/cms/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
}
],
"require": {
"php": "^8.0.2",
"php": "^8.2",
"composer/installers": "~1.11.0",
"laravel/framework": "^9.1"
"laravel/framework": "^11.0"
},
"replace": {
"october/cms": "1.1.*"
Expand Down
19 changes: 9 additions & 10 deletions modules/cms/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
backupStaticProperties="false"
cacheDirectory=".phpunit.cache"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
>
<testsuites>
<testsuite name="Winter CMS Module">
<directory>./tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Winter CMS Module">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion modules/cms/tests/classes/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
7 changes: 7 additions & 0 deletions modules/system/classes/UpdateManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions modules/system/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
}
],
"require": {
"php": "^8.0.2",
"php": "^8.2",
"composer/installers": "~1.11.0",
"laravel/framework": "^9.1",
"laravel/framework": "^11.0",
"composer/semver": "^3.2"
},
"replace": {
Expand Down
1 change: 1 addition & 0 deletions modules/system/console/WinterInstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions modules/system/console/WinterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}
';

/**
Expand Down
19 changes: 9 additions & 10 deletions modules/system/phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
backupStaticProperties="false"
cacheDirectory=".phpunit.cache"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
>
<testsuites>
<testsuite name="Winter System Module">
<directory>./tests</directory>
</testsuite>
</testsuites>
<testsuites>
<testsuite name="Winter System Module">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
21 changes: 20 additions & 1 deletion modules/system/tests/bootstrap/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -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);
}
}
4 changes: 2 additions & 2 deletions modules/system/tests/classes/MediaLibraryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function tearDown(): void
parent::tearDown();
}

public function invalidPathsProvider()
public static function invalidPathsProvider()
{
return [
['./file'],
Expand All @@ -36,7 +36,7 @@ public function invalidPathsProvider()
];
}

public function validPathsProvider()
public static function validPathsProvider()
{
return [
['file'],
Expand Down
2 changes: 1 addition & 1 deletion modules/system/tests/classes/VersionManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function testExtractScriptsAndComments($versionInfo, $expectedComments, $
$this->assertEquals($expectedScripts, $scripts);
}

public function versionInfoProvider()
public static function versionInfoProvider()
{
return [
[
Expand Down
Loading
Loading