Skip to content

Commit 2beff8f

Browse files
Merge pull request #1041 from ArlonHelps/feature/laravel-9-backward
[5.x] Add Laravel 9 Support back to 5.X
2 parents d89a596 + 29eebfb commit 2beff8f

File tree

4 files changed

+64
-19
lines changed

4 files changed

+64
-19
lines changed

.circleci/config.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ references:
3838

3939
mysql: &mysql
4040
image: mysql:latest
41-
entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
41+
entrypoint: ['/usr/local/bin/docker-entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
4242
name: mysql
4343
environment: *mysql_environment
4444
mysql2: &mysql2
4545
image: mysql:latest
46-
entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
46+
entrypoint: ['/usr/local/bin/docker-entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
4747
name: mysql2
4848
environment: *mysql_environment
4949
mariadb: &mariadb

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
"php": "^8.0",
2727
"doctrine/dbal": "~2.5|~3.0",
2828
"ramsey/uuid": "^4.0",
29-
"laravel/framework": "^10.0"
29+
"laravel/framework": "^9.0|^10.0"
3030
},
3131
"require-dev": {
3232
"fakerphp/faker": "^1.12",
33-
"laravel/laravel": "^10.0",
33+
"laravel/laravel": "^9.0|^10.0",
3434
"mockery/mockery": "^1.0",
3535
"phpunit/phpunit": "^9.0",
3636
"symfony/dom-crawler": "~3.1"

tests/unit-tests/Filesystem/LoadsTranslationsTest.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ protected function duringSetUp(Application $app)
3333
$this->directory = $app->make(Directory::class);
3434
$this->directory->setWebsite($this->website);
3535

36-
$this->artisan('lang:publish');
36+
try {
37+
$this->artisan('lang:publish');
38+
} catch (\Exception $e) {
39+
// Laravel 9 will throw an exception because the command does not exist.
40+
}
3741
}
3842

3943
/**

tests/unit-tests/Repositories/HostnameRepositoryTest.php

+55-14
Original file line numberDiff line numberDiff line change
@@ -132,28 +132,69 @@ public function hostname_delete()
132132

133133
$this->assertFalse($this->hostname->exists);
134134
}
135+
136+
/**
137+
* @test
138+
* @dataProvider matchHostnames
139+
*/
140+
public function hostname_regex_validation_matches(string $hostname)
141+
{
142+
$this->hostname->fqdn = $hostname;
143+
$this->hostnames->create($this->hostname);
144+
$this->assertTrue($this->hostname->exists);
145+
}
146+
135147
/**
136148
* @test
149+
* @dataProvider noMatchHostnames
137150
*/
138-
public function hostname_regex_validation()
151+
public function hostname_regex_validation_no_matches(string $hostname)
139152
{
140-
$matchhostnames = ["xn-fsqu00a.xn-0zwm56d","xn-fsqu00a.xn--vermgensberatung-pwb","xn--stackoverflow.com","stackoverflow.xn--com","stackoverflow.co.uk","google.com.au","i.oh1.me","wow.british-library.uk","xn--stackoverflow.com","stackoverflow.xn--com","stackoverflow.co.uk","0-0O_.COM","a.net","0-0O.COM","0-OZ.CO.uk","0-TENSION.COM.br","0-WH-AO14-0.COM-com.net","a-1234567890-1234567890-1234567890-1234567890-1234567890-1234-z.eu.us","subA.subB.subC.example.com","*.subA.subB.example.com"];
141-
$nomatchhostnames = ["-0-0O.COM","0-0O.-COM","-a.dot","a-1234567890-1234567890-1234567890-1234567890-1234567890-12345-z.eu.us"];
142-
foreach ($matchhostnames as $hostname) {
143-
$this->hostname->fqdn = $hostname;
153+
$this->hostname->fqdn = $hostname;
154+
try {
144155
$this->hostnames->create($this->hostname);
145-
$this->assertTrue($this->hostname->exists);
146-
}
147-
foreach ($nomatchhostnames as $hostname) {
148-
$this->hostname->fqdn = $hostname;
149-
try {
150-
$this->hostnames->create($this->hostname);
151-
} catch (ModelValidationException $e) {
152-
$this->assertStringContainsString("The fqdn field format is invalid.", $e->getMessage());
153-
}
156+
} catch (ModelValidationException $e) {
157+
$this->assertStringContainsString(" fqdn ", $e->getMessage());
158+
$this->assertStringContainsString("is invalid.", $e->getMessage());
154159
}
155160
}
156161

162+
protected function matchHostnames(): array
163+
{
164+
return [
165+
["xn-fsqu00a.xn-0zwm56d"],
166+
["xn-fsqu00a.xn--vermgensberatung-pwb"],
167+
["xn--stackoverflow.com"],
168+
["stackoverflow.xn--com"],
169+
["stackoverflow.co.uk"],
170+
["google.com.au"],
171+
["i.oh1.me"],
172+
["wow.british-library.uk"],
173+
["xn--stackoverflow.com"],
174+
["stackoverflow.xn--com"],
175+
["stackoverflow.co.uk"],
176+
["0-0O_.COM"],
177+
["a.net"],
178+
["0-0O.COM"],
179+
["0-OZ.CO.uk"],
180+
["0-TENSION.COM.br"],
181+
["0-WH-AO14-0.COM-com.net"],
182+
["a-1234567890-1234567890-1234567890-1234567890-1234567890-1234-z.eu.us"],
183+
["subA.subB.subC.example.com"],
184+
["*.subA.subB.example.com"],
185+
];
186+
}
187+
188+
protected function noMatchHostnames(): array
189+
{
190+
return [
191+
["-0-0O.COM"],
192+
["0-0O.-COM"],
193+
["-a.dot"],
194+
["a-1234567890-1234567890-1234567890-1234567890-1234567890-12345-z.eu.us"]
195+
];
196+
}
197+
157198
protected function duringSetUp(Application $app)
158199
{
159200
$this->setUpWebsites();

0 commit comments

Comments
 (0)