Add parser logic for new module.xml settings

This commit is contained in:
Kijin Sung 2023-08-10 23:52:01 +09:00
parent 5881d08f6a
commit d0306df095
3 changed files with 77 additions and 0 deletions

View file

@ -63,5 +63,27 @@ class ModuleActionParserTest extends \Codeception\TestCase\Test
// Error handlers
$this->assertTrue(is_array($info->error_handlers));
$this->assertEquals('dispTestErrorHandler', $info->error_handlers[404]);
$this->assertEquals(['Controllers\Errors', 'dispErrorMethod'], $info->error_handlers[405]);
// Event handlers
$this->assertTrue(is_array($info->event_handlers));
$this->assertTrue(is_object($info->event_handlers[0]));
$this->assertEquals('document.insertDocument', $info->event_handlers[0]->event_name);
$this->assertEquals('after', $info->event_handlers[0]->position);
$this->assertEquals('Controllers\\Triggers', $info->event_handlers[0]->class_name);
$this->assertEquals('triggerAfterInsertDocument', $info->event_handlers[0]->method);
$this->assertTrue(is_object($info->event_handlers[1]));
$this->assertEquals('act:document.procDocumentVoteUp', $info->event_handlers[1]->event_name);
$this->assertEquals('before', $info->event_handlers[1]->position);
$this->assertEquals('controller', $info->event_handlers[1]->class_name);
$this->assertEquals('triggerBeforeDocumentVoteUp', $info->event_handlers[1]->method);
// Custom namespaces
$this->assertTrue(is_array($info->namespaces));
$this->assertTrue(in_array('VendorName\\Hello\\World', $info->namespaces));
// Custom prefixes
$this->assertTrue(is_array($info->prefixes));
$this->assertTrue(in_array('foobar', $info->prefixes));
}
}