Skip to content

Commit

Permalink
Test case by @Jurigag
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Mar 27, 2017
1 parent 3abe305 commit 33e88ae
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
19 changes: 19 additions & 0 deletions test/requires.zep
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

namespace Test;

use Test\Requires\External3;

class Requires
{
protected content;

public function requireExternal1(var path)
{
Expand All @@ -15,4 +18,20 @@ class Requires
return true;
}

public function requireExternal3(var path)
{
var external3;

if PHP_MAJOR_VERSION == 5 {
create_symbol_table();
}
let external3 = new External3();
external3->req(path, this);
return this->content;
}

public function setContent(var content)
{
let this->content = content;
}
}
11 changes: 10 additions & 1 deletion unit-tests/Extension/RequiresTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,21 @@

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();
$output = $r->requireExternal3(__DIR__ . '/php/require-me-3.php');
$this->assertSame("test", $output);
}
}
3 changes: 3 additions & 0 deletions unit-tests/Extension/php/require-me-3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
$this->someVariable["test"] = "test";
echo $this->someVariable["test"];

0 comments on commit 33e88ae

Please sign in to comment.