Created
May 4, 2013 21:17
-
-
Save mhlavac/5518759 to your computer and use it in GitHub Desktop.
PHPUnit with php core functions
This file contains hidden or 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
<?php | |
namespace Example; | |
class Example | |
{ | |
public function doSomething() | |
{ | |
eval('ls -la'); | |
} | |
} |
This file contains hidden or 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
<?php | |
namespace Test; | |
class ExampleTest extends \PHPUnit_Framework_TestCase | |
{ | |
public function testDoSomething() | |
{ | |
(new Example())->doSomething(); | |
$this->expectOutputString('ls -la'); | |
} | |
} | |
namespace Example; | |
function eval($cmd) { | |
echo $cmd; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment