Skip to content

Commit

Permalink
Merge pull request #1041 from ArlonHelps/feature/laravel-9-backward
Browse files Browse the repository at this point in the history
[5.x] Add Laravel 9 Support back to 5.X
  • Loading branch information
ArlonAntonius authored Aug 18, 2023
2 parents d89a596 + 29eebfb commit 2beff8f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ references:

mysql: &mysql
image: mysql:latest
entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
entrypoint: ['/usr/local/bin/docker-entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
name: mysql
environment: *mysql_environment
mysql2: &mysql2
image: mysql:latest
entrypoint: ['/entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
entrypoint: ['/usr/local/bin/docker-entrypoint.sh', '--default-authentication-plugin=mysql_native_password']
name: mysql2
environment: *mysql_environment
mariadb: &mariadb
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
"php": "^8.0",
"doctrine/dbal": "~2.5|~3.0",
"ramsey/uuid": "^4.0",
"laravel/framework": "^10.0"
"laravel/framework": "^9.0|^10.0"
},
"require-dev": {
"fakerphp/faker": "^1.12",
"laravel/laravel": "^10.0",
"laravel/laravel": "^9.0|^10.0",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^9.0",
"symfony/dom-crawler": "~3.1"
Expand Down
6 changes: 5 additions & 1 deletion tests/unit-tests/Filesystem/LoadsTranslationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ protected function duringSetUp(Application $app)
$this->directory = $app->make(Directory::class);
$this->directory->setWebsite($this->website);

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

/**
Expand Down
69 changes: 55 additions & 14 deletions tests/unit-tests/Repositories/HostnameRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,28 +132,69 @@ public function hostname_delete()

$this->assertFalse($this->hostname->exists);
}

/**
* @test
* @dataProvider matchHostnames
*/
public function hostname_regex_validation_matches(string $hostname)
{
$this->hostname->fqdn = $hostname;
$this->hostnames->create($this->hostname);
$this->assertTrue($this->hostname->exists);
}

/**
* @test
* @dataProvider noMatchHostnames
*/
public function hostname_regex_validation()
public function hostname_regex_validation_no_matches(string $hostname)
{
$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"];
$nomatchhostnames = ["-0-0O.COM","0-0O.-COM","-a.dot","a-1234567890-1234567890-1234567890-1234567890-1234567890-12345-z.eu.us"];
foreach ($matchhostnames as $hostname) {
$this->hostname->fqdn = $hostname;
$this->hostname->fqdn = $hostname;
try {
$this->hostnames->create($this->hostname);
$this->assertTrue($this->hostname->exists);
}
foreach ($nomatchhostnames as $hostname) {
$this->hostname->fqdn = $hostname;
try {
$this->hostnames->create($this->hostname);
} catch (ModelValidationException $e) {
$this->assertStringContainsString("The fqdn field format is invalid.", $e->getMessage());
}
} catch (ModelValidationException $e) {
$this->assertStringContainsString(" fqdn ", $e->getMessage());
$this->assertStringContainsString("is invalid.", $e->getMessage());
}
}

protected function matchHostnames(): array
{
return [
["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"],
];
}

protected function noMatchHostnames(): array
{
return [
["-0-0O.COM"],
["0-0O.-COM"],
["-a.dot"],
["a-1234567890-1234567890-1234567890-1234567890-1234567890-12345-z.eu.us"]
];
}

protected function duringSetUp(Application $app)
{
$this->setUpWebsites();
Expand Down

0 comments on commit 2beff8f

Please sign in to comment.