Skip to content

Commit a4fe99e

Browse files
authored
[patch] Fix drush_version field in env:info command (#2736)
* Fix drush_version field in env:info command * fields not field * changelog * Update changelog to latest release
1 parent c749f64 commit a4fe99e

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file. This projec
66
### Added
77

88
### Fixed
9+
- Fix output of drush_version in `env:info` (#2736)
910

1011
## 4.1.0 - 2025-09-29
1112

src/Models/Environment.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ public function getPrimaryDomainModel()
625625
*/
626626
public function getDrushVersion()
627627
{
628-
return $this->settings('drush_version');
628+
return $this->settings('appserver_runtime')->drush_version;
629629
}
630630

631631
/**
@@ -961,6 +961,7 @@ public function serialize()
961961
'initialized' => $this->isInitialized(),
962962
'connection_mode' => $this->get('connection_mode'),
963963
'php_version' => $this->getPHPVersion(),
964+
'drush_version' => $this->getDrushVersion(),
964965
'php_runtime_generation' => $this->getPHPRuntimeGeneration(),
965966
];
966967
}

tests/Functional/EnvCommandsTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,29 @@ public function testInfoCommand()
317317
);
318318
}
319319

320+
/**
321+
* @test
322+
* @covers \Pantheon\Terminus\Commands\Env\InfoCommand
323+
*
324+
* @group env
325+
* @group short
326+
*/
327+
public function testInfoCommandWithDrushVersion()
328+
{
329+
$envInfo = $this->terminusJsonResponse(
330+
sprintf('env:info %s --fields=drush_version', $this->getSiteEnv())
331+
);
332+
$this->assertArrayHasKey(
333+
'drush_version',
334+
$envInfo,
335+
'Environment info should have "drush_version" field when explicitly requested.'
336+
);
337+
$this->assertNotEmpty(
338+
$envInfo['drush_version'],
339+
'Environment info "drush_version" should not be empty.'
340+
);
341+
}
342+
320343
/**
321344
* @test
322345
* @covers \Pantheon\Terminus\Commands\Env\MetricsCommand

0 commit comments

Comments
 (0)