Commit 3fb103b4 authored by Pietro Saccardi's avatar Pietro Saccardi

Testing expression parsing and rebuilding

parent 1b007b32
Pipeline #431 passed with stage
in 3 minutes and 12 seconds
<?php
require_once(__DIR__ . '/../syntax/grammar.php');
/**
* General tests for the ifauthex plugin
*
......@@ -65,6 +67,18 @@ class general_plugin_ifauthex_test extends DokuWikiTest
'user && user || @group'
);
public function test_parse()
{
foreach (self::VALID_EXPRESSIONS as $expr) {
$failureMsg = 'Assertion failed at expression "' . $expr . '".';
$ast = null;
$rebuiltExpr = null;
$this->assertNotNull($ast = parse($expr));
$this->assertNotNull($rebuiltExpr = $ast->getRepresentation());
$this->assertEquals($rebuiltExpr, preg_replace('/\s/', '', $expr));
}
}
/**
* Simple test to make sure the plugin.info.txt is in correct format
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment