Jackalope\Repository::getDescriptor PHP Метод

getDescriptor() публичный Метод

{@inheritDoc}
public getDescriptor ( $key )
    public function getDescriptor($key)
    {
        // handle some of the keys locally
        switch ($key) {
            case self::JACKALOPE_OPTION_STREAM_WRAPPER:
                return $this->options['stream_wrapper'];
            case self::OPTION_TRANSACTIONS_SUPPORTED:
                return $this->options['transactions'];
            case self::OPTION_LIFECYCLE_SUPPORTED:
            case self::OPTION_SHAREABLE_NODES_SUPPORTED:
            case self::OPTION_RETENTION_SUPPORTED:
            case self::OPTION_ACCESS_CONTROL_SUPPORTED:
                return false;
        }
        if (null === $this->descriptors) {
            $this->loadDescriptors();
        }
        return isset($this->descriptors[$key]) ? $this->descriptors[$key] : null;
    }

Usage Example

Пример #1
0
 public function testConstructor()
 {
     $factory = new Factory();
     $credentials = new SimpleCredentials('test', 'cred');
     $workspaceName = 'sadf3sd';
     $transport = $this->getTransportStub();
     $transport->expects($this->once())->method('login')->with($this->equalTo($credentials), $this->equalTo($workspaceName))->will($this->returnValue(true));
     $transport->expects($this->once())->method('getRepositoryDescriptors')->will($this->returnValue(array('bla' => 'bli')));
     $transport->expects($this->any())->method('getNamespaces')->will($this->returnValue(array()));
     $repo = new Repository($factory, $transport);
     $session = $repo->login($credentials, $workspaceName);
     $this->assertInstanceOf('Jackalope\\Session', $session);
     $this->assertContains('bla', $repo->getDescriptorKeys());
     $this->assertSame('bli', $repo->getDescriptor('bla'));
 }