Skip to content

Commit

Permalink
EZP-24271: implemented DateAndTime search tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pspanja committed Apr 30, 2015
1 parent f915df8 commit 0573ed1
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion Repository/Tests/FieldType/DateAndTimeIntegrationTest.php
Expand Up @@ -11,14 +11,15 @@

use eZ\Publish\Core\FieldType\DateAndTime\Value as DateAndTimeValue;
use eZ\Publish\API\Repository\Values\Content\Field;
use DateTime;

/**
* Integration test for use field type
*
* @group integration
* @group field-type
*/
class DateAndTimeIntegrationTest extends BaseIntegrationTest
class DateAndTimeIntegrationTest extends SearchBaseIntegrationTest
{
/**
* Get name of tested field type
Expand Down Expand Up @@ -349,4 +350,38 @@ public function providerForTestIsNotEmptyValue()
),
);
}

protected function getValidSearchValueOne()
{
return "2012-04-15T15:43:56Z";
}

protected function getValidSearchValueTwo()
{
return "2015-04-15T15:43:56Z";
}

protected function getSearchTargetValueOne()
{
// Handling Legacy Search Engine, which stores DateAndTime value as integer timestamp
if ( ltrim( get_class( $this->getSetupFactory() ), '\\' ) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy' )
{
$dateTime = new DateTime( $this->getValidSearchValueOne() );
return $dateTime->getTimestamp();
}

return parent::getSearchTargetValueOne();
}

protected function getSearchTargetValueTwo()
{
// Handling Legacy Search Engine, which stores DateAndTime value as integer timestamp
if ( ltrim( get_class( $this->getSetupFactory() ), '\\' ) === 'eZ\Publish\API\Repository\Tests\SetupFactory\Legacy' )
{
$dateTime = new DateTime( $this->getValidSearchValueTwo() );
return $dateTime->getTimestamp();
}

return parent::getSearchTargetValueTwo();
}
}

0 comments on commit 0573ed1

Please sign in to comment.