diff --git a/test/requires.zep b/test/requires.zep index 2c38e6ce61..c64320cb31 100644 --- a/test/requires.zep +++ b/test/requires.zep @@ -3,6 +3,7 @@ namespace Test; class Requires { + protected someVariable; public function requireExternal1(var path) { @@ -15,4 +16,9 @@ class Requires return true; } + public function requireExternal3(var path) + { + this->someVariable = "test"; + require path; + } } diff --git a/unit-tests/Extension/RequiresTest.php b/unit-tests/Extension/RequiresTest.php index 0a63ccd2c0..4a30d8c8da 100644 --- a/unit-tests/Extension/RequiresTest.php +++ b/unit-tests/Extension/RequiresTest.php @@ -19,12 +19,23 @@ namespace Extension; +use Test\Requires; + class RequiresTest extends \PHPUnit_Framework_TestCase { public function testRequireExternal1() { - $r = new \Test\Requires(); + $r = new Requires(); $this->assertSame($r->requireExternal1(__DIR__ . '/php/require-me-1.php'), array(1, 2, 3)); $this->assertTrue($r->requireExternal1(__DIR__ . '/php/require-me-2.php') && defined('REQUIRE_ME')); } + + public function testRequireExternal3() + { + $r = new Requires(); + ob_start(); + $r->requireExternal3(__DIR__ . '/php/require-me-3.php'); + $output = ob_get_clean(); + $this->assertSame("test", $output); + } } diff --git a/unit-tests/Extension/php/require-me-3.php b/unit-tests/Extension/php/require-me-3.php new file mode 100644 index 0000000000..59d0fb3336 --- /dev/null +++ b/unit-tests/Extension/php/require-me-3.php @@ -0,0 +1,2 @@ +someVariable;