mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-23 18:03:17 +00:00
Clicking on a facet value on the left pane now return the expected result count. This commit implement a new "raw" matcher. It can be used like `r"some raw value"`. It operate on the the `.raw` multi-field and skips all analysis. Escaping `"` is supported by prepending a backslash `\"`. You can also escape the escaping character `\` by doubling it (`\\`). Adds a new `ContextAbleInterface` to differenciate matcher supporting an optional context from those who can't. Fixes an issue with `QueryContext::narrowToFields()` ignoring passed fields.
28 lines
611 B
PHP
28 lines
611 B
PHP
<?php
|
|
|
|
namespace Alchemy\Tests\Phrasea\SearchEngine;
|
|
|
|
use Alchemy\Phrasea\SearchEngine\Elastic\Search\Escaper;
|
|
|
|
class EscaperTest extends \PHPUnit_Framework_TestCase
|
|
{
|
|
/**
|
|
* @dataProvider escapeRawProvider
|
|
*/
|
|
public function testEscapeRaw($unescaped, $escaped)
|
|
{
|
|
$escaper = new Escaper();
|
|
$this->assertEquals($escaped, $escaper->escapeRaw($unescaped));
|
|
}
|
|
|
|
public function escapeRawProvider()
|
|
{
|
|
return [
|
|
['foo', 'foo'],
|
|
['"', '\\"'],
|
|
['\\', '\\\\'],
|
|
['foo"bar\\baz', 'foo\"bar\\\\baz'],
|
|
];
|
|
}
|
|
}
|