<NME> InMemoryFactoryTest.php
<BEF> ADDFILE
<MSG> Refactor tests for PersistentFactoryTest to test stuff. Also Add test for InMemoryFactory

<DFF> @@ -0,0 +1,49 @@
+<?php
+
+namespace Bernard\Tests;
+
+use Bernard\QueueFactory\InMemoryFactory;
+
+class InMemoryFactoryTest extends \PHPUnit_Framework_TestCase
+{
+    public function setUp()
+    {
+        $this->factory = new InMemoryFactory();
+    }
+
+    public function testImplementsQueueFactory()
+    {
+        $this->assertInstanceOf('Bernard\QueueFactory', $this->factory);
+    }
+
+    public function testRemoveClosesQueue()
+    {
+        $this->setExpectedException('Bernard\Exception\InvalidOperationException');
+
+        $queue = $this->factory->create('queue');
+
+        $this->assertTrue($this->factory->exists('queue'));
+        $this->assertCount(1, $this->factory);
+
+        $this->factory->remove('queue');
+        $this->assertCount(0, $this->factory);
+
+        $queue->slice(0, 1);
+    }
+
+    public function testItCanCreateQueues()
+    {
+        $this->assertCount(0, $this->factory);
+
+        $queue1 = $this->factory->create('queue1');
+        $queue2 = $this->factory->create('queue2');
+
+        $all = $this->factory->all();
+
+        $this->assertInstanceOf('Bernard\Queue\InMemoryQueue', $queue1);
+        $this->assertSame($queue1, $this->factory->create('queue1'));
+        $this->assertCount(2, $all);
+        $this->assertContainsOnly('Bernard\Queue\InMemoryQueue', $all);
+        $this->assertSame(compact('queue1', 'queue2'), $all);
+    }
+}

