Example #1
0
 public function testCreateQueue()
 {
     // Create ok
     $clientSqs = $this->getClientSqs();
     $clientSqs->getMockController()->createQueue = function () {
         $model = new \mock\Guzzle\Service\Resource\Model();
         $model->getMockController()->get = function () {
             return "queueUrl";
         };
         return $model;
     };
     $this->if($client = new Base($clientSqs))->and($queueName = 'name')->and($queueAttr = ['key' => 'value'])->and($params = ['QueueName' => $queueName, 'Attributes' => $queueAttr])->variable($client->createQueue($queueName, $queueAttr))->mock($clientSqs)->call('createQueue')->withArguments($params)->once();
     // Create error
     $clientSqs->getMockController()->createQueue = function () {
         throw new SqsException();
     };
     $this->if($client = new Base($clientSqs))->and($queueName = 'name')->exception(function () use($client, $queueName) {
         $client->createQueue($queueName);
     });
 }