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

[FIX] ADF-3: child items of the class should show file property #2979

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from

Conversation

chinnu-focaloid
Copy link
Contributor

@chinnu-focaloid chinnu-focaloid commented Jun 24, 2021

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.

@chinnu-focaloid chinnu-focaloid changed the base branch from master to develop June 24, 2021 12:47
Comment on lines 624 to 633
$returnValue = false;

foreach ($this->elements as $element) {
if ($element instanceof tao_helpers_form_elements_xhtml_AsyncFile) {
$returnValue = true;
break;
}
}

return $returnValue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$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;

Comment on lines 70 to 73
// if ($widgetUri === AsyncFile::WIDGET_ID) {
// $widgetResource = new core_kernel_classes_Resource(GenerisAsyncFile::WIDGET_ID);
// }

Copy link
Contributor

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

Copy link
Contributor

@gabrielfs7 gabrielfs7 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

@github-actions
Copy link

Version

Target Version 48.14.4
Last version 48.14.3

There are 0 BREAKING CHANGE, 0 feature, 2 fixes

Copy link
Contributor

@gabrielfs7 gabrielfs7 left a 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

Copy link
Contributor

@habemuscode habemuscode left a 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" ) {
Copy link
Contributor

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?

Copy link
Contributor Author

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

Copy link
Contributor

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.

return false;
}

public function checkFormInstance(): bool
Copy link
Contributor

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.

Suggested change
public function checkFormInstance(): bool
public function isFormInstance(): bool

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@gabrielfs7 gabrielfs7 left a comment

Choose a reason for hiding this comment

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

Good job!

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);
Copy link
Contributor

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.

Suggested change
$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);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment on lines 41 to 42
$response = $this->subject->hasAsyncFileUpload($this->tao_helpers_form_xhtml_Form_obj);
$this->assertIsBool($response);
Copy link
Contributor

Choose a reason for hiding this comment

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

Unnecessary variable.

Suggested change
$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));

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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?

Comment on lines 47 to 48
$response = $this->subject->isFormInstance($this->tao_helpers_form_xhtml_Form_obj);
$this->assertIsBool($response);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$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));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

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.

4 participants