Skip to content

Instantly share code, notes, and snippets.

@mhlavac
Created May 4, 2013 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhlavac/5518759 to your computer and use it in GitHub Desktop.
Save mhlavac/5518759 to your computer and use it in GitHub Desktop.
PHPUnit with php core functions
<?php
namespace Example;
class Example
{
public function doSomething()
{
eval('ls -la');
}
}
<?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