Skip to content

Commit f763434

Browse files
Upgrade laravel backup 9 + laravel 12 (#17)
* Upgrade laravel backup 9 + laravel 12 * Apply fixes from StyleCI (#19)
1 parent 17f6523 commit f763434

File tree

12 files changed

+72
-66
lines changed

12 files changed

+72
-66
lines changed

.claude/settings.local.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(./vendor/bin/phpunit --migrate-configuration)",
5+
"Bash(./vendor/bin/phpunit --display-all-issues)"
6+
]
7+
},
8+
"enableAllProjectMcpServers": false
9+
}

.github/workflows/test.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ name: Run tests
22

33
on:
44
push:
5-
schedule:
6-
- cron: '0 0 * * *'
75

86
jobs:
97
test:
108
runs-on: ubuntu-latest
119

1210
services:
1311
mysql:
14-
image: mysql:5.7
12+
image: mysql:8.0
1513
env:
1614
MYSQL_DATABASE: laravel_backup_sql_check
1715
MYSQL_ROOT_PASSWORD: root
@@ -22,15 +20,15 @@ jobs:
2220
strategy:
2321
fail-fast: false
2422
matrix:
25-
php: [8.0,8.1]
26-
laravel: [8.*,9.*]
27-
dependency-version: [prefer-lowest,prefer-stable]
23+
php: [8.2, 8.3, 8.4]
24+
laravel: [10.*, 11.*, 12.*]
25+
dependency-version: [prefer-lowest, prefer-stable]
2826

2927
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
3028

3129
steps:
3230
- name: Checkout code
33-
uses: actions/checkout@v1
31+
uses: actions/checkout@v4
3432

3533
- name: Setup PHP
3634
uses: shivammathur/setup-php@v2

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ composer.phar
33
composer.lock
44
vendor
55
.env
6-
.phpunit.result.cache
6+
.phpunit.result.cache
7+
.phpunit.cache

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
"name": "makeabledk/laravel-backup-sql-check",
33
"license": "CC-BY-SA-4.0",
44
"require": {
5-
"php": "^8.0",
6-
"symfony/process": "^5.0|^6.0"
5+
"php": "^8.2",
6+
"symfony/process": "^6.0|^7.0"
77
},
88
"require-dev": {
9-
"spatie/laravel-backup": "^7.0|^8.0",
10-
"laravel/laravel": "^8.6.10|^9.0",
11-
"phpunit/phpunit": "^9.0",
12-
"orchestra/testbench": "^6.0",
13-
"mockery/mockery": "^1.5"
9+
"spatie/laravel-backup": "^9.0",
10+
"laravel/laravel": "^10.0|^11.0|^12.0",
11+
"phpunit/phpunit": "^10.0|^11.0",
12+
"orchestra/testbench": "^8.0|^9.0|^10.0",
13+
"mockery/mockery": "^1.6"
1414
},
1515
"autoload": {
1616
"psr-4": {

phpunit.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3-
<coverage>
4-
<include>
5-
<directory suffix=".php">src/</directory>
6-
</include>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
83
<testsuites>
94
<testsuite name="Package Test Suite">
105
<directory suffix="Test.php">./tests/</directory>
@@ -13,4 +8,9 @@
138
<php>
149
<ini name="display_errors" value="1"/>
1510
</php>
11+
<source>
12+
<include>
13+
<directory suffix=".php">src/</directory>
14+
</include>
15+
</source>
1616
</phpunit>

src/DbImporter/Databases/MySqlImporter.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ class MySqlImporter extends DbImporter
2222
protected $dbCollation;
2323

2424
/**
25-
* @param $databaseName
26-
* @param $dumpFile
27-
* @param $timeout
25+
* @param $databaseName
26+
* @param $dumpFile
27+
* @param $timeout
2828
* @return mixed|void
2929
*
3030
* @throws DatabaseImportFailed
@@ -39,7 +39,7 @@ public function createDatabaseFromFile($databaseName, $dumpFile, $timeout)
3939
}
4040

4141
/**
42-
* @param $databaseName
42+
* @param $databaseName
4343
* @return mixed|void
4444
*
4545
* @throws DatabaseImportFailed
@@ -52,7 +52,7 @@ public function dropDatabase($databaseName)
5252
}
5353

5454
/**
55-
* @param $dbCharset
55+
* @param $dbCharset
5656
* @return $this
5757
*/
5858
public function setDbCharset($dbCharset)
@@ -63,7 +63,7 @@ public function setDbCharset($dbCharset)
6363
}
6464

6565
/**
66-
* @param $dbCollation
66+
* @param $dbCollation
6767
* @return $this
6868
*/
6969
public function setDbCollation($dbCollation)
@@ -74,7 +74,7 @@ public function setDbCollation($dbCollation)
7474
}
7575

