ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilSearchLuceneQueryParserTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
7 
13 class ilSearchLuceneQueryParserTest extends TestCase
14 {
19  protected $backupGlobals = false;
20 
21  protected Container $dic;
22 
23  protected function setUp(): void
24  {
25  $this->initDependencies();
26  parent::setUp();
27  }
28 
29  public function testConstruct(): void
30  {
31  $qp = new ilLuceneQueryParser('query');
32  $this->assertTrue($qp instanceof ilLuceneQueryParser);
33  }
34 
35  public function testValidation(): void
36  {
37  $qp = new ilLuceneQueryParser('');
38  $this->assertTrue(ilLuceneQueryParser::validateQuery('type:crs'));
39  }
40 
41  public function testFailedParenthesis(): void
42  {
43  $this->expectException(ilLuceneQueryParserException::class);
45  }
46 
47  protected function setGlobalVariable(string $name, $value): void
48  {
49  global $DIC;
50 
51  $GLOBALS[$name] = $value;
52  unset($DIC[$name]);
53  $DIC[$name] = static function (\ILIAS\DI\Container $c) use ($value) {
54  return $value;
55  };
56  }
57 
58  protected function initDependencies(): void
59  {
60  }
61 }
$c
Definition: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Unit tests for class ilDidacticTemplate.