Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.DS_Store
/phpunit
/phpunit.phar
/phpunit_source/
.phpunit.result.cache
/backdrop/
/multisite/
/current/
/backdrop.zip
/box
/bee.phar
Expand Down
15 changes: 8 additions & 7 deletions .lando.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ services:
- ln -s /app/bee.php /usr/local/bin/bee
# Download Backdrop.
- wget -q --show-progress -O /app/backdrop.zip https://github.com/backdrop/backdrop/archive/1.x.zip
# Download PHPUnit.
- wget -q --show-progress -O /app/phpunit https://phar.phpunit.de/phpunit-8.5.phar
- chmod +x /app/phpunit
# Download PHPUnit and extract the source to help validate test code functions.
- wget -q --show-progress -O /app/phpunit.phar https://phar.phpunit.de/phpunit-9.6.phar
- chmod +x /app/phpunit.phar
- mkdir -p /app/phpunit_source && cd /app/phpunit_source && phar extract -f /app/phpunit.phar
# Download Box
- wget -q --show-progress -O /app/box "https://github.com/box-project/box/releases/download/4.4.0/box.phar"
- chmod +x /app/box
Expand All @@ -56,12 +57,12 @@ events:
# Run clean-up tasks.
- /app/.lando/setup.sh clean
# Remove `bee` symlink, Backdrop, PHPUnit, Box and any created bee.phar files.
- rm -f /usr/local/bin/bee /app/backdrop.zip /app/phpunit /app/box /app/bee.phar
- rm -rf /usr/local/bin/bee /app/backdrop.zip /app/phpunit.phar /app/phpunit_source /app/box /app/bee.phar
pre-destroy:
# Run clean-up tasks.
- /app/.lando/setup.sh clean
# Remove `bee` symlink, Backdrop, PHPUnit, Box and any created bee.phar files.
- rm -f /usr/local/bin/bee /app/backdrop.zip /app/phpunit /app/box /app/bee.phar
- rm -rf /usr/local/bin/bee /app/backdrop.zip /app/phpunit.phar /app/phpunit_source /app/box /app/bee.phar
tooling:
bee:
service: appserver
Expand All @@ -75,8 +76,8 @@ tooling:
run-tests:
service: appserver
cmd:
- cd /app/backdrop && /app/phpunit --testsuite backdrop --configuration /app/tests
- cd /app/multisite && /app/phpunit --testsuite multisite --configuration /app/tests
- cd /app/backdrop && /app/phpunit.phar --testsuite backdrop --configuration /app/tests
- cd /app/multisite && /app/phpunit.phar --testsuite multisite --configuration /app/tests
xdebug-on:
service: appserver
description: Enable Xdebug.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ better able to support the coming 'update' command.
- Provide default terminal width if `tput cols` fails to get the value.
- The `config-import` command will now import `system.extensions` config updates first
if there are any.
- Updated PHPUnit to 9.6

## [1.x-1.1.0] - 2024-09-07

Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ There are automated tests which test both functionality and coding standards,
though the coding standards test is not comprehensive. If tests fail, please
attempt to fix if you can. If you're not sure why tests have failed, ask.

If you wish to run the tests locally and you are not using Lando you will need
version 9.6 of PHPUnit.

