-
Notifications
You must be signed in to change notification settings - Fork 33
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
Conversation
* Copyright (c) 2022 (original work) Open Assessment Technologies SA; | ||
*/ | ||
|
||
declare(strict_types=1); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i believe not div
protected function marshall(QtiComponent $component): DOMElement | ||
{ | ||
/** @var Figcaption $component */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT?
protected function marshall(QtiComponent $component): DOMElement | |
{ | |
/** @var Figcaption $component */ | |
/** | |
* @param QtiComponent&Figcaption $component | |
*/ | |
protected function marshall(QtiComponent $component): DOMElement | |
{ |
protected function marshall(QtiComponent $component): DOMElement | ||
{ | ||
/** @var Figure $component */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT?
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'; |
There was a problem hiding this comment.
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
?
src/qtism/runtime/rendering/markup/xhtml/XhtmlRenderingEngine.php
Outdated
Show resolved
Hide resolved
src/qtism/data/storage/xml/marshalling/Qti22MarshallerFactory.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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>', |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What means without recreating?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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>', |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will fail constantly cause you can not set $id and $class because of:
https://github.com/oat-sa/qti-sdk/pull/312/files#diff-cb9fba2d3b91cd5fb8765ade051c0fc88be45eef69edb1ae6b1f537aca9e9c65R54
|
||
$subject = new Figure($id, $class); | ||
|
||
self::assertEquals($id, $subject->getId()); |
There was a problem hiding this comment.
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
|
||
declare(strict_types=1); | ||
|
||
namespace qtism\data\storage\xml\marshalling\trait; |
There was a problem hiding this comment.
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 '{'
There was a problem hiding this 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
TR-4179
For tests: