-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generic correct merging of local params (#939)
* Bugfix for facet queries with local parameters * Generic correct merging of local params * Missing test coverage * Handle arrays in Helper::qparser() the same as in AbstractRequestBuilder::renderLocalParams() * Rendering booleans and 0 in local params * Remove LocalParameters::render() * Style fixes Co-authored-by: Markus Kalkbrenner <git@kalki.de>
- Loading branch information
1 parent
08b839f
commit 2493816
Showing
12 changed files
with
413 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Solarium\Tests\Core\Query\LocalParameters; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Solarium\Core\Query\LocalParameters\LocalParameter; | ||
|
||
/** | ||
* LocalParameterTest. | ||
*/ | ||
class LocalParameterTest extends TestCase | ||
{ | ||
/** | ||
* @var LocalParameter | ||
*/ | ||
protected $parameter; | ||
|
||
public function setUp(): void | ||
{ | ||
$this->parameter = new LocalParameter(LocalParameter::TYPE_KEY); | ||
} | ||
|
||
public function testGetType(): void | ||
{ | ||
$this->assertSame(LocalParameter::TYPE_KEY, $this->parameter->getType()); | ||
} | ||
|
||
public function testSetValues(): void | ||
{ | ||
$this->parameter->setValues(['value1', 'value2']); | ||
$this->assertSame(['value1', 'value2'], $this->parameter->getValues()); | ||
|
||
$this->parameter->setValues(['value3', 'value4']); | ||
$this->assertSame(['value3', 'value4'], $this->parameter->getValues()); | ||
} | ||
|
||
public function testAddValue(): void | ||
{ | ||
$this->parameter->addValue('value1'); | ||
$this->assertSame(['value1'], $this->parameter->getValues()); | ||
|
||
$this->parameter->addValue('value2'); | ||
$this->assertSame(['value1', 'value2'], $this->parameter->getValues()); | ||
} | ||
|
||
public function testAddValues(): void | ||
{ | ||
$this->parameter->addValues(['value1', 'value2']); | ||
$this->assertSame(['value1', 'value2'], $this->parameter->getValues()); | ||
|
||
$this->parameter->addValues(['value3', 'value4']); | ||
$this->assertSame(['value1', 'value2', 'value3', 'value4'], $this->parameter->getValues()); | ||
} | ||
|
||
public function testRemoveValue(): void | ||
{ | ||
$this->parameter->setValues(['value1', 'value2']); | ||
$this->assertSame(['value1', 'value2'], $this->parameter->getValues()); | ||
|
||
$this->parameter->removeValue('value1'); | ||
$this->assertSame(['value2'], $this->parameter->getValues()); | ||
} | ||
|
||
public function testClearValues(): void | ||
{ | ||
$this->parameter->setValues(['value1', 'value2']); | ||
$this->assertSame(['value1', 'value2'], $this->parameter->getValues()); | ||
|
||
$this->parameter->clearValues(); | ||
$this->assertEmpty($this->parameter->getValues()); | ||
} | ||
|
||
public function testToString(): void | ||
{ | ||
$this->parameter->clearValues(); | ||
$this->assertSame('', (string) $this->parameter); | ||
|
||
$this->parameter->setValues(['']); | ||
$this->assertSame('', (string) $this->parameter); | ||
|
||
$this->parameter->setValues(['value1']); | ||
$this->assertSame('key=value1', (string) $this->parameter); | ||
|
||
$this->parameter->setValues(['value1', 'value2']); | ||
$this->assertSame('key=value1,value2', (string) $this->parameter); | ||
} | ||
} |
Oops, something went wrong.