public function getClientSqs() { $this->mockGenerator->shuntParentClassCalls(); $clientSqs = new \mock\Aws\Sqs\SqsClient(new \mock\Aws\Common\Credentials\CredentialsInterface(), new \mock\Aws\Common\Signature\SignatureInterface(), new \mock\Guzzle\Common\Collection()); $clientSqs->getMockController()->getQueueUrl = function () { $model = new \mock\Guzzle\Service\Resource\Model(); $model->getMockController()->get = function () { return "queueUrl"; }; return $model; }; return $clientSqs; }
public function testMalformedMessageException() { $this->mockGenerator->orphanize('__construct'); $this->mockGenerator->shuntParentClassCalls(); $mockSqsClient = new \mock\Aws\Sqs\SqsClient(); $mockQueueUrlModel = new \mock\Guzzle\Service\Resource\Model(); $priorityHandler = new ThreeLevelPriorityHandler(); $sqsAdapter = new \ReputationVIP\QueueClient\Adapter\SQSAdapter($mockSqsClient, $priorityHandler); $mockSqsClient->getMockController()->getQueueUrl = function () use($mockQueueUrlModel) { return $mockQueueUrlModel; }; $mockQueueUrlModel->getMockController()->get = function () use($mockQueueUrlModel) { return [['Body' => 'test message one']]; }; $mockSqsClient->getMockController()->receiveMessage = function () use($mockQueueUrlModel) { return $mockQueueUrlModel; }; $this->exception(function () use($sqsAdapter) { $sqsAdapter->getMessages('testQueue', 1); })->isInstanceOf('\\ReputationVIP\\QueueClient\\Adapter\\Exception\\MalformedMessageException'); }
public function testSQSAdapterGetPrioritiesHandler() { $this->mockGenerator->orphanize('__construct'); $this->mockGenerator->shuntParentClassCalls(); $mockSqsClient = new \mock\Aws\Sqs\SqsClient(); $mockQueueUrlModel = new \mock\Guzzle\Service\Resource\Model(); $SQSAdapter = new \ReputationVIP\QueueClient\Adapter\SQSAdapter($mockSqsClient); $mockSqsClient->getMockController()->getQueueUrl = function () use($mockQueueUrlModel) { return $mockQueueUrlModel; }; $mockQueueUrlModel->getMockController()->get = function () use($mockQueueUrlModel) { return null; }; $mockSqsClient->getMockController()->purgeQueue = function () use($mockQueueUrlModel) { return $mockQueueUrlModel; }; $this->given($SQSAdapter)->class($SQSAdapter->getPriorityHandler())->hasInterface('\\ReputationVIP\\QueueClient\\PriorityHandler\\PriorityHandlerInterface'); }