Skip to content

Commit 746b30d

Browse files
authored
Merge pull request #90 from alexandre-daubois/behat-attr
Use Behat attributes instead of annotations
2 parents 929c775 + c60fef7 commit 746b30d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

test/behaviour/CliContext.php

+12-10
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
namespace Php\PieBehaviourTest;
66

77
use Behat\Behat\Context\Context;
8+
use Behat\Step\Then;
9+
use Behat\Step\When;
810
use Composer\Util\Platform;
911
use Symfony\Component\Process\Process;
1012
use Webmozart\Assert\Assert;
@@ -17,13 +19,13 @@ class CliContext implements Context
1719
private string|null $output = null;
1820
private int|null $exitCode = null;
1921

20-
/** @When I run a command to download the latest version of an extension */
22+
#[When('I run a command to download the latest version of an extension')]
2123
public function iRunACommandToDownloadTheLatestVersionOfAnExtension(): void
2224
{
2325
$this->runPieCommand(['download', 'asgrim/example-pie-extension']);
2426
}
2527

26-
/** @When I run a command to download version :version of an extension */
28+
#[When('I run a command to download version :version of an extension')]
2729
public function iRunACommandToDownloadSpecificVersionOfAnExtension(string $version): void
2830
{
2931
$this->runPieCommand(['download', 'asgrim/example-pie-extension:' . $version]);
@@ -48,28 +50,28 @@ private function assertCommandSuccessful(): void
4850
Assert::notNull($this->output);
4951
}
5052

51-
/** @Then the latest version should have been downloaded */
53+
#[Then('the latest version should have been downloaded')]
5254
public function theLatestVersionShouldHaveBeenDownloaded(): void
5355
{
5456
$this->assertCommandSuccessful();
5557
Assert::regex($this->output, '#Found package: asgrim/example-pie-extension:v?\d+\.\d+\.\d+ which provides ext-example_pie_extension#');
5658
Assert::regex($this->output, '#Extracted asgrim/example-pie-extension:v?\d+\.\d+\.\d+ source to: #');
5759
}
5860

59-
/** @Then version :version should have been downloaded */
61+
#[Then('version :version should have been downloaded')]
6062
public function versionOfTheExtensionShouldHaveBeen(string $version): void
6163
{
6264
$this->assertCommandSuccessful();
6365
Assert::contains($this->output, 'Found package: asgrim/example-pie-extension:' . $version);
6466
}
6567

66-
/** @When I run a command to build an extension */
68+
#[When('I run a command to build an extension')]
6769
public function iRunACommandToBuildAnExtension(): void
6870
{
6971
$this->runPieCommand(['build', 'asgrim/example-pie-extension']);
7072
}
7173

72-
/** @Then /^the extension should have been built$/ */
74+
#[Then('the extension should have been built')]
7375
public function theExtensionShouldHaveBeenBuilt(): void
7476
{
7577
$this->assertCommandSuccessful();
@@ -85,13 +87,13 @@ public function theExtensionShouldHaveBeenBuilt(): void
8587
Assert::contains($this->output, 'Build complete:');
8688
}
8789

88-
/** @When /^I run a command to build an extension with configure options$/ */
90+
#[When('I run a command to build an extension with configure options')]
8991
public function iRunACommandToBuildAnExtensionWithConfigureOptions(): void
9092
{
9193
$this->runPieCommand(['build', 'asgrim/example-pie-extension', '--with-hello-name=sup']);
9294
}
9395

94-
/** @Then /^the extension should have been built with options$/ */
96+
#[Then('the extension should have been built with options')]
9597
public function theExtensionShouldHaveBeenBuiltWithOptions(): void
9698
{
9799
$this->assertCommandSuccessful();
@@ -107,13 +109,13 @@ public function theExtensionShouldHaveBeenBuiltWithOptions(): void
107109
Assert::contains($this->output, 'Build complete:');
108110
}
109111

110-
/** @When /^I run a command to install an extension$/ */
112+
#[When('I run a command to install an extension')]
111113
public function iRunACommandToInstallAnExtension(): void
112114
{
113115
$this->runPieCommand(['install', 'asgrim/example-pie-extension']);
114116
}
115117

116-
/** @Then /^the extension should have been installed$/ */
118+
#[Then('the extension should have been installed')]
117119
public function theExtensionShouldHaveBeenInstalled(): void
118120
{
119121
$this->assertCommandSuccessful();

0 commit comments

Comments
 (0)