OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
email
/
vendor
/
mtdowling
/
jmespath.php
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/10/2024 05:25:07 AM
rwxr-xr-x
📄
ComplianceTest.php
4.11 KB
07/10/2024 05:22:45 AM
rw-r--r--
📄
EnvTest.php
928 bytes
07/10/2024 05:22:45 AM
rw-r--r--
📄
FnDispatcherTest.php
1.05 KB
07/10/2024 05:22:45 AM
rw-r--r--
📄
LexerTest.php
2.71 KB
07/10/2024 05:22:45 AM
rw-r--r--
📄
ParserTest.php
1.06 KB
07/10/2024 05:22:45 AM
rw-r--r--
📄
SyntaxErrorExceptionTest.php
1.04 KB
07/10/2024 05:22:45 AM
rw-r--r--
📄
TreeCompilerTest.php
730 bytes
07/10/2024 05:22:46 AM
rw-r--r--
📄
TreeInterpreterTest.php
1.99 KB
07/10/2024 05:22:46 AM
rw-r--r--
📄
UtilsTest.php
3.67 KB
07/10/2024 05:22:46 AM
rw-r--r--
📁
compliance
-
07/10/2024 05:28:12 AM
rwxr-xr-x
Editing: TreeInterpreterTest.php
Close
<?php namespace JmesPath\Tests\Tree; use JmesPath\AstRuntime; use JmesPath\TreeInterpreter; use PHPUnit\Framework\TestCase; /** * @covers JmesPath\Tree\TreeInterpreter */ class TreeInterpreterTest extends TestCase { public function testReturnsNullWhenMergingNonArray(): void { $t = new TreeInterpreter(); $this->assertNull($t->visit([ 'type' => 'flatten', 'children' => [ ['type' => 'literal', 'value' => 1], ['type' => 'literal', 'value' => 1] ] ], [], [ 'runtime' => new AstRuntime() ])); } public function testWorksWithArrayObjectAsObject(): void { $runtime = new AstRuntime(); $this->assertEquals('baz', $runtime('foo.bar', new \ArrayObject([ 'foo' => new \ArrayObject(['bar' => 'baz']) ]))); } public function testWorksWithArrayObjectAsArray(): void { $runtime = new AstRuntime(); $this->assertEquals('baz', $runtime('foo[0].bar', new \ArrayObject([ 'foo' => new \ArrayObject([new \ArrayObject(['bar' => 'baz'])]) ]))); } public function testWorksWithArrayProjections(): void { $runtime = new AstRuntime(); $this->assertEquals( ['baz'], $runtime('foo[*].bar', new \ArrayObject([ 'foo' => new \ArrayObject([ new \ArrayObject([ 'bar' => 'baz' ]) ]) ])) ); } public function testWorksWithObjectProjections(): void { $runtime = new AstRuntime(); $this->assertEquals( ['baz'], $runtime('foo.*.bar', new \ArrayObject([ 'foo' => new \ArrayObject([ 'abc' => new \ArrayObject([ 'bar' => 'baz' ]) ]) ])) ); } }