-
-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow relative path for tmpDir
config setting.
#151
Conversation
src/Filesystem/Filesystem.php
Outdated
* | ||
* @return bool | ||
*/ | ||
public function isAbsolutePath(string $file): bool |
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.
is this a time to add a new dependency? :D
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.
lol, expected question. I still don't know.
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.
I think it's time to, it's the 3rd method we are copy-pasting from it :) Besides it's not like filesystem is a huge dependency, it's quite slim and don't change much
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.
@borNfreee let's do this. If you don't want to do it in the current PR let's do it as separate.
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.
got it, I will do it in this PR
could you please check travis ^^? |
src/Config/InfectionConfig.php
Outdated
return $this->config->tmpDir ?? sys_get_temp_dir(); | ||
$tmpDir = $this->config->tmpDir ?? sys_get_temp_dir(); | ||
|
||
if ($this->filesystem->isAbsolutePath($tmpDir)) { |
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.
I'd say that we don't need to execute this line for sys_get_temp_dir
.
so it's actually only when $this->config->tmpDir
is not empty
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.
fixed
@@ -1,6 +1,6 @@ | |||
#!/usr/bin/env bash | |||
|
|||
if [[ $PHPDBG=1 ]] | |||
if [ "$PHPDBG" = "1" ] |
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.
what was the issue? on linux it works fine
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.
on macos it was always true
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.
I couldn't reproduce it, might be a different shell (I'm using zsh), but in any case it's better to compare strings in bash
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.
seems like something wrong with PHPCSFixer. New version has been downloaded on Travis and it wants to remove blank line after license, while we have
Conflict between |
src/Config/InfectionConfig.php
Outdated
@@ -251,6 +258,17 @@ function ($excludeDir) use ($srcDir) { | |||
|
|||
public function getTmpDir(): string | |||
{ | |||
return $this->config->tmpDir ?? sys_get_temp_dir(); | |||
|
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.
remove additional new line
2c5a3ab
to
43d56ab
Compare
src/Config/InfectionConfig.php
Outdated
@@ -251,6 +258,17 @@ function ($excludeDir) use ($srcDir) { | |||
|
|||
public function getTmpDir(): string | |||
{ | |||
return $this->config->tmpDir ?? sys_get_temp_dir(); | |||
|
|||
if (empty($this->config->tmpDir)) { |
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.
maybe we need to throw an exception for case when "tmpDir": ""
instead of use sys_temp_dir
? what do you think?
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.
it's better to continue working if we can rather than throw an exception.
I mean even if we throw an exception here, Infection should fall back to sys_temp_dir since this is not critical mistake and does not block mutation testing. WDYT?
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.
imho to be user friendly we need to show warning message in this case if we don't want to throw an exception. (it's not easy to do it right now)
so feel free to leave it as is
p.s. could we update documentation to include this case?
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.
forgot about it, will do, thank you
Created an issue in PHPCSFixer repo about failures on Travis with the new downloaded 2.10.1 version: PHP-CS-Fixer/PHP-CS-Fixer#3503 |
43d56ab
to
4e0ab98
Compare
src/Filesystem/Filesystem.php
Outdated
* | ||
* @return bool | ||
*/ | ||
public function isAbsolutePath(string $file): bool |
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.
I think it's time to, it's the 3rd method we are copy-pasting from it :) Besides it's not like filesystem is a huge dependency, it's quite slim and don't change much
@@ -0,0 +1,20 @@ | |||
{ |
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.
we're using 4 spaces in other files aren't we?
"Namespace_\\Test\\": "tests/" | ||
} | ||
} | ||
} |
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.
missing line return
backupStaticAttributes="false" | ||
bootstrap="./vendor/autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" |
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.
aren't those the default? You can easily find out with phpstorm and adding xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.4/phpunit.xsd"
e.g. https://github.com/humbug/box/blob/master/phpunit.xml.dist#L3
|
||
use Namespace_\SourceClass; | ||
|
||
class SourceClassTest extends \PHPUnit\Framework\TestCase |
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.
Not a big deal but I find better to be consistent and import this class with a use statement?
@@ -1,6 +1,6 @@ | |||
#!/usr/bin/env bash | |||
|
|||
if [[ $PHPDBG=1 ]] | |||
if [ "$PHPDBG" = "1" ] |
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.
I couldn't reproduce it, might be a different shell (I'm using zsh), but in any case it's better to compare strings in bash
4e0ab98
to
42380fc
Compare
All comments addressed, including documentation. Please review again 😋 I decided to keep IOException since a like named constructors implemented in our version |
@@ -0,0 +1,12 @@ | |||
{ | |||
"timeout": 25, |
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.
4 spaces :P
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.
fixed
42380fc
to
716fb20
Compare
…ts with checking $PHPDBG env var
716fb20
to
c6772f9
Compare
tmpDir
config setting.