Skip to content

Commit

Permalink
use get method on config repository to access value
Browse files Browse the repository at this point in the history
also needed to update the tests to actually use a config repository
rather than just an array, otherwise the tests will fail with a ‘call
to member function get() on array’ message
  • Loading branch information
browner12 committed Apr 20, 2017
1 parent 1c40e8f commit 6640139
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Illuminate/Queue/QueueManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function setDefaultDriver($name)
*/
public function getQueuePrefix()
{
return isset($this->app['config']['queue.prefix']) ? $this->app['config']['queue.prefix'] : null;
return $this->app['config']->get('queue.prefix');
}

/**
Expand Down
29 changes: 18 additions & 11 deletions tests/Queue/QueueManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Mockery as m;
use PHPUnit\Framework\TestCase;
use Illuminate\Config\Repository;
use Illuminate\Queue\QueueManager;

class QueueManagerTest extends TestCase
Expand All @@ -15,11 +16,13 @@ public function tearDown()

public function testDefaultConnectionCanBeResolved()
{
$config = new Repository([
'queue.default' => 'sync',
'queue.connections.sync' => ['driver' => 'sync'],
]);

$app = [
'config' => [
'queue.default' => 'sync',
'queue.connections.sync' => ['driver' => 'sync'],
],
'config' => $config,
'encrypter' => $encrypter = m::mock('Illuminate\Contracts\Encryption\Encrypter'),
];

Expand All @@ -39,11 +42,13 @@ public function testDefaultConnectionCanBeResolved()

public function testOtherConnectionCanBeResolved()
{
$config = new Repository([
'queue.default' => 'sync',
'queue.connections.foo' => ['driver' => 'bar'],
]);

$app = [
'config' => [
'queue.default' => 'sync',
'queue.connections.foo' => ['driver' => 'bar'],
],
'config' => $config,
'encrypter' => $encrypter = m::mock('Illuminate\Contracts\Encryption\Encrypter'),
];

Expand All @@ -63,10 +68,12 @@ public function testOtherConnectionCanBeResolved()

public function testNullConnectionCanBeResolved()
{
$config = new Repository([
'queue.default' => 'null',
]);

$app = [
'config' => [
'queue.default' => 'null',
],
'config' => $config,
'encrypter' => $encrypter = m::mock('Illuminate\Contracts\Encryption\Encrypter'),
];

Expand Down

0 comments on commit 6640139

Please sign in to comment.