{'commit': "diff --git a/src/Bernard/QueueFactory/PersistentFactory.php b/src/Bernard/QueueFactory/PersistentFactory.php\nindex 76c8214..3bf6bc9 100644\n--- a/src/Bernard/QueueFactory/PersistentFactory.php\n+++ b/src/Bernard/QueueFactory/PersistentFactory.php\n@@ -84,13 +84,11 @@ class PersistentFactory implements \\Bernard\\QueueFactory\n     public function remove($queueName)\n     {\n         if (!$this->exists($queueName)) {\n-            return false;\n+            return;\n         }\n \n         $this->create($queueName)->close();\n \n         unset($this->queues[$queueName]);\n-\n-        return true;\n     }\n }\ndiff --git a/tests/Bernard/Tests/QueueFactory/InMemoryFactoryTest.php b/tests/Bernard/Tests/QueueFactory/InMemoryFactoryTest.php\nnew file mode 100644\nindex 0000000..898327c\n--- /dev/null\n+++ b/tests/Bernard/Tests/QueueFactory/InMemoryFactoryTest.php\n@@ -0,0 +1,49 @@\n+<?php\n+\n+namespace Bernard\\Tests;\n+\n+use Bernard\\QueueFactory\\InMemoryFactory;\n+\n+class InMemoryFactoryTest extends \\PHPUnit_Framework_TestCase\n+{\n+    public function setUp()\n+    {\n+        $this->factory = new InMemoryFactory();\n+    }\n+\n+    public function testImplementsQueueFactory()\n+    {\n+        $this->assertInstanceOf('Bernard\\QueueFactory', $this->factory);\n+    }\n+\n+    public function testRemoveClosesQueue()\n+    {\n+        $this->setExpectedException('Bernard\\Exception\\InvalidOperationException');\n+\n+        $queue = $this->factory->create('queue');\n+\n+        $this->assertTrue($this->factory->exists('queue'));\n+        $this->assertCount(1, $this->factory);\n+\n+        $this->factory->remove('queue');\n+        $this->assertCount(0, $this->factory);\n+\n+        $queue->slice(0, 1);\n+    }\n+\n+    public function testItCanCreateQueues()\n+    {\n+        $this->assertCount(0, $this->factory);\n+\n+        $queue1 = $this->factory->create('queue1');\n+        $queue2 = $this->factory->create('queue2');\n+\n+        $all = $this->factory->all();\n+\n+        $this->assertInstanceOf('Bernard\\Queue\\InMemoryQueue', $queue1);\n+        $this->assertSame($queue1, $this->factory->create('queue1'));\n+        $this->assertCount(2, $all);\n+        $this->assertContainsOnly('Bernard\\Queue\\InMemoryQueue', $all);\n+        $this->assertSame(compact('queue1', 'queue2'), $all);\n+    }\n+}\ndiff --git a/tests/Bernard/Tests/QueueFactory/PersistentFactoryTest.php b/tests/Bernard/Tests/QueueFactory/PersistentFactoryTest.php\nindex 5406a0e..bf6ed0d 100644\n--- a/tests/Bernard/Tests/QueueFactory/PersistentFactoryTest.php\n+++ b/tests/Bernard/Tests/QueueFactory/PersistentFactoryTest.php\n@@ -31,16 +31,17 @@ class PersistentFactoryTest extends \\PHPUnit_Framework_TestCase\n \n     public function testRemoveClosesQueue()\n     {\n+        $this->setExpectedException('Bernard\\Exception\\InvalidOperationException');\n+\n         $queue = $this->factory->create('queue');\n \n         $this->assertTrue($this->factory->exists('queue'));\n         $this->assertCount(0, $this->factory);\n \n-        $this->assertTrue($this->factory->remove('queue'));\n+        $this->factory->remove('queue');\n         $this->assertCount(0, $this->factory);\n \n-        $this->assertFalse($this->factory->remove('queue-nonexistant'));\n-\n+        $queue->slice(0, 1);\n     }\n \n     public function testItLazyCreatesQueuesAndAttaches()\n", 'commit_subject': 'Refactor tests for PersistentFactoryTest to test stuff. Also Add test for InMemoryFactory', 'repo_name': 'bernardphp/bernard', 'committer': {'name': 'Henrik Bjørnskov', 'email': 'a076b11c2cc63ccdc903dbe182e1eecc3cbbc094@bjrnskov.dk', 'time_sec': '1363615868', 'tz_offset': '60', 'date': {'seconds': '1363615868'}}, 'commit_tree': 'c3edadae8c402f8c6bf5343dab6d46dac85349d5', 'commit_message': 'Refactor tests for PersistentFactoryTest to test stuff. Also Add test for InMemoryFactory\n', 'language_name': 'PHP', 'license': 'mit', 'hunks': "@@ -0,0 +1,49 @@\n+<?php\n+\n+namespace Bernard\\Tests;\n+\n+use Bernard\\QueueFactory\\InMemoryFactory;\n+\n+class InMemoryFactoryTest extends \\PHPUnit_Framework_TestCase\n+{\n+    public function setUp()\n+    {\n+        $this->factory = new InMemoryFactory();\n+    }\n+\n+    public function testImplementsQueueFactory()\n+    {\n+        $this->assertInstanceOf('Bernard\\QueueFactory', $this->factory);\n+    }\n+\n+    public function testRemoveClosesQueue()\n+    {\n+        $this->setExpectedException('Bernard\\Exception\\InvalidOperationException');\n+\n+        $queue = $this->factory->create('queue');\n+\n+        $this->assertTrue($this->factory->exists('queue'));\n+        $this->assertCount(1, $this->factory);\n+\n+        $this->factory->remove('queue');\n+        $this->assertCount(0, $this->factory);\n+\n+        $queue->slice(0, 1);\n+    }\n+\n+    public function testItCanCreateQueues()\n+    {\n+        $this->assertCount(0, $this->factory);\n+\n+        $queue1 = $this->factory->create('queue1');\n+        $queue2 = $this->factory->create('queue2');\n+\n+        $all = $this->factory->all();\n+\n+        $this->assertInstanceOf('Bernard\\Queue\\InMemoryQueue', $queue1);\n+        $this->assertSame($queue1, $this->factory->create('queue1'));\n+        $this->assertCount(2, $all);\n+        $this->assertContainsOnly('Bernard\\Queue\\InMemoryQueue', $all);\n+        $this->assertSame(compact('queue1', 'queue2'), $all);\n+    }\n+}\n", 'addition_count': 49, 'deletion_count': 0, 'src_file': '/dev/null', 'tgt_file': 'b/tests/Bernard/Tests/QueueFactory/InMemoryFactoryTest.php', 'file_extension': '.php', 'before_file': 'ADDFILE', 'message': 'Refactor tests for PersistentFactoryTest to test stuff. Also Add test for InMemoryFactory\n', 'author_name': 'Henrik Bjørnskov', 'lang': 'php'}