Beispiel #1
0
 /**
  * @expectedException Imbo\Exception\DatabaseException
  * @expectedExceptionCode 500
  * @expectedExceptionMessage Could not delete resource group from database
  */
 public function testThrowsExceptionWhenUnableToRemoveAclFromGroup()
 {
     $this->aclGroupCollection->expects($this->once())->method('remove')->with(['name' => 'name'])->will($this->returnValue(['ok' => true]));
     $this->aclCollection->expects($this->once())->method('update')->with(['acl.group' => 'name'], ['$pull' => ['acl' => ['group' => 'name']]])->will($this->throwException(new MongoException()));
     $this->adapter->deleteResourceGroup('name');
 }
Beispiel #2
0
 /**
  * @covers Imbo\Database\MongoDB::getImageMimeType
  * @expectedException Imbo\Exception\DatabaseException
  * @expectedExceptionMessage Unable to fetch image meta data
  * @expectedExceptionCode 500
  */
 public function testThrowsExceptionWhenMongoFailsDuringGetImageMimeType()
 {
     $this->imageCollection->expects($this->once())->method('findOne')->will($this->throwException(new MongoException()));
     $this->driver->getImageMimeType('key', 'identifier');
 }