Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
rasteiner committed Dec 3, 2024
1 parent a22d4ca commit ae94934
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions tests/Toolkit/Query/ParserTest.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,39 @@
<?php

namespace Kirby\Toolkit\Query;

use Kirby\TestCase;
use Kirby\Toolkit\Query\AST\ArgumentListNode;
use Kirby\Toolkit\Query\AST\LiteralNode;
use Kirby\Toolkit\Query\AST\MemberAccessNode;
use Kirby\Toolkit\Query\AST\VariableNode;
use Kirby\Toolkit\Query\Parser;
use Kirby\Toolkit\Query\Tokenizer;

class ParserTest extends TestCase {
function testMemberAccess() {
class ParserTest extends TestCase
{
public function testMemberAccess()
{
$tokenizer = new Tokenizer('user.name');
$ast = (new Parser($tokenizer))->parse();
$this->assertEquals($ast,
$this->assertEquals(
$ast,
new MemberAccessNode(
new VariableNode('user'), 'name'
new VariableNode('user'),
'name'
)
);
}

function testSquentialMemberAccess() {
public function testSquentialMemberAccess()
{
$tokenizer = new Tokenizer('user.name("arg").age');
$ast = (new Parser($tokenizer))->parse();
$this->assertEquals($ast,
$this->assertEquals(
$ast,
new MemberAccessNode(
new MemberAccessNode(
new VariableNode('user'),
'name',
new ArgumentListNode([new LiteralNode("arg")])
new ArgumentListNode([new LiteralNode('arg')])
),
'age'
)
Expand Down

0 comments on commit ae94934

Please sign in to comment.