|
@@ 210-224 (lines=15) @@
|
| 207 |
|
$this->assertNotContains('IFD0', $exif['SectionsFound']); |
| 208 |
|
} |
| 209 |
|
|
| 210 |
|
public function testAddFailureMaxUploadsPerUser() |
| 211 |
|
{ |
| 212 |
|
Configure::read('Saito.Settings.uploader')->setMaxNumberOfUploadsPerUser(1); |
| 213 |
|
$this->loginJwt(1); |
| 214 |
|
|
| 215 |
|
$Uploads = TableRegistry::getTableLocator()->get('ImageUploader.Uploads'); |
| 216 |
|
$count = $Uploads->find()->count(); |
| 217 |
|
|
| 218 |
|
$this->expectException(GenericApiException::class); |
| 219 |
|
$this->expectExceptionMessage('Error: Reached the maximal number of 1 uploads.'); |
| 220 |
|
|
| 221 |
|
$this->upload($this->file); |
| 222 |
|
|
| 223 |
|
$this->assertEquals($count, $Uploads->find()->count()); |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
public function testAddFailureMaxDocumentSize() |
| 227 |
|
{ |
|
@@ 226-243 (lines=18) @@
|
| 223 |
|
$this->assertEquals($count, $Uploads->find()->count()); |
| 224 |
|
} |
| 225 |
|
|
| 226 |
|
public function testAddFailureMaxDocumentSize() |
| 227 |
|
{ |
| 228 |
|
Configure::read('Saito.Settings.uploader') |
| 229 |
|
->setMaxNumberOfUploadsPerUser(10) |
| 230 |
|
->addType('image/png', 10); |
| 231 |
|
|
| 232 |
|
$this->loginJwt(1); |
| 233 |
|
|
| 234 |
|
$Uploads = TableRegistry::getTableLocator()->get('ImageUploader.Uploads'); |
| 235 |
|
$count = $Uploads->find()->count(); |
| 236 |
|
|
| 237 |
|
$this->expectException(GenericApiException::class); |
| 238 |
|
$this->expectExceptionMessage('Error: File size exceeds allowed limit of 10 Bytes.'); |
| 239 |
|
|
| 240 |
|
$this->upload($this->file); |
| 241 |
|
|
| 242 |
|
$this->assertEquals($count, $Uploads->find()->count()); |
| 243 |
|
} |
| 244 |
|
|
| 245 |
|
public function testAddFailureDoubleUpload() |
| 246 |
|
{ |