User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Rebuild mod_users_latest with new Joomla 4 structure
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Category | ⇒ | Modules Front End |
Status | New | ⇒ | Pending |
Labels |
Added:
PR-4.4-dev
|
I worked today on system tests and I'm on a point now where it is relative easy to write one for front end modules. It would be cool if you can also write one for the converted module here. It is not that much of code to write. An example can be found here #40102 (ignore the changes in the db file).
It would be cool if you can also write one for the converted module here. It is not that much of code to write.
Sounds interesting. I'm going to check it out. But don't promise anything yet. Come back to it.
I have tested this item
Tested successfully in Joomla 4.4.0-dev of 14 March using PHP 8.1.10.
The following Deprecated message was reported from the back end when creating the front tne module, with or without the PR:
[14-Mar-2023 02:09:13 UTC] PHP Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in C:\www\joomla44\libraries\src\Table\Module.php on line 152
[14-Mar-2023 02:09:13 UTC] PHP Stack trace:
[14-Mar-2023 02:09:13 UTC] PHP 1. {main}() C:\www\joomla44\administrator\index.php:0
[14-Mar-2023 02:09:13 UTC] PHP 2. require_once() C:\www\joomla44\administrator\index.php:32
[14-Mar-2023 02:09:13 UTC] PHP 3. Joomla\CMS\Application\CMSApplication->execute() C:\www\joomla44\administrator\includes\app.php:61
[14-Mar-2023 02:09:13 UTC] PHP 4. Joomla\CMS\Application\AdministratorApplication->doExecute() C:\www\joomla44\libraries\src\Application\CMSApplication.php:293
[14-Mar-2023 02:09:13 UTC] PHP 5. Joomla\CMS\Application\AdministratorApplication->dispatch($component = *uninitialized*) C:\www\joomla44\libraries\src\Application\AdministratorApplication.php:186
[14-Mar-2023 02:09:13 UTC] PHP 6. Joomla\CMS\Component\ComponentHelper::renderComponent($option = 'com_modules', $params = *uninitialized*) C:\www\joomla44\libraries\src\Application\AdministratorApplication.php:143
[14-Mar-2023 02:09:13 UTC] PHP 7. Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() C:\www\joomla44\libraries\src\Component\ComponentHelper.php:355
[14-Mar-2023 02:09:13 UTC] PHP 8. Joomla\CMS\MVC\Controller\BaseController->execute($task = 'save') C:\www\joomla44\libraries\src\Dispatcher\ComponentDispatcher.php:143
[14-Mar-2023 02:09:13 UTC] PHP 9. Joomla\Component\Modules\Administrator\Controller\ModuleController->save($key = *uninitialized*, $urlVar = *uninitialized*) C:\www\joomla44\libraries\src\MVC\Controller\BaseController.php:672
[14-Mar-2023 02:09:13 UTC] PHP 10. Joomla\CMS\MVC\Controller\FormController->save($key = NULL, $urlVar = NULL) C:\www\joomla44\administrator\components\com_modules\src\Controller\ModuleController.php:241
[14-Mar-2023 02:09:13 UTC] PHP 11. Joomla\Component\Modules\Administrator\Model\ModuleModel->save($data = ['id' => '0', 'title' => 'Latest Users 2', 'note' => '', 'module' => 'mod_users_latest', 'showtitle' => '1', 'published' => '1', 'publish_up' => '', 'publish_down' => '', 'client_id' => '0', 'position' => 'sidebar-right', 'access' => 1, 'ordering' => '1', 'language' => '*', 'assignment' => '0', 'assigned' => [0 => '101'], 'rules' => ['core.delete' => [...], 'core.edit' => [...], 'core.edit.state' => [...], 'module.edit.frontend' => [...]], 'params' => ['shownumber' => 5, 'filter_groups' => 0, 'layout' => '_:default', 'moduleclass_sfx' => '', 'cache' => 1, 'cache_time' => 900, 'cachemode' => 'static', 'module_tag' => 'div', 'bootstrap_size' => '0', 'header_tag' => 'h3', 'header_class' => '', 'style' => '0'], 'tags' => []]) C:\www\joomla44\libraries\src\MVC\Controller\FormController.php:675
[14-Mar-2023 02:09:13 UTC] PHP 12. Joomla\CMS\Table\Module->check() C:\www\joomla44\administrator\components\com_modules\src\Model\ModuleModel.php:934
```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/40092">issues.joomla.org/tracker/joomla-cms/40092</a>.</sub>
strlen(): Passing null to parameter #1 ($string) of type string is deprecated in C:\www\joomla44\libraries\src\Table\Module.php on line 152
As far as I can see this is a PHP 8.1 error: strlen()
and is unrelated to this pr. I think a separate PR is needed to solve this. Also because this error occurs before and after this pr.
[EDIT adding !empty($this->content)
to line 152 (Module.php) solves the error message issue.]
Category | Modules Front End | ⇒ | Modules Front End JavaScript Unit Tests |
You have a syntax code style error in the test https://ci.joomla.org/joomla/joomla-cms/63196/1/29.
Labels |
Added:
?
|
You need to create a user in your test, add the following code to the file tests/cypress/support/commands/db.js after line 61:
Cypress.Commands.add('db_createUser', (user) => {
const defaultUserOptions = {
name: 'test user',
username: 'test',
email: 'test@example.com',
password: '098f6bcd4621d373cade4e832627b4f6', // Is the md5 of the word 'test'
block: 0
};
user = { ...defaultUserOptions, ...user };
const groupId = user.group_id ?? 2; // Default the group id to registered
delete user.group_id;
return cy.task('queryDB', createInsertQuery('users', user)).then((info) => {
cy.task('queryDB', "INSERT INTO #__user_usergroup_map (user_id, group_id) VALUES ('" + info.insertId + "', '" + groupId + "')").then(() => info);
});
});
And then replace your test with:
describe('Test that the users latest module', () => {
it('can load in frontend and displays the latest registered users', () => {
cy.db_createUser({ username: 'automatedtestuser' })
.then(() => cy.db_createModule({ module: 'mod_users_latest' }))
.then(() => {
cy.visit('/');
cy.contains('automatedtestuser');
});
});
});
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-03-17 13:41:19 |
Closed_By | ⇒ | laoneo |
Thanks!
@laoneo @sandewt On other modules which we converted so far, we usually keep the static method in Helper class for backward compatible purpose, like this one https://github.com/joomla/joomla-cms/blob/4.2-dev/modules/mod_articles_latest/src/Helper/ArticlesLatestHelper.php#L161-L164
Look like you forgot that in this OR ?
Look like you forgot that in this OR ?
Does this mean this module will not work in J4.2 and J4.3 ?
@joomdonation is right, can somebody make a followup pr?
Does this mean this module will not work in J4.2 and J4.3 ?
It means when we ship this code it can break other extensions or templates. So you need to leave the old function name and signature in place.
@joomdonation Glad you discovered this error.
Related to:
#40066 : mod_footer
#39931 : mod_custom