function getList() { $registry = Registry::getInstance(); $i18n = new I18n($registry->get('i18n_path') . 'course.xml'); $data = ['ownerList' => Admin::getList(), 'list' => Course::getList(Course::ALL)]; $renderer = new Renderer(Page::MODE_NORMAL); $pTitle = $i18n->get('title'); $renderer->page->set('title', $pTitle)->set('h1', $pTitle)->set('content', CourseListView::get($data)); $renderer->loadPage(); $renderer->output(); }
function test_CourseGetList() { $registry = Registry::getInstance(); $setup = $registry->get(self::REG_KEY); $locales = LocaleManager::getLocales(); $list = Course::getList(); $this->assertNotCount(0, $list, "getList returns empty array from not empty database ({$setup['id']})"); $this->assertArrayHasKey($setup['id'], $list, "getList: Existing Course not found ({$setup['id']})"); $course = $list[$setup['id']]; $this->assertInstanceOf('WBT\\Course', $course, "getList item is not an instance of Course"); $this->assertEquals($setup['ownerId'], $course->ownerId, "getList: Invalid owner id ({$setup['id']})."); $this->assertEquals($setup['state'], $course->state, "getList: Invalid state ({$setup['id']})."); foreach ($locales as $localeId => $localeData) { foreach ($this->l10nFields as $field) { $this->assertEquals($setup['l10n']->get($field, $localeId), $course->l10n->get($field, $localeId), "getList: Invalid ({$setup['id']})->l10n({$localeId}, {$field})."); } } unset($course); }