Skip to content
This repository has been archived by the owner on Mar 7, 2020. It is now read-only.

Commit

Permalink
improve behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Jun 19, 2019
1 parent cc84cca commit 7f8229b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
5 changes: 3 additions & 2 deletions features/makefile/make_docs_build.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Feature: Use make docs build command
And it should execute "sphinx-build"

Scenario: Override make docs build command
When I override makefile "docs-build" command with "echo 'test'"
When I override makefile "docs-build" command with "echo 'test'" and "make docs-build-default"
Then the command make "docs-build" should exist
Then it should execute "echo 'test'"
And it should execute "echo 'test'"
And it should execute "make docs-build-default"
But it should not execute "sphinx-build"
5 changes: 3 additions & 2 deletions features/makefile/make_install.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ Feature: Use make install command
And it should execute "yarn build"

Scenario: Override make install command
When I override makefile install command with "echo 'test'"
When I override makefile install command with "echo 'test'" and "make install-default"
Then the command make install should exist
Then it should execute "echo 'test'"
And it should execute "echo 'test'"
And it should execute "make install-default"
But it should not execute "composer install"
5 changes: 3 additions & 2 deletions features/makefile/make_start.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Feature: Use make start command
And it should execute "server:start"

Scenario: Override make start command
When I override makefile start command with "echo 'test'"
When I override makefile start command with "echo 'test'" and "make start-default"
Then the command make start should exist
Then it should execute "echo 'test'"
And it should execute "echo 'test'"
And it should execute "make start-default"
But it should not execute "server:start"
7 changes: 4 additions & 3 deletions features/makefile/make_stop.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ Feature: Use make stop command
Then the command make stop should exist
And it should execute "server:stop"

Scenario: Override make start command
When I override makefile stop command with "echo 'test'"
Scenario: Override make stop command
When I override makefile stop command with "echo 'test'" and "make stop-default"
Then the command make stop should exist
Then it should execute "echo 'test'"
And it should execute "echo 'test'"
And it should execute "make stop-default"
But it should not execute "server:stop"
5 changes: 3 additions & 2 deletions features/makefile/make_test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Feature: Use make test command
And it should execute "behat"

Scenario: Override make test command
When I override makefile test command with "echo 'test'"
When I override makefile test command with "echo 'test'" and "make test-default"
Then the command make test should exist
Then it should execute "echo 'test'"
And it should execute "echo 'test'"
And it should execute "make test-default"
But it should not execute "composer validate"
9 changes: 6 additions & 3 deletions src/Behat/Context/Cli/MakefileContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,19 @@ public function useDefaultMakeFileCommands()
}

/**
* @When I override makefile :commandName command with :data
* @When I override makefile :commandName command with :firstData
* @When I override makefile :commandName command with :firstdata and :secondData
*/
public function overrideCommandWithData(string $commandName, string $data)
public function overrideCommandWithData(string $commandName, ...$data)
{
$commandData = implode("\n\t", $data);

$this->ensureMakeFileDirExist();
$this->writeMakefileData(<<<EOM
include Makefile.dist
$commandName:
\t$data
\t$commandData
EOM
);
Expand Down

0 comments on commit 7f8229b

Please sign in to comment.