Skip to content

Commit

Permalink
QueueManager class tested
Browse files Browse the repository at this point in the history
  • Loading branch information
A5hleyRich committed Oct 8, 2017
1 parent 91ed39a commit ac522a4
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/vendor
composer.lock
composer.lock
coverage.clover
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
]
},
"require-dev": {
"phpunit/phpunit": "~4.8.0"
"phpunit/phpunit": "~4.8.0",
"10up/wp_mock": "0.2.0"
}
}
8 changes: 8 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,12 @@
<directory prefix="Test" suffix=".php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
<exclude>
<directory suffix=".php">./vendor</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
9 changes: 0 additions & 9 deletions tests/TestQueue.php

This file was deleted.

33 changes: 33 additions & 0 deletions tests/TestQueueManager.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

use PHPUnit\Framework\TestCase;
use WP_Queue\Exceptions\ConnectionNotFoundException;
use WP_Queue\Queue;
use WP_Queue\QueueManager;

class TestQueueManager extends TestCase {

public function setUp() {
WP_Mock::setUp();

global $wpdb;
$wpdb = Mockery::mock( 'WPDB' );
$wpdb->prefix = 'wp_';
}

public function tearDown() {
WP_Mock::tearDown();
}

public function test_resolve() {
$queue = QueueManager::resolve( 'database' );
$this->assertInstanceOf( Queue::class, $queue );
$queue = QueueManager::resolve( 'database' );
$this->assertInstanceOf( Queue::class, $queue );
}

public function test_resolve_exception() {
$this->setExpectedException( ConnectionNotFoundException::class);
QueueManager::resolve( 'wibble' );
}
}

0 comments on commit ac522a4

Please sign in to comment.