This repository has been archived by the owner on Mar 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 73
Generalise, document and include a test for custom phpunit path #253
Open
padraic
wants to merge
1
commit into
master
Choose a base branch
from
hotfix/custom-phpunit-path
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,9 @@ public function testFinderCanLocatePhpunitExecutable() | |
$result = $finder->find(); | ||
$this->assertRegExp('%phpunit.*(\\.bat|\\.phar)?$%i', $result); | ||
} | ||
|
||
public function testFinderCanLocateACustomPhpunitNotInVendorOrPath() | ||
{ | ||
$this->markTestIncomplete('Design test to inject custom config for this.'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leaving this aside for the time being. There's no clean way to inject the config change needed at the moment. |
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,7 @@ public function testShouldCreateConfigurationIfUserConfirmsIt() | |
"\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"Y\n" | ||
); | ||
|
||
|
@@ -88,11 +89,6 @@ public function testShouldCreateConfigurationIfUserConfirmsIt() | |
$this->assertHumbugJsonEqualsJson($expectedJson); | ||
} | ||
|
||
private function assertHumbugJsonEqualsJson($expectedJson) | ||
{ | ||
$this->assertJsonStringEqualsJsonString($expectedJson, file_get_contents('humbug.json.dist')); | ||
} | ||
|
||
public function testShouldCreateConfigurationWithDifferentLocationOfFrameworkConfigFile() | ||
{ | ||
mkdir('app'); | ||
|
@@ -107,6 +103,7 @@ public function testShouldCreateConfigurationWithDifferentLocationOfFrameworkCon | |
"\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Extra line of input was needed for all tests with the new configure question included. |
||
"Y\n" | ||
); | ||
|
||
|
@@ -142,6 +139,7 @@ public function testShouldCreateConfigurationWithCustomTextLogging() | |
"\n" . | ||
"custom-log.txt\n" . | ||
"\n" . | ||
"\n" . | ||
"Y\n" | ||
); | ||
|
||
|
@@ -176,6 +174,7 @@ public function testShouldCreateConfigurationWithJsonLogging() | |
"\n" . | ||
"\n" . | ||
"humbuglog.json\n" . | ||
"\n" . | ||
"Y\n" | ||
); | ||
|
||
|
@@ -215,6 +214,7 @@ public function testShouldCreateConfigurationWithMultipleSourceDirectories() | |
"\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"Y\n" | ||
); | ||
|
||
|
@@ -260,6 +260,7 @@ public function testShouldCreateConfigurationWithExcludeDirectories() | |
"\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"Y\n" | ||
); | ||
|
||
|
@@ -298,6 +299,7 @@ public function testShouldCreateConfigurationWithTimeout() | |
"5\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"Y\n" | ||
); | ||
|
||
|
@@ -320,6 +322,44 @@ public function testShouldCreateConfigurationWithTimeout() | |
$this->assertHumbugJsonEqualsJson($expectedJson); | ||
} | ||
|
||
public function testShouldCreateConfigurationWithCustomPhpunit() | ||
{ | ||
mkdir('src'); | ||
touch('phpunit.xml'); | ||
|
||
$this->setUserInput( | ||
"src\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"/path/to/phpunit-2.0.phar\n" . | ||
"Y\n" | ||
); | ||
|
||
$this->executeCommand(); | ||
|
||
$expectedJson = <<<JSON | ||
{ | ||
"source": { | ||
"directories": [ | ||
"src" | ||
] | ||
}, | ||
"timeout": 10, | ||
"logs": { | ||
"text": "humbuglog.txt" | ||
}, | ||
"phpunit": { | ||
"filepath": "\/path\/to\/phpunit-2.0.phar" | ||
} | ||
} | ||
JSON; | ||
|
||
$this->assertHumbugJsonEqualsJson($expectedJson); | ||
} | ||
|
||
public function testShouldNotCreateConfigurationIfSrcDirectoryNotExists() | ||
{ | ||
touch('phpunit.xml'); | ||
|
@@ -348,6 +388,7 @@ public function testShouldExitIfIfUserDoesNotWantToConfigure() | |
"\n" . | ||
"\n" . | ||
"\n" . | ||
"\n" . | ||
"N\\n" | ||
); | ||
|
||
|
@@ -365,6 +406,11 @@ public function testShouldNotChangeConfigurationIfItAlreadyExists() | |
$this->assertStringEqualsFile('humbug.json', '{}'); | ||
} | ||
|
||
private function assertHumbugJsonEqualsJson($expectedJson) | ||
{ | ||
$this->assertJsonStringEqualsJsonString($expectedJson, file_get_contents('humbug.json.dist')); | ||
} | ||
|
||
private function getInputStream($input) | ||
{ | ||
$stream = fopen('php://memory', 'r+', false); | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we allow a relative file path (relative to the config file)?