Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: TR-4179 new html5 elements for QTI SDK #312

Merged
merged 13 commits into from
Jun 3, 2022

Conversation

kilatib
Copy link
Contributor

@kilatib kilatib commented May 25, 2022

TR-4179

For tests:

  1. Merge PR 125
  2. Import Test from ticket
  3. Try to publish DE in a backoffice

* Copyright (c) 2022 (original work) Open Assessment Technologies SA;
*/

declare(strict_types=1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure I could keep it but for draft I left it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's OK.

private $content;

/**
* Create a new Div object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe not div

private $content;

/**
* Create a new Div object.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i believe not div

Comment on lines 33 to 35
protected function marshall(QtiComponent $component): DOMElement
{
/** @var Figcaption $component */
Copy link
Contributor

@poyuki poyuki May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT?

Suggested change
protected function marshall(QtiComponent $component): DOMElement
{
/** @var Figcaption $component */
/**
* @param QtiComponent&Figcaption $component
*/
protected function marshall(QtiComponent $component): DOMElement
{

Comment on lines 33 to 35
protected function marshall(QtiComponent $component): DOMElement
{
/** @var Figure $component */
Copy link
Contributor

@poyuki poyuki May 26, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT?

Suggested change
protected function marshall(QtiComponent $component): DOMElement
{
/** @var Figure $component */
/**
* @param QtiComponent&Figure $component
*/
protected function marshall(QtiComponent $component): DOMElement
{

{
use FlowTrait;

public const QTI_CLASS_NAME = 'figure';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it also should be figure?

Copy link
Contributor

@pnal pnal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the tests, since I was unable to run almost all of them

$class = 'testclass';

$expected = sprintf(
'<%1$s id="%2$s " class="%3$s">text content</%1$s>',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are expecting text content whereas not adding it to the object that you serializing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please point me to how to do it without recreating the recursive marshaler for html5 element?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What means without recreating?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no matter I found the answer in PR which you did

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the help

*/
public function testMarshall22WithDefaultValues(): void
{
$expected = sprintf('<%1$s>text content</%1$s>', $this->namespaceTag(Figcaption::QTI_CLASS_NAME));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the same

$class,
);

$expected = new Figcaption($id, $class);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you check that result object contains text content?

$class = 'testclass';

$xml = sprintf(
'<%1$s id="%2$s " class="%3$s"></%1$s>',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about children elements, is it able to unmarshall them?

*/
public function __construct($id = '', $class = '', $lang = '', $label = '')
{
parent::__construct($id, $class, $lang, $label);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the parent (Html5Element) constructor:

public function __construct(
        $title = null,
        $role = null,
        $id = null,
        $class = null,
        $lang = null,
        $label = null
    ) 

*/
public function __construct($id = '', $class = '', $lang = '', $label = '')
{
parent::__construct($id, $class, $lang, $label);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the parent (Html5Element) constructor:

public function __construct(
        $title = null,
        $role = null,
        $id = null,
        $class = null,
        $lang = null,
        $label = null
    ) 


$subject = new Figcaption($id, $class);

self::assertEquals($id, $subject->getId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


$subject = new Figure($id, $class);

self::assertEquals($id, $subject->getId());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same issue as for figcaption similar test

@kilatib kilatib requested review from poyuki and wazelin May 31, 2022 07:23
@kilatib kilatib changed the title Draft: feat: TR-4179 new html5 elements for QTI SDK feat: TR-4179 new html5 elements for QTI SDK May 31, 2022
@kilatib kilatib requested a review from pnal May 31, 2022 11:47

declare(strict_types=1);

namespace qtism\data\storage\xml\marshalling\trait;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

keyword trait as a part of a namespace:
PHP Fatal error: Uncaught ParseError: syntax error, unexpected 'trait' (T_TRAIT), expecting identifier (T_STRING) or '{'

@kilatib kilatib requested a review from pnal June 1, 2022 14:02
Copy link
Member

@wazelin wazelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • Feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful
  • Pull request's target is not master

@wazelin wazelin merged commit 8a06eb4 into develop Jun 3, 2022
@wazelin wazelin deleted the feature/TR-4179/support-qti-figure-elm branch June 3, 2022 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants