-
Notifications
You must be signed in to change notification settings - Fork 35
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
[FIX] ADF-3: child items of the class should show file property #2979
base: develop
Are you sure you want to change the base?
Conversation
helpers/form/class.Form.php
Outdated
$returnValue = false; | ||
|
||
foreach ($this->elements as $element) { | ||
if ($element instanceof tao_helpers_form_elements_xhtml_AsyncFile) { | ||
$returnValue = true; | ||
break; | ||
} | ||
} | ||
|
||
return $returnValue; |
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.
$returnValue = false; | |
foreach ($this->elements as $element) { | |
if ($element instanceof tao_helpers_form_elements_xhtml_AsyncFile) { | |
$returnValue = true; | |
break; | |
} | |
} | |
return $returnValue; | |
foreach ($this->elements as $element) { | |
if ($element instanceof tao_helpers_form_elements_xhtml_AsyncFile) { | |
return true; | |
} | |
} | |
return false; |
helpers/form/ElementMapFactory.php
Outdated
// if ($widgetUri === AsyncFile::WIDGET_ID) { | ||
// $widgetResource = new core_kernel_classes_Resource(GenerisAsyncFile::WIDGET_ID); | ||
// } | ||
|
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.
If we don't need this part - just remove 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.
- 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
Version
There are 0 BREAKING CHANGE, 0 feature, 2 fixes |
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.
ids, names are not unique with this solution
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 must be merged after merge PR of tao-core-ui
and release it, then change here the related files (Ping me)
- 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
public function checkFormInstance(): bool | ||
{ | ||
foreach ($this->elements as $element) { | ||
if ($element->getName() == "tao.forms.instance" ) { |
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 do you think of having a constant added at tao_actions_form_Instance
for tao.forms.instance
?
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.
tao.forms.instance is the name of the object of class tao_helpers_form_elements_xhtml_Hidden
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 know, but it is repeating now, so I suggested to create a constant instead of repeat.
helpers/form/class.Form.php
Outdated
return false; | ||
} | ||
|
||
public function checkFormInstance(): bool |
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.
IMO check seems you are validating something, which is not the case. You just need to know if this is a form instance.
public function checkFormInstance(): bool | |
public function isFormInstance(): bool |
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.
Done
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.
Good job!
…com/oat-sa/tao-core into feature/ADF-3/missing-file-property
public function setUp(): void | ||
{ | ||
$this->subject = new tao_helpers_form_xhtml_Form(); | ||
$this->tao_helpers_form_xhtml_Form_obj = $this->createMock(tao_helpers_form_xhtml_Form::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.
Do not you think this name is too big? Also we do not use _
or complete namespace in the variables.
$this->tao_helpers_form_xhtml_Form_obj = $this->createMock(tao_helpers_form_xhtml_Form::class); | |
$this->form = $this->createMock(tao_helpers_form_xhtml_Form::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.
Done
$response = $this->subject->hasAsyncFileUpload($this->tao_helpers_form_xhtml_Form_obj); | ||
$this->assertIsBool($response); |
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.
Unnecessary variable.
$response = $this->subject->hasAsyncFileUpload($this->tao_helpers_form_xhtml_Form_obj); | |
$this->assertIsBool($response); | |
$this->assertIsBool($this->subject->hasAsyncFileUpload($this->tao_helpers_form_xhtml_Form_obj)); |
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.
Removed
$this->tao_helpers_form_xhtml_Form_obj = $this->createMock(tao_helpers_form_xhtml_Form::class); | ||
} | ||
|
||
public function testHasAsyncFileUpload(): void |
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.
Can we test both cases?
$this->assertIsBool($response); | ||
} | ||
|
||
public function testIsFormInstance(): void |
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.
Can we test both cases?
$response = $this->subject->isFormInstance($this->tao_helpers_form_xhtml_Form_obj); | ||
$this->assertIsBool($response); |
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.
$response = $this->subject->isFormInstance($this->tao_helpers_form_xhtml_Form_obj); | |
$this->assertIsBool($response); | |
$this->assertIsBool($this->subject->isFormInstance($this->tao_helpers_form_xhtml_Form_obj)); |
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.
Done
Related task - https://oat-sa.atlassian.net/browse/ADF-3
Description: User has the possibility to add additional property for a given folder/class, using the "Manage Schema" option. All the items that are contained by this class will inherit the parent-folder's properties.
It works for all the properties BUT the File one.
Upon adding of this property, even though set for the parent-folder, the items won't inherit this only property.
Expected Result: all the child elements of the class are inheriting and are being shown all its properties.