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

Missing required field with fallback does not return input in getValidInput #22

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions test/BaseInputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1069,6 +1069,8 @@ public function testMissingRequiredThatAllowsEmptyWithFallbackShouldMarkInputVal
$data = $filter->getValues();
$this->assertArrayHasKey('bar', $data);
$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.

both of these should be asserting that the key is not present.

Copy link
Member Author

Choose a reason for hiding this comment

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

But bar has a fallback value. If not then assertTrue(isValid) should be false

}

/**
Expand Down Expand Up @@ -1096,6 +1098,8 @@ public function testEmptyRequiredValueWithFallbackShouldMarkInputValid()
$data = $filter->getValues();
$this->assertArrayHasKey('bar', $data);
$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.

both of these should be asserting that the key is not present.

Copy link
Member

Choose a reason for hiding this comment

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

Actually I was wrong above; these assertions are correct, as the value was provided in the data set.

}

/**
Expand Down