mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 13:24:25 +00:00
create recompose method + test (skipped), fix tests for dateParse
This commit is contained in:
parent
5289ad9c2c
commit
a48a0be187
@ -52,4 +52,27 @@ abstract class AbstractSearch implements SearchInterface
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function recomposePattern(array $terms, array $supportedTerms, $domain = '')
|
||||
{
|
||||
$recomposed = '';
|
||||
|
||||
if ($domain !== '')
|
||||
{
|
||||
$recomposed .= '@'.$domain.' ';
|
||||
}
|
||||
|
||||
foreach ($supportedTerms as $term) {
|
||||
if (array_key_exists($term, $terms) && $term !== '_default') {
|
||||
$recomposed .= ' '.$term.':';
|
||||
$recomposed .= (mb_stristr(' ', $terms[$term]) === FALSE) ? $terms[$term] : '('.$terms[$term].')';
|
||||
}
|
||||
}
|
||||
|
||||
if ($terms['_default'] !== '') {
|
||||
$recomposed .= ' '.$terms['_default'];
|
||||
}
|
||||
|
||||
return $recomposed;
|
||||
}
|
||||
}
|
@ -28,31 +28,28 @@ namespace Chill\MainBundle\Tests\Search;
|
||||
class AbstractSearchTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @var Ab
|
||||
* @var type
|
||||
* @var typestractS
|
||||
* @var \Chill\MainBundle\Search\AbstractSearch
|
||||
*/
|
||||
private $stub;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->stub = $this->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch',
|
||||
array(),
|
||||
'',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
array('parseDate'));
|
||||
$this->stub = $this->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
|
||||
}
|
||||
|
||||
public function testParseDateRegular()
|
||||
{
|
||||
$this->markTestSkipped('We have to learn how to mock concret methods for abstract class');
|
||||
|
||||
$date = $this->stub->parseDate('2014-05-01');
|
||||
|
||||
//var_dump($this->stub);
|
||||
$date = $this->stub->parseDate('2014-05-01');
|
||||
|
||||
$this->assertEquals('2014', $date->format('Y'));
|
||||
$this->assertEquals('05', $date->format('m'));
|
||||
$this->assertEquals('01', $date->format('d'));
|
||||
}
|
||||
|
||||
public function testRecompose()
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user