diff --git a/src/Laravel/tests/FactoryTest.php b/src/Laravel/tests/FactoryTest.php
index 070bb0d..9a6bfc0 100644
--- a/src/Laravel/tests/FactoryTest.php
+++ b/src/Laravel/tests/FactoryTest.php
@@ -19,7 +19,6 @@
use Illuminate\Contracts\Events\Dispatcher as Event;
use Illuminate\Contracts\Filesystem\Factory as Storage;
use Illuminate\Foundation\Testing\TestCase;
-use Mockery;
/**
* @internal
@@ -50,11 +49,11 @@ public function testEncrypt()
{
Carbon::setTestNow(Carbon::create(2018, 4, 24, 9, 32, 33));
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$configMock->shouldReceive('get')->withArgs(['secure_messages.meta_key'])->once()->andReturn('metaKey');
$configMock->shouldReceive('get')->withArgs(['secure_messages.storage_disk_name'])->once()->andReturn('secure_messages');
@@ -70,7 +69,7 @@ public function testEncrypt()
$encrypterMock
->shouldReceive('encrypt')
- ->withArgs([Mockery::any()])
+ ->withArgs([\Mockery::any()])
->times(4)
->andReturn('encryptedKey', 'encryptedMeta', 'encryptedContent', 'encryptedDbKey');
@@ -92,11 +91,11 @@ public function testDecryptMessage()
'content' => 'encryptedContent',
]);
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$decryptedSecureMessage = new SecureMessage();
$decryptedSecureMessage->setContent('Decrypted content');
@@ -114,7 +113,7 @@ public function testDecryptMessage()
$storageMock->shouldReceive('get')->withArgs(['unitTest'])->twice()->andReturn('encryptedStorageKey');
$secureMessageFactoryMock->shouldReceive('setMetaKey')->withArgs(['metaKey'])->once()->andReturnSelf();
- $secureMessageFactoryMock->shouldReceive('decrypt')->withArgs([Mockery::on(function (SecureMessage $secureMessage) {
+ $secureMessageFactoryMock->shouldReceive('decrypt')->withArgs([\Mockery::on(function (SecureMessage $secureMessage) {
$this->assertSame('unitTest', $secureMessage->getId());
$this->assertSame('databaseKey', $secureMessage->getDatabaseKey());
$this->assertSame('storageKey', $secureMessage->getStorageKey());
@@ -140,11 +139,11 @@ public function testCheckVerificationCode()
'content' => 'encryptedContent',
]);
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$decryptedSecureMessage = new SecureMessage();
$decryptedSecureMessage->setContent('Decrypted content');
@@ -162,7 +161,7 @@ public function testCheckVerificationCode()
$storageMock->shouldReceive('get')->withArgs(['unitTest'])->once()->andReturn('encryptedStorageKey');
$secureMessageFactoryMock->shouldReceive('setMetaKey')->withArgs(['metaKey'])->once()->andReturnSelf();
- $secureMessageFactoryMock->shouldReceive('validateEncryptionKey')->withArgs([Mockery::on(function (SecureMessage $secureMessage) {
+ $secureMessageFactoryMock->shouldReceive('validateEncryptionKey')->withArgs([\Mockery::on(function (SecureMessage $secureMessage) {
$this->assertSame('unitTest', $secureMessage->getId());
$this->assertSame('databaseKey', $secureMessage->getDatabaseKey());
$this->assertSame('storageKey', $secureMessage->getStorageKey());
@@ -187,11 +186,11 @@ public function testDecryptMessageStorageKeyNotFound()
'content' => 'encryptedContent',
]);
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$decryptedSecureMessage = new SecureMessage();
$decryptedSecureMessage->setContent('Decrypted content');
@@ -209,7 +208,7 @@ public function testDecryptMessageStorageKeyNotFound()
$secureMessageFactoryMock->shouldReceive('setMetaKey')->withArgs(['metaKey'])->once()->andReturnSelf();
- $eventMock->shouldReceive('dispatch')->withArgs([Mockery::on(function ($event) {
+ $eventMock->shouldReceive('dispatch')->withArgs([\Mockery::on(function ($event) {
return get_class($event) === DecryptionFailed::class;
})])->once();
@@ -229,11 +228,11 @@ public function testDecryptMessageHitpointLimitReached()
'content' => 'encryptedContent',
]);
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$decryptedSecureMessage = new SecureMessage();
$decryptedSecureMessage->setContent('Decrypted content');
@@ -253,7 +252,7 @@ public function testDecryptMessageHitpointLimitReached()
$secureMessageFactoryMock->shouldReceive('setMetaKey')->withArgs(['metaKey'])->once()->andReturnSelf();
$secureMessageFactoryMock->shouldReceive('decrypt')->withAnyArgs()->once()->andThrow(new HitPointLimitReachedException('The maximum number of hit points is reached.'));
- $eventMock->shouldReceive('dispatch')->withArgs([Mockery::on(function ($event) {
+ $eventMock->shouldReceive('dispatch')->withArgs([\Mockery::on(function ($event) {
return get_class($event) === HitPointLimitReached::class;
})])->once();
@@ -272,11 +271,11 @@ public function testDecryptMessageMessageExpired()
'content' => 'encryptedContent',
]);
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$decryptedSecureMessage = new SecureMessage();
$decryptedSecureMessage->setContent('Decrypted content');
@@ -296,7 +295,7 @@ public function testDecryptMessageMessageExpired()
$secureMessageFactoryMock->shouldReceive('setMetaKey')->withArgs(['metaKey'])->once()->andReturnSelf();
$secureMessageFactoryMock->shouldReceive('decrypt')->withAnyArgs()->once()->andThrow(new ExpiredException('This secure message is expired.'));
- $eventMock->shouldReceive('dispatch')->withArgs([Mockery::on(function ($event) {
+ $eventMock->shouldReceive('dispatch')->withArgs([\Mockery::on(function ($event) {
return get_class($event) === SecureMessageExpired::class;
})])->once();
@@ -315,11 +314,11 @@ public function testDecryptMeta()
'content' => 'encryptedContent',
]);
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$decryptedSecureMessage = new SecureMessage();
$decryptedSecureMessage->setContent('Decrypted content');
@@ -332,7 +331,7 @@ public function testDecryptMeta()
$storageMock->shouldReceive('disk')->withArgs(['secure_messages'])->once()->andReturnSelf();
$secureMessageFactoryMock->shouldReceive('setMetaKey')->withArgs(['metaKey'])->once()->andReturnSelf();
- $secureMessageFactoryMock->shouldReceive('decryptMeta')->withArgs([Mockery::on(function (SecureMessage $secureMessage) {
+ $secureMessageFactoryMock->shouldReceive('decryptMeta')->withArgs([\Mockery::on(function (SecureMessage $secureMessage) {
$this->assertSame('unitTest', $secureMessage->getId());
$this->assertSame('meta', $secureMessage->getEncryptedMeta());
@@ -348,11 +347,11 @@ public function testDestroy()
{
SecureMessageModel::insert(['id' => 'unitTest']);
- $secureMessageFactoryMock = Mockery::mock(SecureMessageFactory::class);
- $storageMock = Mockery::mock(Storage::class);
- $encrypterMock = Mockery::mock(Encrypter::class);
- $configMock = Mockery::mock(Config::class);
- $eventMock = Mockery::mock(Event::class);
+ $secureMessageFactoryMock = \Mockery::mock(SecureMessageFactory::class);
+ $storageMock = \Mockery::mock(Storage::class);
+ $encrypterMock = \Mockery::mock(Encrypter::class);
+ $configMock = \Mockery::mock(Config::class);
+ $eventMock = \Mockery::mock(Event::class);
$decryptedSecureMessage = new SecureMessage();
$decryptedSecureMessage->setContent('Decrypted content');
diff --git a/src/Laravel/tests/HousekeepingTest.php b/src/Laravel/tests/HousekeepingTest.php
index 51fc553..85e2a4a 100644
--- a/src/Laravel/tests/HousekeepingTest.php
+++ b/src/Laravel/tests/HousekeepingTest.php
@@ -8,7 +8,6 @@
use Exonet\SecureMessage\SecureMessage;
use Illuminate\Contracts\Console\Kernel;
use Illuminate\Foundation\Testing\TestCase;
-use Mockery;
/**
* @internal
@@ -25,8 +24,8 @@ public function createApplication()
public function testHandle()
{
- $modelMock = Mockery::mock(SecureMessageModel::class);
- $factoryMock = Mockery::mock(SecureMessageFactory::class);
+ $modelMock = \Mockery::mock(SecureMessageModel::class);
+ $factoryMock = \Mockery::mock(SecureMessageFactory::class);
$okSecureMessage = (new SecureMessage())->setId('abc')->setExpiresAt(time() + 10)->setHitPoints(3);
$expiredSecureMessage = (new SecureMessage())->setId('abc')->setExpiresAt(time() - 10)->setHitPoints(3);
@@ -42,7 +41,7 @@ public function testHandle()
$factoryMock->shouldReceive('destroy')->withArgs(['def'])->once();
$factoryMock->shouldReceive('destroy')->withArgs(['xyz'])->once();
- $command = Mockery::mock(Housekeeping::class.'[getOutput,info]')->makePartial();
+ $command = \Mockery::mock(Housekeeping::class.'[getOutput,info]')->makePartial();
$command->shouldReceive('getOutput->isVerbose')->times(2)->andReturnTrue();
$command->shouldReceive('info')->withArgs(['Destroyed secure message [abc]'])->never();
$command->shouldReceive('info')->withArgs(['Destroyed secure message [def]'])->once();
diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php
index 2f3dcea..fb6c5e9 100644
--- a/tests/FactoryTest.php
+++ b/tests/FactoryTest.php
@@ -6,7 +6,6 @@
use Exonet\SecureMessage\Exceptions\InvalidKeyLengthException;
use Exonet\SecureMessage\Factory;
use Exonet\SecureMessage\SecureMessage;
-use Mockery;
use PHPUnit\Framework\TestCase;
/**
@@ -42,8 +41,8 @@ public function testEncrypt()
$factory = (new Factory('metaKey___'))->make('Unit Test', 3, 1337);
$secureMessageResult = new SecureMessage();
- $cryptoMock = Mockery::mock(Crypto::class);
- $cryptoMock->shouldReceive('encrypt')->withArgs([Mockery::on(function (SecureMessage $secureMessage) {
+ $cryptoMock = \Mockery::mock(Crypto::class);
+ $cryptoMock->shouldReceive('encrypt')->withArgs([\Mockery::on(function (SecureMessage $secureMessage) {
$this->assertSame('Unit Test', $secureMessage->getContent());
$this->assertSame(3, $secureMessage->getHitPoints());
$this->assertSame(1337, $secureMessage->getExpiresAt());
@@ -68,8 +67,8 @@ public function testDecrypt()
$secureMessage = new SecureMessage();
$secureMessage->setContent('Unit Test');
- $cryptoMock = Mockery::mock(Crypto::class);
- $cryptoMock->shouldReceive('decrypt')->withArgs([Mockery::on(function (SecureMessage $secureMessage) {
+ $cryptoMock = \Mockery::mock(Crypto::class);
+ $cryptoMock->shouldReceive('decrypt')->withArgs([\Mockery::on(function (SecureMessage $secureMessage) {
$this->assertSame('Unit Test', $secureMessage->getContent());
$this->assertNull($secureMessage->getMetaKey());
@@ -88,8 +87,8 @@ public function testDecryptMeta()
$secureMessage = new SecureMessage();
$secureMessage->setContent('Unit Test');
- $cryptoMock = Mockery::mock(Crypto::class);
- $cryptoMock->shouldReceive('decryptMeta')->withArgs([Mockery::on(function (SecureMessage $secureMessage) {
+ $cryptoMock = \Mockery::mock(Crypto::class);
+ $cryptoMock->shouldReceive('decryptMeta')->withArgs([\Mockery::on(function (SecureMessage $secureMessage) {
$this->assertSame('Unit Test', $secureMessage->getContent());
$this->assertNull($secureMessage->getMetaKey());
@@ -107,8 +106,8 @@ public function testValidateEncryptionKey()
$secureMessage = new SecureMessage();
$secureMessage->setContent('Unit Test');
- $cryptoMock = Mockery::mock(Crypto::class);
- $cryptoMock->shouldReceive('validateEncryptionKey')->withArgs([Mockery::on(function (SecureMessage $secureMessage) {
+ $cryptoMock = \Mockery::mock(Crypto::class);
+ $cryptoMock->shouldReceive('validateEncryptionKey')->withArgs([\Mockery::on(function (SecureMessage $secureMessage) {
$this->assertSame('Unit Test', $secureMessage->getContent());
$this->assertNull($secureMessage->getMetaKey());