mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-13 13:54:23 +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
|
class AbstractSearchTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Ab
|
* @var \Chill\MainBundle\Search\AbstractSearch
|
||||||
* @var type
|
|
||||||
* @var typestractS
|
|
||||||
*/
|
*/
|
||||||
private $stub;
|
private $stub;
|
||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
$this->stub = $this->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch',
|
$this->stub = $this->getMockForAbstractClass('Chill\MainBundle\Search\AbstractSearch');
|
||||||
array(),
|
|
||||||
'',
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
true,
|
|
||||||
array('parseDate'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParseDateRegular()
|
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('2014', $date->format('Y'));
|
||||||
$this->assertEquals('05', $date->format('m'));
|
$this->assertEquals('05', $date->format('m'));
|
||||||
$this->assertEquals('01', $date->format('d'));
|
$this->assertEquals('01', $date->format('d'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testRecompose()
|
||||||
|
{
|
||||||
|
$this->markTestSkipped();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user