-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented the 'partial_replace' feature (#208)
* Implemented the 'partial_replace' feature * Updated path setting for PartialReplace * Updated path setting for PartialReplace * Fixed passing params for partialReplace * Updated the test on partialReplace --------- Co-authored-by: nick <[email protected]>
- Loading branch information
1 parent
3f2e3c6
commit a9eee18
Showing
6 changed files
with
103 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
|
||
namespace Manticoresearch\Endpoints; | ||
|
||
use Manticoresearch\Request; | ||
|
||
/** | ||
* Class PartialReplace | ||
* @package Manticoresearch\Endpoints | ||
*/ | ||
class PartialReplace extends Request | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $index; | ||
|
||
/** | ||
* @param string $index | ||
* @param int $id | ||
*/ | ||
public function setPathByIndexAndId($index, $id) { | ||
$path = '/' . $index . '/_update/' . $id; | ||
parent::setPath($path); | ||
} | ||
|
||
/** | ||
* @return mixed|string | ||
*/ | ||
public function getMethod() { | ||
return 'POST'; | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
namespace Manticoresearch\Test\Endpoints; | ||
|
||
class PartialReplaceTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
|
||
public function testGetPath() { | ||
$replace = new \Manticoresearch\Endpoints\PartialReplace(); | ||
$replace->setPathByIndexAndId('test', 1); | ||
$this->assertEquals('/test/_update/1', $replace->getPath()); | ||
} | ||
|
||
public function testGetMethod() { | ||
$replace = new \Manticoresearch\Endpoints\Replace(); | ||
$this->assertEquals('POST', $replace->getMethod()); | ||
} | ||
} |
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