getRepository() public method

Retrieve a repository record by name.
public getRepository ( string $name ) : array
$name string the name of the desired repository
return array
コード例 #1
0
 /**
  * @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');
 }
コード例 #2
0
 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");
 }
コード例 #3
0
 /**
  * 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"];
 }