If you are adding a new command or making changes to the way a command works, a
new functional test or changes to existing functional tests, respectively, may
be required. It is ok to request help if you are unsure about this.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ user who is currently associated with the "BWpanda" user name.
- Inspired by [Drush](https://github.com/drush-ops/drush).
- [Bee icon](https://thenounproject.com/aomam/collection/bee-emoticons-line/?i=2257433)
by AomAm from [the Noun Project](http://thenounproject.com).
- Bee uses [PHPUnit](https://github.com/sebastianbergmann/phpunit/) for testing.

## License

Expand Down
2 changes: 1 addition & 1 deletion tests/backdrop/ConfigCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function test_config_import_command_works() {
$this->assertStringContainsString('1 file was synced.', (string) $output);

// Verify config file doesn't exist in active.
$this->assertFileNotExists($file);
$this->assertFileDoesNotExist($file);

// Put config file back.
exec('mv dashboard.settings.json files/config_*/active/');
Expand Down
12 changes: 6 additions & 6 deletions tests/backdrop/DownloadCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public function test_download_command_works() {
// Single module.
$output_single = shell_exec('bee download simplify');
$pattern = '/\'simplify\' \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/backdrop\/modules\/simplify\'/';
$this->assertRegExp($pattern, $output_single);
$this->assertMatchesRegularExpression($pattern, $output_single);
$this->assertTrue(file_exists("$bee_test_root/backdrop/modules/simplify/simplify.info"));

// Multiple projects (theme and layout).
$output_multiple = shell_exec('bee download lumi bamboo');
$pattern = '/\'lumi\' \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/backdrop\/themes\/lumi\'/';
$this->assertRegExp($pattern, $output_multiple);
$this->assertMatchesRegularExpression($pattern, $output_multiple);
$this->assertTrue(file_exists("$bee_test_root/backdrop/themes/lumi/lumi.info"));
$pattern = '/\'bamboo\' \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/backdrop\/layouts\/bamboo\'/';
$this->assertRegExp($pattern, $output_multiple);
$this->assertMatchesRegularExpression($pattern, $output_multiple);
$this->assertTrue(file_exists("$bee_test_root/backdrop/layouts/bamboo/bamboo.info"));

// Defined release.
Expand All @@ -45,19 +45,19 @@ public function test_download_core_command_works() {
// Download to current directory.
$output_current = shell_exec("mkdir $bee_test_root/current && cd $bee_test_root/current && bee download-core");
$pattern = '/Backdrop \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/current\'/';
$this->assertRegExp($pattern, $output_current);
$this->assertMatchesRegularExpression($pattern, $output_current);
$this->assertTrue(file_exists("$bee_test_root/current/index.php"));

// Download to specified directory.
$output_directory = shell_exec("bee download-core $bee_test_root/directory");
$pattern = '/Backdrop \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/directory\'/';
$this->assertRegExp($pattern, $output_directory);
$this->assertMatchesRegularExpression($pattern, $output_directory);
$this->assertTrue(file_exists("$bee_test_root/directory/index.php"));

// Download a defined release.
$output_defined_release = shell_exec("bee download-core $bee_test_root/defined_release --version=1.30.0");
$pattern = '/Backdrop \(1\.30\.0\, published at 2025\-01\-1\dT[\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/defined_release\'/';
$this->assertRegExp($pattern, $output_defined_release);
$this->assertMatchesRegularExpression($pattern, $output_defined_release);
$this->assertTrue(file_exists("$bee_test_root/defined_release/index.php"));

// Cleanup downloads.
Expand Down
12 changes: 6 additions & 6 deletions tests/backdrop/ProjectsCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ class ProjectsCommandsTest extends TestCase {
public function test_projects_command_works() {
// All projects.
$output_all = shell_exec('bee projects');
$this->assertRegExp('/| admin_bar +| Administration Bar +| module +| Enabled +|/', (string) $output_all);
$this->assertRegExp('/| bartik +| Bartik +| theme +| Disabled +|/', (string) $output_all);
$this->assertRegExp('/| moscone +| Moscone +| layout +| Enabled +|/', (string) $output_all);
$this->assertMatchesRegularExpression('/| admin_bar +| Administration Bar +| module +| Enabled +|/', (string) $output_all);
$this->assertMatchesRegularExpression('/| bartik +| Bartik +| theme +| Disabled +|/', (string) $output_all);
$this->assertMatchesRegularExpression('/| moscone +| Moscone +| layout +| Enabled +|/', (string) $output_all);

// Specific project.
$output_project = shell_exec('bee projects contact');
$this->assertRegExp('/Name +Contact/', (string) $output_project);
$this->assertRegExp('/Description +Enables the use of both personal and site-wide contact forms./', (string) $output_project);
$this->assertMatchesRegularExpression('/Name +Contact/', (string) $output_project);
$this->assertMatchesRegularExpression('/Description +Enables the use of both personal and site-wide contact forms./', (string) $output_project);

// Just modules.
$output_modules = shell_exec('bee projects --type=module');
$this->assertRegExp('/| taxonomy +| Taxonomy +| module +| Enabled +|/', (string) $output_modules);
$this->assertMatchesRegularExpression('/| taxonomy +| Taxonomy +| module +| Enabled +|/', (string) $output_modules);
$this->assertStringNotContainsString(' | theme ', (string) $output_modules);
$this->assertStringNotContainsString(' | layout ', (string) $output_modules);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/backdrop/UserCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class UserCommandsTest extends TestCase {
*/
public function test_users_command_works() {
$output = shell_exec('bee users');
$this->assertRegExp('/| 1 +| admin +| admin@example.com +|/', (string) $output);
$this->assertMatchesRegularExpression('/| 1 +| admin +| admin@example.com +|/', (string) $output);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions tests/multisite/MultisiteDownloadCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public function test_download_command_works() {
// Root directory, no site specified.
$output_root = shell_exec('bee download simplify');
$pattern = '/\'simplify\' \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/multisite\/modules\/simplify\'/';
$this->assertRegExp($pattern, $output_root);
$this->assertMatchesRegularExpression($pattern, $output_root);
$this->assertTrue(file_exists("$bee_test_root/multisite/modules/simplify/simplify.info"));

// Root directory, site specified, 'allow-multisite-copy' option NOT
Expand All @@ -29,19 +29,19 @@ public function test_download_command_works() {
// Root directory, site specified, 'allow-multisite-copy' option included.
$output_root = shell_exec('bee --site=multi_one download --allow-multisite-copy simplify');
$pattern = '/\'simplify\' \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/multisite\/sites\/multi_one\/modules\/simplify\'/';
$this->assertRegExp($pattern, $output_root);
$this->assertMatchesRegularExpression($pattern, $output_root);
$this->assertTrue(file_exists("$bee_test_root/multisite/sites/multi_one/modules/simplify/simplify.info"));

// Root directory, site specified.
$output_root_site = shell_exec('bee download --site=multi_one lumi');
$pattern = '/\'lumi\' \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/multisite\/sites\/multi_one\/themes\/lumi\'/';
$this->assertRegExp($pattern, $output_root_site);
$this->assertMatchesRegularExpression($pattern, $output_root_site);
$this->assertTrue(file_exists("$bee_test_root/multisite/sites/multi_one/themes/lumi/lumi.info"));

// Site directory.
$output_site = shell_exec('cd sites/multi_two && bee download bamboo');
$pattern = '/\'bamboo\' \([\w\s\.\W]*\) was downloaded into \'' . preg_quote($bee_test_root, '/') . '\/multisite\/sites\/multi_two\/layouts\/bamboo\'/';
$this->assertRegExp($pattern, $output_site);
$this->assertMatchesRegularExpression($pattern, $output_site);
$this->assertTrue(file_exists("$bee_test_root/multisite/sites/multi_two/layouts/bamboo/bamboo.info"));

// Cleanup downloads.
Expand Down
12 changes: 6 additions & 6 deletions tests/multisite/MultisiteInstallCommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function test_install_command_works() {
global $bee_test_db_host, $bee_test_multisite_install_test_db_name;
// Check site status before install.
$output_before = shell_exec('bee status --site=install_test');
$this->assertRegExp('/Site type +Multisite/', (string) $output_before);
$this->assertRegExp('/Site directory +install_test/', (string) $output_before);
$this->assertMatchesRegularExpression('/Site type +Multisite/', (string) $output_before);
$this->assertMatchesRegularExpression('/Site directory +install_test/', (string) $output_before);
$this->assertStringNotContainsString('Database', (string) $output_before);

// Install the site.
Expand All @@ -27,10 +27,10 @@ public function test_install_command_works() {

// Check site status after install.
$output_after = shell_exec('bee status --site=install_test');
$this->assertRegExp('/Site type +Multisite/', (string) $output_after);
$this->assertRegExp('/Site directory +install_test/', (string) $output_after);
$this->assertRegExp('/Database name +install_test/', (string) $output_after);
$this->assertRegExp('/Database host +database/', (string) $output_after);
$this->assertMatchesRegularExpression('/Site type +Multisite/', (string) $output_after);
$this->assertMatchesRegularExpression('/Site directory +install_test/', (string) $output_after);
$this->assertMatchesRegularExpression('/Database name +install_test/', (string) $output_after);
$this->assertMatchesRegularExpression('/Database host +database/', (string) $output_after);

// Cleanup the install.
exec('bee --site=install_test db-drop -y');
Expand Down
12 changes: 6 additions & 6 deletions tests/multisite/MultisiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ class MultisiteTest extends TestCase {
public function test_site_global_option_works() {
global $bee_test_multisite_multi_2_domain;
$output_no_site = shell_exec('bee status');
$this->assertRegExp('/Site type +Multisite/', (string) $output_no_site);
$this->assertNotRegExp('/Site directory +multisite/', (string) $output_no_site);
$this->assertMatchesRegularExpression('/Site type +Multisite/', (string) $output_no_site);
$this->assertDoesNotMatchRegularExpression('/Site directory +multisite/', (string) $output_no_site);

$output_site_dir = shell_exec('bee --site=multi_one status');
$this->assertRegExp('/Site type +Multisite/', (string) $output_site_dir);
$this->assertRegExp('/Site directory +multi_one/', (string) $output_site_dir);
$this->assertMatchesRegularExpression('/Site type +Multisite/', (string) $output_site_dir);
$this->assertMatchesRegularExpression('/Site directory +multi_one/', (string) $output_site_dir);

$output_site_url = shell_exec("bee --site=$bee_test_multisite_multi_2_domain status");
$this->assertRegExp('/Site type +Multisite/', (string) $output_site_url);
$this->assertRegExp('/Site directory +multi_two/', (string) $output_site_url);
$this->assertMatchesRegularExpression('/Site type +Multisite/', (string) $output_site_url);
$this->assertMatchesRegularExpression('/Site directory +multi_two/', (string) $output_site_url);
}

}
Loading