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

Commit

Permalink
Merge branch 'hotfix/5111'
Browse files Browse the repository at this point in the history
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
44 changes: 44 additions & 0 deletions test/BaseInputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,21 @@ public function dataSets()
*/
public function testCanValidateEntireDataset($dataset, $expected)
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$filter->setData($dataset);
$this->assertSame($expected, $filter->isValid());
}

public function testCanValidatePartialDataset()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$validData = array(
'foo' => ' bazbat ',
Expand All @@ -217,6 +225,10 @@ public function testCanValidatePartialDataset()

public function testCanRetrieveInvalidInputsOnFailedValidation()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$invalidData = array(
'foo' => ' bazbat ',
Expand All @@ -242,6 +254,10 @@ public function testCanRetrieveInvalidInputsOnFailedValidation()

public function testCanRetrieveValidInputsOnFailedValidation()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$invalidData = array(
'foo' => ' bazbat ',
Expand All @@ -268,6 +284,10 @@ public function testCanRetrieveValidInputsOnFailedValidation()

public function testValuesRetrievedAreFiltered()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$validData = array(
'foo' => ' bazbat ',
Expand Down Expand Up @@ -296,6 +316,10 @@ public function testValuesRetrievedAreFiltered()

public function testCanGetRawInputValues()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$validData = array(
'foo' => ' bazbat ',
Expand All @@ -315,6 +339,10 @@ public function testCanGetRawInputValues()

public function testCanGetValidationMessages()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$filter->get('baz')->setRequired(true);
$filter->get('nest')->get('baz')->setRequired(true);
Expand Down Expand Up @@ -621,6 +649,10 @@ public function testValidationMarksInputValidWhenAllowEmptyFlagIsTrueAndContinue

public function testCanRetrieveRawValuesIndividuallyWithoutValidating()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$data = array(
'foo' => ' bazbat ',
Expand All @@ -637,6 +669,10 @@ public function testCanRetrieveRawValuesIndividuallyWithoutValidating()

public function testCanRetrieveUnvalidatedButFilteredInputValue()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$data = array(
'foo' => ' baz 2 bat ',
Expand Down Expand Up @@ -671,6 +707,10 @@ public function testGetRequiredNotEmptyValidationMessages()
}
public function testHasUnknown()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$validData = array(
'foo' => ' bazbat ',
Expand All @@ -691,6 +731,10 @@ public function testHasUnknown()
}
public function testGetUknown()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$filter = $this->getInputFilter();
$unknown = array(
'bar' => '12345',
Expand Down
44 changes: 44 additions & 0 deletions test/CollectionInputFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public function testSetInputFilter()

public function testInputFilterInputsAppliedToCollection()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$this->filter->setInputFilter($this->getBaseInputFilter());

$this->assertCount(4, $this->filter->getInputs());
Expand Down Expand Up @@ -158,13 +162,21 @@ public function testGetCountUsesSpecifiedCount()

public function testCanValidateValidData()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$this->filter->setInputFilter($this->getBaseInputFilter());
$this->filter->setData($this->getValidCollectionData());
$this->assertTrue($this->filter->isValid());
}

public function testCanValidateValidDataWithNonConsecutiveKeys()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$collectionData = $this->getValidCollectionData();
$collectionData[2] = $collectionData[0];
unset($collectionData[0]);
Expand All @@ -175,6 +187,10 @@ public function testCanValidateValidDataWithNonConsecutiveKeys()

public function testInvalidDataReturnsFalse()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$invalidCollectionData = array(
array(
'foo' => ' bazbatlong ',
Expand All @@ -195,6 +211,10 @@ public function testInvalidDataReturnsFalse()

public function testDataLessThanCountIsInvalid()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$invalidCollectionData = array(
array(
'foo' => ' bazbat ',
Expand All @@ -216,6 +236,10 @@ public function testDataLessThanCountIsInvalid()

public function testGetValues()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$expectedData = array(
array(
'foo' => 'bazbat',
Expand Down Expand Up @@ -253,6 +277,10 @@ public function testGetValues()

public function testGetRawValues()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$expectedData = array(
array(
'foo' => ' bazbat ',
Expand Down Expand Up @@ -285,6 +313,10 @@ public function testGetRawValues()

public function testGetMessagesForInvalidInputs()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$invalidCollectionData = array(
array(
'foo' => ' bazbattoolong ',
Expand Down Expand Up @@ -327,6 +359,10 @@ public function testGetMessagesForInvalidInputs()

public function testSetValidationGroupUsingFormStyle()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

// forms set an array of identical validation groups for each set of data
$formValidationGroup = array(
array(
Expand Down Expand Up @@ -367,6 +403,10 @@ public function testSetValidationGroupUsingFormStyle()

public function testEmptyCollectionIsValidByDefault()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$data = array();

$this->filter->setInputFilter($this->getBaseInputFilter());
Expand All @@ -377,6 +417,10 @@ public function testEmptyCollectionIsValidByDefault()

public function testEmptyCollectionIsNotValidIfRequired()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('ext/intl not enabled');
}

$data = array();

$this->filter->setInputFilter($this->getBaseInputFilter());
Expand Down

0 comments on commit 035e666

Please sign in to comment.