ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSearchLuceneQueryParserTest.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use PHPUnit\Framework\TestCase;
23
29class ilSearchLuceneQueryParserTest extends TestCase
30{
35 protected $backupGlobals = false;
36
37 protected Container $dic;
38
39 protected function setUp(): void
40 {
41 $this->initDependencies();
42 parent::setUp();
43 }
44
45 public function testConstruct(): void
46 {
47 $qp = new ilLuceneQueryParser('query');
48 $this->assertTrue($qp instanceof ilLuceneQueryParser);
49 }
50
51 public function testValidation(): void
52 {
53 $qp = new ilLuceneQueryParser('');
54 $this->assertTrue(ilLuceneQueryParser::validateQuery('type:crs'));
55 }
56
57 public function testFailedParenthesis(): void
58 {
59 $this->expectException(ilLuceneQueryParserException::class);
61 }
62
63 protected function setGlobalVariable(string $name, $value): void
64 {
65 global $DIC;
66
67 $GLOBALS[$name] = $value;
68 unset($DIC[$name]);
69 $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
70 return $value;
71 };
72 }
73
74 protected function initDependencies(): void
75 {
76 }
77}
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
Unit tests for class ilDidacticTemplate.
$c
Definition: deliver.php:25
global $DIC
Definition: shib_login.php:26
$GLOBALS["DIC"]
Definition: wac.php:54