Skip to content

Commit 0bdbe60

Browse files
committed
Fix drush_version field in env:info command
1 parent 5d0ea74 commit 0bdbe60

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/Models/Environment.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public function getPrimaryDomainModel()
621621
*/
622622
public function getDrushVersion()
623623
{
624-
return $this->settings('drush_version');
624+
return $this->settings('appserver_runtime')->drush_version;
625625
}
626626

627627
/**
@@ -957,6 +957,7 @@ public function serialize()
957957
'initialized' => $this->isInitialized(),
958958
'connection_mode' => $this->get('connection_mode'),
959959
'php_version' => $this->getPHPVersion(),
960+
'drush_version' => $this->getDrushVersion(),
960961
'php_runtime_generation' => $this->getPHPRuntimeGeneration(),
961962
];
962963
}

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 --field=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)