Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 3629d80

Browse files
committed
#8 : Add test for new instance
1 parent 9a52e27 commit 3629d80

File tree

2 files changed

+89
-0
lines changed

2 files changed

+89
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--TEST--
2+
Test continue stmt
3+
--DESCRIPTION--
4+
Lowlevel basic test
5+
--FILE--
6+
<?php
7+
8+
require __DIR__ . '/../../../Bootstrap.php';
9+
10+
use PhpToZephir\EngineFactory;
11+
use PhpToZephir\Logger;
12+
use Symfony\Component\Console\Output\NullOutput;
13+
14+
$engine = EngineFactory::getInstance(new Logger(new NullOutput(), false));
15+
$code = <<<'EOT'
16+
<?php
17+
18+
namespace Code\Oop;
19+
20+
class DynamicInstance
21+
{
22+
public function test()
23+
{
24+
$myClass = 'test';
25+
26+
$myInstance = new $myClass();
27+
}
28+
}
29+
EOT;
30+
echo $engine->convertString($code, true);
31+
32+
?>
33+
--EXPECT--
34+
namespace Code\Oop;
35+
36+
class DynamicInstance
37+
{
38+
public function test() -> void
39+
{
40+
var myClass, myInstance;
41+
42+
let myClass = "test";
43+
let myInstance = new {myClass}();
44+
}
45+
46+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
--TEST--
2+
Test continue stmt
3+
--DESCRIPTION--
4+
Lowlevel basic test
5+
--FILE--
6+
<?php
7+
8+
require __DIR__ . '/../../../Bootstrap.php';
9+
10+
use PhpToZephir\EngineFactory;
11+
use PhpToZephir\Logger;
12+
use Symfony\Component\Console\Output\NullOutput;
13+
14+
$engine = EngineFactory::getInstance(new Logger(new NullOutput(), false));
15+
$code = <<<'EOT'
16+
<?php
17+
18+
namespace Code\Oop;
19+
20+
class Instance
21+
{
22+
public function test()
23+
{
24+
$myInstance = new StdClass();
25+
}
26+
}
27+
EOT;
28+
echo $engine->convertString($code, true);
29+
30+
?>
31+
--EXPECT--
32+
namespace Code\Oop;
33+
34+
class Instance
35+
{
36+
public function test() -> void
37+
{
38+
var myInstance;
39+
40+
let myInstance = new StdClass();
41+
}
42+
43+
}

0 commit comments

Comments
 (0)