diff --git a/tests/_data/module/info.xml b/tests/_data/module/info.xml new file mode 100644 index 000000000..cbfb899fa --- /dev/null +++ b/tests/_data/module/info.xml @@ -0,0 +1,19 @@ + + + 테스트 모듈 + Test Module + 유닛 테스트용 모듈입니다. + This module is for unit testing. + 2.0 + 2020-07-07 + service + GPLv2 + + Rhymix 개발자 + Rhymix Developer + + + 다른 개발자 + Other Developer + + diff --git a/tests/_data/module/module.xml b/tests/_data/module/module.xml new file mode 100644 index 000000000..6e56e3c89 --- /dev/null +++ b/tests/_data/module/module.xml @@ -0,0 +1,30 @@ + + + + + 열람 + View + + + + + + + + + + + + + + + + + 테스트 메뉴 + Test Menu + + + + + + diff --git a/tests/unit/framework/parsers/ModuleActionParserTest.php b/tests/unit/framework/parsers/ModuleActionParserTest.php new file mode 100644 index 000000000..6f2a79dbc --- /dev/null +++ b/tests/unit/framework/parsers/ModuleActionParserTest.php @@ -0,0 +1,10 @@ +assertTrue(is_object($info)); + } +} diff --git a/tests/unit/framework/parsers/ModuleInfoParserTest.php b/tests/unit/framework/parsers/ModuleInfoParserTest.php new file mode 100644 index 000000000..b5f58e0f5 --- /dev/null +++ b/tests/unit/framework/parsers/ModuleInfoParserTest.php @@ -0,0 +1,37 @@ +assertTrue(is_object($info)); + $this->assertEquals('테스트 모듈', $info->title); + $this->assertEquals('유닛 테스트용 모듈입니다.', $info->description); + $this->assertEquals('2.0', $info->version); + $this->assertEquals('20200707', $info->date); + $this->assertEquals('service', $info->category); + $this->assertEquals('GPLv2', $info->license); + $this->assertEquals('https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html', $info->license_link); + $this->assertTrue(is_array($info->author)); + $this->assertEquals('Rhymix 개발자', $info->author[0]->name); + $this->assertEquals('devops@rhymix.org', $info->author[0]->email_address); + $this->assertEquals('https://rhymix.org', $info->author[0]->homepage); + $this->assertEquals('다른 개발자', $info->author[1]->name); + $this->assertEquals('other.developer@rhymix.org', $info->author[1]->email_address); + $this->assertEquals('', $info->author[1]->homepage); + + Context::setLangType('en'); + $info = Rhymix\Framework\Parsers\ModuleInfoParser::loadXML(\RX_BASEDIR . 'tests/_data/module/info.xml'); + $this->assertEquals('Test Module', $info->title); + $this->assertEquals('This module is for unit testing.', $info->description); + $this->assertEquals('Rhymix Developer', $info->author[0]->name); + + $this->assertEquals('dispTestView', $info->default_index_act); + $this->assertEquals('dispTestAdminIndex', $info->admin_index_act); + $this->assertTrue(is_array($info->error_handlers)); + $this->assertEquals('dispTestErrorHandler', $info->error_handlers[404]); + } +}