/**
  * @param mixed[] $data
  * @param string $signature
  * @param bool $valid
  * @param SignatureDataFormatter $signatureDataFormatter
  *
  * @dataProvider getSignDataData
  */
 public function testVerifyData(array $data, string $signature, bool $valid, SignatureDataFormatter $signatureDataFormatter)
 {
     if ($valid) {
         $this->assertTrue($this->cryptoService->verifyData($data, $signature, $signatureDataFormatter));
     } else {
         $this->assertFalse($this->cryptoService->verifyData($data, $signature, $signatureDataFormatter));
     }
 }
Exemple #2
0
 public function testDelete()
 {
     Storage::put('test-file.txt', 'what is this');
     $file = factory(\Yab\Quarx\Models\File::class)->make(['id' => 2, 'location' => ['file_a' => ['name' => CryptoService::encrypt('test-file.txt'), 'original' => 'test-file.txt', 'mime' => 'txt', 'size' => 24]]]);
     $this->call('POST', 'quarx/files', $file->getAttributes());
     $response = $this->call('DELETE', 'quarx/files/2');
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertRedirectedTo('quarx/files');
 }
Exemple #3
0
 public function testDelete()
 {
     $uploadedFile = new Symfony\Component\HttpFoundation\File\UploadedFile(__DIR__ . '/test-pic.jpg', 'test-pic.jpg');
     $image = (array) factory(\Yab\Quarx\Models\Image::class)->make(['id' => 2]);
     $image['location'] = [['name' => CryptoService::encrypt('files/dumb'), 'original' => 'what.jpg'], ['name' => CryptoService::encrypt('files/dumb'), 'original' => 'what.jpg']];
     $this->call('POST', 'quarx/images', $image, [], ['location' => ['image' => $uploadedFile]]);
     $response = $this->call('DELETE', 'quarx/images/2');
     $this->assertEquals(302, $response->getStatusCode());
     $this->assertRedirectedTo('quarx/images');
 }
Exemple #4
0
 /**
  * (non-PHPdoc)
  * @see \Veritas\Identity\Credential::verify()
  */
 public function verify($plainTextValue)
 {
     return $this->encryptedValue == $this->cryptoService->encrypt($plainTextValue);
 }