[search] allow '-' in argument name

This commit is contained in:
Julien Fastré 2016-05-17 21:29:20 +02:00
parent f56de656d3
commit 6011c720a9
2 changed files with 12 additions and 1 deletions

View File

@ -82,7 +82,7 @@ class SearchProvider
private function extractTerms(&$subject)
{
$terms = array();
preg_match_all('/([a-z]+):([\w\-]+|\([^\(\r\n]+\))/', $subject, $matches);
preg_match_all('/([a-z\-]+):([\w\-]+|\([^\(\r\n]+\))/', $subject, $matches);
foreach ($matches[2] as $key => $match) {
//remove from search pattern

View File

@ -165,6 +165,17 @@ class SearchProviderTest extends \PHPUnit_Framework_TestCase
), $terms);
}
public function testArgumentNameWithTrait()
{
$terms = $this->p('date-from:2016-05-04');
$this->assertEquals(array(
'_domain' => null,
'date-from' => '2016-05-04',
'_default' => ''
), $terms);
}
/**
* Test the behaviour when no domain is provided in the search pattern :
* the default search should be enabled