Skip to content

Commit

Permalink
Merge branch '6.9' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
yannickroger committed Apr 14, 2017
2 parents eaf7fe9 + 48c709d commit 02cfb80
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 76 deletions.
2 changes: 1 addition & 1 deletion eZ/Publish/Core/FieldType/Tests/EmailAddressTest.php
Expand Up @@ -204,7 +204,7 @@ public function provideInputForToHash()
return array(
array(
new EmailAddressValue(),
'',
null,
),
array(
new EmailAddressValue('spam_mail@ex-something.no'),
Expand Down
36 changes: 26 additions & 10 deletions eZ/Publish/Core/FieldType/Tests/FieldTypeTest.php
Expand Up @@ -663,11 +663,19 @@ public function testToHash($inputValue, $expectedResult)

$this->assertIsValidHashValue($actualResult);

$this->assertEquals(
$expectedResult,
$actualResult,
'toHash() method did not create expected result.'
);
if (is_object($expectedResult) || is_array($expectedResult)) {
$this->assertEquals(
$expectedResult,
$actualResult,
'toHash() method did not create expected result.'
);
} else {
$this->assertSame(
$expectedResult,
$actualResult,
'toHash() method did not create expected result.'
);
}
}

/**
Expand All @@ -684,11 +692,19 @@ public function testFromHash($inputHash, $expectedResult)

$actualResult = $fieldType->fromHash($inputHash);

$this->assertEquals(
$expectedResult,
$actualResult,
'fromHash() method did not create expected result.'
);
if (is_object($expectedResult) || is_array($expectedResult)) {
$this->assertEquals(
$expectedResult,
$actualResult,
'fromHash() method did not create expected result.'
);
} else {
$this->assertSame(
$expectedResult,
$actualResult,
'fromHash() method did not create expected result.'
);
}
}

public function testEmptyValueIsEmpty()
Expand Down
2 changes: 1 addition & 1 deletion eZ/Publish/Core/FieldType/Tests/TextBlockTest.php
Expand Up @@ -207,7 +207,7 @@ public function provideInputForToHash()
return array(
array(
new TextBlockValue(),
'',
null,
),
array(
new TextBlockValue('sindelfingen'),
Expand Down
4 changes: 2 additions & 2 deletions eZ/Publish/Core/FieldType/Tests/TextLineTest.php
Expand Up @@ -230,8 +230,8 @@ public function provideInputForToHash()
null,
),
array(
new TextLineValue(),
'',
new TextLineValue(''),
null,
),
array(
new TextLineValue('sindelfingen'),
Expand Down
62 changes: 0 additions & 62 deletions eZ/Publish/Core/FieldType/Tests/TimeTest.php
Expand Up @@ -381,66 +381,4 @@ public function provideDataForGetName()
array(new TimeValue(200), '12:03:20 am'),
);
}

/**
* @param mixed $inputValue
* @param array $expectedResult
*
* This overrides the FieldTypeTest method until it gets updated and all field types fixed in EZP-25424
*
* @dataProvider provideInputForToHash
*/
public function testToHash($inputValue, $expectedResult)
{
$fieldType = $this->getFieldTypeUnderTest();

$actualResult = $fieldType->toHash($inputValue);

$this->assertIsValidHashValue($actualResult);

if (is_object($expectedResult) || is_array($expectedResult)) {
$this->assertEquals(
$expectedResult,
$actualResult,
'toHash() method did not create expected result.'
);
} else {
$this->assertSame(
$expectedResult,
$actualResult,
'toHash() method did not create expected result.'
);
}
}

/**
* @param mixed $inputValue
* @param array $expectedResult
*
* This overrides the FieldTypeTest method until it gets updated and all field types fixed in EZP-25424
*
* @dataProvider provideInputForFromHash
*/
public function testFromHash($inputHash, $expectedResult)
{
$this->assertIsValidHashValue($inputHash);

$fieldType = $this->getFieldTypeUnderTest();

$actualResult = $fieldType->fromHash($inputHash);

if (is_object($expectedResult) || is_array($expectedResult)) {
$this->assertEquals(
$expectedResult,
$actualResult,
'fromHash() method did not create expected result.'
);
} else {
$this->assertSame(
$expectedResult,
$actualResult,
'fromHash() method did not create expected result.'
);
}
}
}

0 comments on commit 02cfb80

Please sign in to comment.