7676
/**
77-
* @param $file
77+
* @param $file
7878
* @return mixed
7979
*
8080
* @throws DatabaseImportFailed
@@ -95,10 +95,10 @@ protected function configureCredentials($file)
9595
}
9696

9797
/**
98-
* @param $databaseName
99-
* @param $file
100-
* @param $credentials
101-
* @param $timeout
98+
* @param $databaseName
99+
* @param $file
100+
* @param $credentials
101+
* @param $timeout
102102
*
103103
* @throws DatabaseImportFailed
104104
*/
@@ -116,8 +116,8 @@ protected function createDatabase($databaseName, $file, $credentials, $timeout)
116116
}
117117

118118
/**
119-
* @param $databaseName
120-
* @param $credentials
119+
* @param $databaseName
120+
* @param $credentials
121121
*
122122
* @throws DatabaseImportFailed
123123
*/
@@ -131,9 +131,9 @@ protected function checkIfImportWasSuccessful($databaseName, $credentials)
131131
}
132132

133133
/**
134-
* @param $mysqlCommands
135-
* @param $credentialsFile
136-
* @param $timeout
134+
* @param $mysqlCommands
135+
* @param $credentialsFile
136+
* @param $timeout
137137
* @return Process
138138
*
139139
* @throws DatabaseImportFailed

src/DbImporter/DbImporter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ abstract class DbImporter
3535
protected $compressor = null;
3636

3737
/**
38-
* @param $databaseName
39-
* @param $dumpFile
40-
* @param $timeout
38+
* @param $databaseName
39+
* @param $dumpFile
40+
* @param $timeout
4141
* @return mixed
4242
*/
4343
abstract public function createDatabaseFromFile($databaseName, $dumpFile, $timeout);
4444

4545
/**
46-
* @param $databaseName
46+
* @param $databaseName
4747
* @return mixed
4848
*/
4949
abstract public function dropDatabase($databaseName);

src/DbImporter/DbImporterFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class DbImporterFactory
1010
{
1111
/**
12-
* @param $dbConnectionName
12+
* @param $dbConnectionName
1313
* @return DbImporter
1414
*
1515
* @throws Exception
@@ -43,7 +43,7 @@ public static function createFromConnection($dbConnectionName)
4343
}
4444

4545
/**
46-
* @param $dbDriver
46+
* @param $dbDriver
4747
* @return MysqlImporter
4848
*
4949
* @throws Exception

src/DbImporter/Exceptions/DatabaseImportFailed.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class DatabaseImportFailed extends Exception
99
{
1010
/**
11-
* @param $name
11+
* @param $name
1212
* @return DatabaseImportFailed
1313
*/
1414
public static function missingCredentials($name)
@@ -34,7 +34,7 @@ public static function databaseWasNotCreated()
3434
}
3535

3636
/**
37-
* @param $showTablesOutput
37+
* @param $showTablesOutput
3838
* @return DatabaseImportFailed
3939
*/
4040
public static function databaseWasEmpty($showTablesOutput)
@@ -51,7 +51,7 @@ public static function previouslyFailed()
5151
}
5252

5353
/**
54-
* @param $timeout
54+
* @param $timeout
5555
* @return DatabaseImportFailed
5656
*/
5757
public static function timeoutExceeded($timeout)
@@ -60,8 +60,8 @@ public static function timeoutExceeded($timeout)
6060
}
6161

6262
/**
63-
* @param $available
64-
* @param $required
63+
* @param $available
64+
* @param $required
6565
* @return DatabaseImportFailed
6666
*/
6767
public static function insufficientDiskSpace($available, $required)

src/HealthySqlDump.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct(float $timeout = 60)
3636
* @throws \Spatie\Backup\Exceptions\InvalidHealthCheck
3737
* @throws \Throwable
3838
*/
39-
public function checkHealth(BackupDestination $backupDestination)
39+
public function checkHealth(BackupDestination $backupDestination): void
4040
{
4141
$this->failsOnEmpty($newestBackup = $backupDestination->backups()->newest());
4242

@@ -117,7 +117,7 @@ protected function downloadAndExtract(Backup $backup, TemporaryDirectory $tempor
117117
}
118118

119119
/**
120-
* @param $source
120+
* @param $source
121121
* @return string
122122
*/
123123
protected function extract($source)
@@ -135,7 +135,7 @@ protected function extract($source)
135135
}
136136

137137
/**
138-
* @param $backup
138+
* @param $backup
139139
*
140140
* @throws \Spatie\Backup\Exceptions\InvalidHealthCheck
141141
*/
@@ -147,7 +147,7 @@ protected function failsOnEmpty($backup)
147147
}
148148

149149
/**
150-
* @param $backup
150+
* @param $backup
151151
*
152152
* @throws \Spatie\Backup\Exceptions\InvalidHealthCheck
153153
*/
@@ -185,7 +185,7 @@ protected function getConnectionFromFile(\SplFileInfo $fileInfo)
185185
}
186186

187187
/**
188-
* @param $backupFolder
188+
* @param $backupFolder
189189
* @return Finder
190190
*/
191191
protected function getDumps($backupFolder)

0 commit comments

Comments
 (0)