public function testConstructor() { $factory = new Factory(); $repository = $this->getMock('Jackalope\\Repository', array(), array($factory), '', false); $workspaceName = 'asdfads'; $userID = 'abcd'; $cred = new SimpleCredentials($userID, 'xxxx'); $cred->setAttribute('test', 'toast'); $cred->setAttribute('other', 'value'); $transport = $this->getMockBuilder('Jackalope\\Transport\\TransportInterface')->disableOriginalConstructor()->getMock(array('login', 'getRepositoryDescriptors', 'getNamespaces'), array($factory, 'http://example.com')); $transport->expects($this->any())->method('getNamespaces')->will($this->returnValue(array())); $s = new Session($factory, $repository, $workspaceName, $cred, $transport); $this->assertSame($repository, $s->getRepository()); $this->assertSame($userID, $s->getUserID()); $this->assertSame(array('test', 'other'), $s->getAttributeNames()); $this->assertSame('toast', $s->getAttribute('test')); $this->assertSame('value', $s->getAttribute('other')); }
public function testConstructor() { $factory = new Factory(); $repository = $this->getRepositoryMock(); $workspaceName = 'asdfads'; $userID = 'abcd'; $cred = new SimpleCredentials($userID, 'xxxx'); $cred->setAttribute('test', 'toast'); $cred->setAttribute('other', 'value'); $transport = $this->getTransportStub(); $transport->expects($this->any())->method('getNamespaces')->will($this->returnValue(array())); $s = new Session($factory, $repository, $workspaceName, $cred, $transport); $this->assertSame($repository, $s->getRepository()); $this->assertSame($userID, $s->getUserID()); $this->assertSame(array('test', 'other'), $s->getAttributeNames()); $this->assertSame('toast', $s->getAttribute('test')); $this->assertSame('value', $s->getAttribute('other')); }
/** * @depends testConstructor */ public function testGetAttributeNames(SimpleCredentials $credentials) { $credentials->setAttribute('other', 'test'); $this->assertEquals(array('other'), $credentials->getAttributeNames()); }