Skip to content

Commit c521542

Browse files
committed
start with functional task tests - add database tests
rename dump_paths to use dbdump/ prefix
1 parent 14580ef commit c521542

16 files changed

Lines changed: 1006 additions & 47 deletions

File tree

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ jobs:
4646

4747
# Run PHPUnit tests
4848
- name: Run PHPUnit tests
49-
run: composer run-script test
49+
run: composer run-script test

composer.json

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"phpstan/phpstan": "^2.1",
1515
"phpunit/phpunit": "^10.5",
1616
"squizlabs/php_codesniffer": "^3.11",
17-
"symfony/console": "^6.4"
17+
"symfony/console": "^6.4",
18+
"symfony/process": "^6.4"
1819
},
1920
"require": {
2021
"php": "^8.1",
@@ -36,8 +37,19 @@
3637
"phpcs:fix": "vendor/bin/phpcbf",
3738
"phpstan": "vendor/bin/phpstan analyse --memory-limit 1G",
3839
"lint": "find . -type f -name '*.php' -not -path './vendor/*' -exec php -l {} \\;",
39-
"test": "vendor/bin/phpunit",
40-
"test:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text --filter 'Gaambo\\\\DeployerWordpress\\\\'",
40+
"phpunit": "DO_NOT_TRACK=true vendor/bin/phpunit",
41+
"tests:unit": "DO_NOT_TRACK=true vendor/bin/phpunit --testsuite Unit",
42+
"tests:unit:coverage": "DO_NOT_TRACK=true XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite Unit --coverage-text",
43+
"tests:integration": "DO_NOT_TRACK=true vendor/bin/phpunit --testsuite Integration",
44+
"tests:integration:coverage": "DO_NOT_TRACK=true XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite Integration --coverage-text",
45+
"tests:functional": "DO_NOT_TRACK=true vendor/bin/phpunit --testsuite Functional",
46+
"tests:functional:coverage": "DO_NOT_TRACK=true XDEBUG_MODE=coverage vendor/bin/phpunit --testsuite Functional --coverage-text",
47+
"tests": [
48+
"@test:unit",
49+
"@test:integration",
50+
"@test:functional"
51+
],
52+
"tests:coverage": "DO_NOT_TRACK=true XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text",
4153
"precommit": [
4254
"@lint",
4355
"@phpcs",

composer.lock

Lines changed: 67 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/bedrock/deploy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
->set('themes/dir', 'web/app/themes')
3434
->set('plugins/dir', 'web/app/plugins')
3535
->set('wp/dir', 'web/wp')
36-
->set('dump_path', __DIR__ . '/data/db_dumps')
36+
->set('dbdump/path', __DIR__ . '/data/db_dumps')
3737
->set('backup_path', __DIR__ . '/data/backups');
3838

3939
set('packages', [

examples/bedrock/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ hosts:
1414
themes/dir: web/app/themes
1515
plugins/dir: web/app/plugins
1616
wp/dir: web/wp
17-
dump_path: ~/data/dumps
17+
dbdump/path: ~/data/dumps
1818
backup_path: ~/data/backups

examples/simple/deploy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
->set('current_path', function () {
2727
return Localhost::getConfig('release_path');
2828
})
29-
->set('dump_path', __DIR__ . '/data/db_dumps')
29+
->set('dbdump/path', __DIR__ . '/data/db_dumps')
3030
->set('backup_path', __DIR__ . '/data/backups');
3131

3232
set('packages', [

examples/simple/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ hosts:
1010
public_url: https://test.dev
1111
deploy_path: "~"
1212
release_path: "{{deploy_path}}/public_html" # fixed directory, no symlinks
13-
dump_path: ~/data/dumps
13+
dbdump/path: ~/data/dumps
1414
backup_path: ~/data/backups

phpunit.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
<testsuite name="Integration">
88
<directory>tests/Integration</directory>
99
</testsuite>
10+
<testsuite name="Functional">
11+
<directory>tests/Functional</directory>
12+
</testsuite>
1013
</testsuites>
1114
<source>
1215
<include>
1316
<directory suffix=".php">src</directory>
17+
<directory suffix=".php">tasks</directory>
1418
</include>
1519
<exclude>
1620
<directory suffix=".php">tests</directory>

recipes/bedrock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use function Deployer\test;
2121
use function Deployer\upload;
2222

23-
require_once __DIR__ . '/common.php';
23+
require __DIR__ . '/common.php';
2424

2525
add('recipes', ['bedrock-wp']);
2626

recipes/common.php

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,27 @@
3232

3333
// Deployer binary sets the include path, so this should work.
3434

35-
$deployerPath = 'vendor/deployer/deployer/';
36-
require_once $deployerPath . 'recipe/common.php';
35+
$commonRecipePaths = [
36+
__DIR__ . '/../vendor/deployer/deployer/recipe/common.php', // Development/testing
37+
__DIR__ . '/../deployer/deployer/recipe/common.php' // Installed via composer
38+
];
39+
40+
foreach ($commonRecipePaths as $recipePath) {
41+
if (file_exists($recipePath)) {
42+
require $recipePath;
43+
break;
44+
}
45+
}
3746

3847
// Include task definitions
39-
require_once __DIR__ . '/../tasks/database.php';
40-
require_once __DIR__ . '/../tasks/files.php';
41-
require_once __DIR__ . '/../tasks/mu-plugins.php';
42-
require_once __DIR__ . '/../tasks/packages.php';
43-
require_once __DIR__ . '/../tasks/plugins.php';
44-
require_once __DIR__ . '/../tasks/themes.php';
45-
require_once __DIR__ . '/../tasks/uploads.php';
46-
require_once __DIR__ . '/../tasks/wp.php';
48+
require __DIR__ . '/../tasks/database.php';
49+
require __DIR__ . '/../tasks/files.php';
50+
require __DIR__ . '/../tasks/mu-plugins.php';
51+
require __DIR__ . '/../tasks/packages.php';
52+
require __DIR__ . '/../tasks/plugins.php';
53+
require __DIR__ . '/../tasks/themes.php';
54+
require __DIR__ . '/../tasks/uploads.php';
55+
require __DIR__ . '/../tasks/wp.php';
4756

4857
// BINARIES
4958
set('bin/npm', function () {

0 commit comments

Comments
 (0)