/** * @expectedException RuntimeException * @expectedExceptionMessage The configured access control adapter is not mutable * @covers ImboCli\Command\AddPublicKey::getAclAdapter */ public function testThrowsOnImmutableAdapter() { $command = new AddPublicKey(); $command->setConfig(['accessControl' => $this->getMock('Imbo\\Auth\\AccessControl\\Adapter\\AdapterInterface')]); $commandTester = new CommandTester($command); $commandTester->execute(['publicKey' => 'foo']); }
/** * @covers ImboCli\Command\AddPublicKey::execute * @covers ImboCli\Command\AddPublicKey::askForAnotherAclRule * @covers ImboCli\Command\AddPublicKey::askForCustomResources */ public function testPromtpsForListOfCustomResourcesIfOptionIsSelected() { $allResources = Resource::getAllResources(); sort($allResources); $this->adapter->expects($this->once())->method('addAccessRule')->with('foo', ['resources' => ['foo.read', 'bar.write'], 'users' => '*']); $this->adapter->expects($this->once())->method('addKeyPair')->with('foo', 'bar'); $helper = $this->command->getHelper('question'); $helper->setInputStream($this->getInputStream(['4', 'foo.read,bar.write', '*', 'n'])); $commandTester = new CommandTester($this->command); $commandTester->execute(['publicKey' => 'foo', 'privateKey' => 'bar']); }