Skip to content

Commit

Permalink
Merge pull request #94 from jigarius/93-support-drupal-11
Browse files Browse the repository at this point in the history
Support Drupal 11 and Drush 13
  • Loading branch information
jigarius authored Sep 23, 2024
2 parents f1c58fb + dfb175b commit 745f30c
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-latest']
php-versions: ['8.1']
php-versions: ['8.3']
steps:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
Expand Down
2 changes: 1 addition & 1 deletion src/Command/ExecCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ExecCommand extends BaseCommand {
*/
protected array $argv;

public function __construct(string $name = NULL) {
public function __construct(?string $name = NULL) {
parent::__construct($name);
$this->argv = $GLOBALS['argv'];
}
Expand Down
5 changes: 2 additions & 3 deletions src/Drall.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drall;

use Composer\InstalledVersions;
use Drall\Command\ExecCommand;
use Drall\Command\SiteAliasesCommand;
use Drall\Command\SiteDirectoriesCommand;
Expand All @@ -19,8 +20,6 @@ final class Drall extends Application {

const NAME = 'Drall';

const VERSION = '3.1.0-rc1';

use SiteDetectorAwareTrait;

/**
Expand All @@ -29,7 +28,7 @@ final class Drall extends Application {
public function __construct() {
parent::__construct();
$this->setName(self::NAME);
$this->setVersion(self::VERSION);
$this->setVersion(InstalledVersions::getPrettyVersion('jigarius/drall') ?? 'unknown');
$this->setAutoExit(FALSE);

$this->add(new SiteDirectoriesCommand());
Expand Down
8 changes: 4 additions & 4 deletions src/Service/SiteDetector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class SiteDetector {

public function __construct(
DrupalFinder $drupalFinder,
SiteAliasManagerInterface $siteAliasManager
SiteAliasManagerInterface $siteAliasManager,
) {
$this->setDrupalFinder($drupalFinder);
$this->setSiteAliasManager($siteAliasManager);
Expand All @@ -37,7 +37,7 @@ public function __construct(
* Site directory names.
*/
public function getSiteDirNames(
string $group = NULL,
?string $group = NULL,
?string $filter = NULL,
): array {
if (!$sitesFile = $this->getSitesFile($group)) {
Expand Down Expand Up @@ -66,7 +66,7 @@ public function getSiteDirNames(
* Keys from the $sites array.
*/
public function getSiteKeys(
string $group = NULL,
?string $group = NULL,
?string $filter = NULL,
bool $unique = FALSE,
): array {
Expand Down Expand Up @@ -190,7 +190,7 @@ private function getSitesFile($group = NULL): ?SitesFile {
private function filter(
array $data,
string $expression,
string $default_filter_field = 'value'
string $default_filter_field = 'value',
): array {
if (empty($data)) {
return $data;
Expand Down
4 changes: 3 additions & 1 deletion test/Integration/DrallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drall\Test\Integration;

use Composer\InstalledVersions;
use Drall\Drall;
use Drall\IntegrationTestCase;

Expand All @@ -12,7 +13,8 @@ class DrallTest extends IntegrationTestCase {

public function testVersion() {
$output = shell_exec('drall --version');
$this->assertEquals(Drall::NAME . ' ' . Drall::VERSION . PHP_EOL, $output);
$version = InstalledVersions::getPrettyVersion('jigarius/drall');
$this->assertEquals(Drall::NAME . ' ' . $version . PHP_EOL, $output);
}

public function testWorkingDirectory() {
Expand Down
14 changes: 0 additions & 14 deletions test/Unit/DrallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@ public function testName() {
$this->assertSame(Drall::NAME, $app->getName());
}

public function testVersion() {
$app = new Drall();
$this->assertMatchesRegularExpression(
'/^\d+\.\d+.\d+(-(alpha|beta|rc)\d+)?$/',
$app->getVersion()
);

$json_path = $this->projectDir() . DIRECTORY_SEPARATOR . 'composer.json';
$json_data = json_decode(file_get_contents($json_path));

$this->assertNotEmpty($json_data->version);
$this->assertEquals($json_data->version, $app->getVersion());
}

public function testDefaultInputOptions() {
$app = new Drall();
$options = $app->getDefinition()->getOptions();
Expand Down

0 comments on commit 745f30c

Please sign in to comment.