Пример #1
0
 /**
  * @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']);
 }
Пример #2
0
 /**
  * @expectedException Imbo\Exception\DatabaseException
  * @expectedExceptionCode 500
  * @expectedExceptionMessage Could not delete rule from database
  */
 public function testDeleteAccessRuleWithIdThatDoesNotExist()
 {
     $this->assertFalse($this->adapter->deleteAccessRule('public', 'asdasd'));
 }