Retrieve a repository record by name.
public getRepository ( string $name ) : array | ||
$name | string | the name of the desired repository |
리턴 | array |
/** * @group functional */ public function testRegisterRepository() { $repositoryName = 'testrepo'; $location = $this->_snapshotPath . 'backup1'; $response = $this->_snapshot->registerRepository($repositoryName, 'fs', array('location' => $location)); $this->assertTrue($response->isOk()); $response = $this->_snapshot->getRepository($repositoryName); $this->assertEquals($location, $response['settings']['location']); // attempt to retrieve a repository which does not exist $this->setExpectedException('Elastica\\Exception\\NotFoundException'); $this->_snapshot->getRepository('foobar'); }
public function testRegisterRepository() { $name = "test_register"; $location = "/tmp/test_register"; $response = $this->_snapshot->registerRepository($name, "fs", array("location" => $location)); $this->assertTrue($response->isOk()); $response = $this->_snapshot->getRepository($name); $this->assertEquals($location, $response["settings"]["location"]); // attempt to retrieve a repository which does not exist $this->setExpectedException('Elastica\\Exception\\NotFoundException'); $this->_snapshot->getRepository("foobar"); }
/** * Méthode accesseur du répertoire pour le snapshot * * @param string $name_repository Le nom du répertoire * * @return string Le chemin du répertoire */ public function getRepository($name_repository) { $response = $this->_snapshot->getRepository($name_repository); return $response["settings"]["location"]; }