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

Add unit tests for Core IdentifiableObject classes #12304

Merged
merged 1 commit into from Jan 30, 2019

Conversation

Projects
None yet
3 participants
@matks
Copy link
Contributor

matks commented Jan 25, 2019

Questions Answers
Branch? develop
Description? Add unit tests for Core IdentifiableObject classes
Type? improvement
Category? TE
BC breaks? no
Deprecations? no
Fixed ticket?
How to test? Travis should be green

This change is Reviewable

])
);
$this->handler->save(['x' => 'y']);

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Jan 30, 2019

Member

Didn't you forget an assert statement? Or you only want to check the call to dispatchWithParameters()?

This comment has been minimized.

@matks

matks Jan 30, 2019

Author Contributor

The return of $this->handler->save(...) is an array $errors directly taken from the DataProvider which is a mock here. So I thought it was not relevant to check, but I can add it.

https://github.com/PrestaShop/PrestaShop/blob/develop/src/Core/Form/FormHandler.php#L123

public function save(array $data)
    {
        $errors = $this->formDataProvider->setData($data);
        $this->hookDispatcher->dispatchWithParameters(
            "action{$this->hookName}Save",
            [
                'errors' => &$errors,
                'form_data' => &$data,
            ]
        );
        return $errors;
    }

This comment has been minimized.

@Quetzacoalt91

Quetzacoalt91 Jan 30, 2019

Member

Nope, that's fine by me.

@Quetzacoalt91 Quetzacoalt91 added this to the 1.7.6.0 milestone Jan 30, 2019

@Quetzacoalt91

This comment has been minimized.

Copy link
Member

Quetzacoalt91 commented Jan 30, 2019

No need of QA, merging.

@Quetzacoalt91 Quetzacoalt91 merged commit 018a913 into PrestaShop:develop Jan 30, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@matks matks deleted the matks:add-unit-tests-form-core branch Jan 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment