Skip to content

Commit

Permalink
Update constraints and tests for Laravel 5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
squigg committed Jul 13, 2019
1 parent 905d02b commit f833861
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -17,14 +17,14 @@
],
"require": {
"php": "^7.1",
"illuminate/queue": ">=5.7,<5.8",
"illuminate/queue": ">=5.8,<5.9",
"microsoft/azure-storage-queue": ">=1.0.0,<1.2"
},
"require-dev": {
"phpunit/phpunit": "~7.0",
"orchestra/testbench": "3.7.*",
"orchestra/testbench": "3.8.*",
"mockery/mockery": "~1.0",
"satooshi/php-coveralls": "~2.0"
"php-coveralls/php-coveralls": "~2.0"
},
"autoload": {
"psr-4": {
Expand Down
2 changes: 1 addition & 1 deletion tests/AzureConnectorTest.php
Expand Up @@ -19,7 +19,7 @@ class AzureConnectorTest extends TestCase
protected $queueRestProxy;
protected $config;

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
2 changes: 1 addition & 1 deletion tests/AzureJobTest.php
Expand Up @@ -28,7 +28,7 @@ class AzureJobTest extends TestCase
*/
protected $job;

public function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
13 changes: 9 additions & 4 deletions tests/AzureQueueServiceProviderTest.php
@@ -1,22 +1,27 @@
<?php

use Illuminate\Foundation\Application;
use Illuminate\Queue\QueueManager;
use Squigg\AzureQueueLaravel\AzureConnector;
use Squigg\AzureQueueLaravel\AzureQueueServiceProvider;

class AzureQueueServiceProviderTest extends TestCase
{


/** @test */
public function it_can_boot_and_setup_queue_manager()
{
$mockApp = Mockery::mock(\Illuminate\Foundation\Application::class);
$mockQueueManager = Mockery::mock(\Illuminate\Queue\QueueManager::class);
$mockApp = Mockery::mock(Application::class);
$mockQueueManager = Mockery::mock(QueueManager::class);

$mockQueueManager->shouldReceive('addConnector')->withArgs(function ($driver, $closure) {
return $driver == 'azure' && ($closure() instanceof \Squigg\AzureQueueLaravel\AzureConnector);
return $driver == 'azure' && ($closure() instanceof AzureConnector);
});

$mockApp->shouldReceive('offsetGet')->with('queue')->andReturn($mockQueueManager);

$serviceProvider = new \Squigg\AzureQueueLaravel\AzureQueueServiceProvider($mockApp);
$serviceProvider = new AzureQueueServiceProvider($mockApp);

$serviceProvider->boot();

Expand Down
12 changes: 6 additions & 6 deletions tests/AzureQueueTest.php
Expand Up @@ -18,18 +18,18 @@ class AzureQueueTest extends TestCase
*/
protected $queue;

public function setUp()
protected function setUp(): void
{
parent::setUp();
$this->azure = Mockery::mock(\MicrosoftAzure\Storage\Queue\Internal\IQueue::class);
$this->azure = Mockery::mock(IQueue::class);
$this->queue = new AzureQueue($this->azure, 'myqueue', 5);
$this->queue->setContainer($this->app);
}

/**
* @param Mockery\CompositeExpectation $mock
* @param Mockery\Expectation $mock
* @param int $count
* @return \Mockery\CompositeExpectation
* @return Mockery\Expectation
*/
protected function setListMessagesReturnExpectation($mock, $count = 1)
{
Expand All @@ -41,7 +41,7 @@ public function it_can_push_message_to_queue()
{
$this->azure->shouldReceive('createMessage')->once()->withArgs([
"myqueue",
'{"displayName":"job","job":"job","maxTries":null,"timeout":null,"data":"data"}'
'{"displayName":"job","job":"job","maxTries":null,"delay":null,"timeout":null,"data":"data"}'
]);
$this->queue->push('job', 'data');
}
Expand Down Expand Up @@ -113,7 +113,7 @@ public function it_can_queue_a_job_for_later()
{
$this->azure->shouldReceive('createMessage')->once()->withArgs(
function ($queue, $payload, CreateMessageOptions $options) {
return $queue == 'myqueue' && $payload == '{"displayName":"job","job":"job","maxTries":null,"timeout":null,"data":"data"}' && $options->getVisibilityTimeoutInSeconds() == 10;
return $queue == 'myqueue' && $payload == '{"displayName":"job","job":"job","maxTries":null,"delay":null,"timeout":null,"data":"data"}' && $options->getVisibilityTimeoutInSeconds() == 10;
}
);

Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase.php
Expand Up @@ -15,7 +15,7 @@ protected function getPackageAliases($app)
return [];
}

public function tearDown()
protected function tearDown(): void
{
$this->addToAssertionCount(Mockery::getContainer()->mockery_getExpectationCount());
Mockery::close();
Expand Down

0 comments on commit f833861

Please sign in to comment.