Skip to content

Commit

Permalink
minor #34608 [Process] add tests for php executable finder if file do…
Browse files Browse the repository at this point in the history
…es not exist (ahmedash95)

This PR was submitted for the master branch but it was squashed and merged into the 3.4 branch instead.

Discussion
----------

[Process] add tests for php executable finder if file does not exist

| Q             | A
| ------------- | ---
| Branch?       | master?
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |
| License       | MIT
| Doc PR        |

regarding Process component, I just noticed there is no test covers the case when the PHP binary is not valid so I added the test to make sure it works as expected also it increases the coverage of the process component

Commits
-------

2b62dc3 [Process] add tests for php executable finder if file does not exist
  • Loading branch information
nicolas-grekas committed Nov 27, 2019
2 parents f0a6de2 + 2b62dc3 commit 5cacc5d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Symfony/Component/Process/Tests/PhpExecutableFinderTest.php
Expand Up @@ -69,4 +69,16 @@ public function testFindArguments()
$this->assertEquals($f->findArguments(), [], '::findArguments() returns no arguments');
}
}

public function testNotExitsBinaryFile()
{
$f = new PhpExecutableFinder();
$phpBinaryEnv = PHP_BINARY;
putenv('PHP_BINARY=/usr/local/php/bin/php-invalid');

$this->assertFalse($f->find(), '::find() returns false because of not exist file');
$this->assertFalse($f->find(false), '::find(false) returns false because of not exist file');

putenv('PHP_BINARY='.$phpBinaryEnv);
}
}

0 comments on commit 5cacc5d

Please sign in to comment.