1<?php 2 3/** 4 * Created by IntelliJ IDEA. 5 * User: gerard 6 * Date: 03-09-2016 7 * Time: 15:49 8 9 * Unit Tests over simple function 10 * 11 * @group plugin_404manager 12 * @group plugins 13 */ 14 15require_once(__DIR__ . '/../admin.php'); 16 17class admin_plugin_404manager_test extends DokuWikiTest 18{ 19 20 /** 21 * Test if an expression is a regular expression pattern 22 */ 23 public function test_expressionIsRegular() 24 { 25 26 // Not an expression 27 $inputExpression = "Hallo"; 28 $isRegularExpression = admin_plugin_404manager::isRegularExpression($inputExpression); 29 /** @noinspection PhpUndefinedMethodInspection */ 30 $this->assertEquals(0,$isRegularExpression,"The term (".$inputExpression.") is not a regular expression"); 31 32 // A basic expression 33 $inputExpression = "/Hallo/"; 34 $isRegularExpression = admin_plugin_404manager::isRegularExpression($inputExpression); 35 $this->assertEquals(true,$isRegularExpression,"The term (".$inputExpression.") is a regular expression"); 36 37 // A complicated expression 38 $inputExpression = "/(/path1/path2/)(.*)/"; 39 $isRegularExpression = admin_plugin_404manager::isRegularExpression($inputExpression); 40 $this->assertEquals(true,$isRegularExpression,"The term (" . $inputExpression . ") is a regular expression"); 41 42 } 43 44} 45