Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Delegate to InputInterface::isValid when data not exists #30

Merged

Conversation

Maks3w
Copy link
Member

@Maks3w Maks3w commented Aug 21, 2015

This change is BC compatible with #10. Both depends of the specific subclass Input

About #7 there is things for to discuss if this is BC break or not.

Basically the question to discuss it's if InputInterface::isValid() should be the responsible to decide all cases where an input is invalid or if we want BaseInputFilter to decide that. Note I used here BaseInputFilter and not InputFilterInterface because only that class had so many matches about the InputInterface|Input state.

Revert interpretation of #22 change on merge

Supersede and close #29

@Maks3w
Copy link
Member Author

Maks3w commented Aug 22, 2015

At this moment this pending of discussion.

TODO remove tests from BaseInputFilter and place it on Input

@Maks3w Maks3w removed the Test label Aug 22, 2015
@Maks3w Maks3w force-pushed the hotfix/input-validation-delegate branch from d336c96 to 49a7aaa Compare August 24, 2015 19:36
@weierophinney
Copy link
Member

This looks sane; please rebase and proceed, and let me know when you're ready for final review.

@Maks3w
Copy link
Member Author

Maks3w commented Aug 27, 2015

@weierophinney This become broken due the assumption of fallback values for missing data does not add the input to the valid inputs collection.

@Maks3w Maks3w force-pushed the hotfix/input-validation-delegate branch from 49a7aaa to 7f29c92 Compare August 27, 2015 06:46
@Maks3w Maks3w force-pushed the hotfix/input-validation-delegate branch 2 times, most recently from 4380856 to 225ae39 Compare August 27, 2015 07:54
@Maks3w
Copy link
Member Author

Maks3w commented Aug 27, 2015

@weierophinney This undo the change on #22 while merging. Fallback value shouldn't never to be exposed and used for build validation rules.

$this->assertEquals($bar->getFallbackValue(), $data['bar']);
$this->assertArrayHasKey('bar', $filter->getValidInput());
$this->assertArrayNotHasKey('bar', $filter->getInvalidInput());
}
Copy link
Member

Choose a reason for hiding this comment

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

Do the above tests fail with the change? Or are equivalent tests introduced? If these tests still pass, I'd like to keep them in place, as they document changes that were introduced with #10.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no test ensuring any valid input (i.e isValid > true) must appear on getValidInput result.

This will be added on the test refactor where all outputs are tested at once for ensure there is no edge cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

This methods provide a flag for distinguish when $value contains a real or the default property value.
@Maks3w Maks3w force-pushed the hotfix/input-validation-delegate branch from 651e553 to c1bf8dc Compare September 1, 2015 07:03
Delegate to input isValid grant full control about the fallback value feature.

This commit also consolidate Input::setFallbackValue tests
@Maks3w Maks3w force-pushed the hotfix/input-validation-delegate branch from e4ad477 to de0e3c9 Compare September 1, 2015 07:10
@weierophinney weierophinney merged commit 44cd418 into zendframework:master Sep 1, 2015
weierophinney added a commit that referenced this pull request Sep 1, 2015
Delegate to InputInterface::isValid when data not exists
weierophinney added a commit that referenced this pull request Sep 1, 2015
weierophinney added a commit that referenced this pull request Sep 1, 2015
@Maks3w Maks3w deleted the hotfix/input-validation-delegate branch September 1, 2015 18:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants