server/src/tests/Controllers/DocumentListControllerTest.php
changeset 2 00e2916104fe
child 4 f55970e41793
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/tests/Controllers/DocumentListControllerTest.php	Tue Jun 23 17:01:39 2015 +0200
@@ -0,0 +1,36 @@
+<?php
+
+use CorpusParole\Repositories\DocumentRepository;
+use Mockery as m;
+
+/**
+ *
+ */
+class DocumentListControllerTest extends TestCase {
+
+    private $documentRepository;
+
+    public function setUp() {
+
+        parent::setup();
+
+        // create a mock of the post repository interface and inject it into the
+        // IoC container
+        $this->documentRepository = m::mock('CorpusParole\Repositories\DocumentRepository');
+        $this->app->instance('CorpusParole\Repositories\DocumentRepository', $this->documentRepository);
+    }
+
+    public function tearDown() {
+        m::close();
+        parent::tearDown();
+    }
+
+    public function testIndex() {
+        $this->documentRepository->shouldReceive('all')->once()->andReturn(array());
+
+        $response = $this->call('GET', '/bo/docs');
+
+        $this->assertResponseOk($response);
+        $this->assertViewHas('docs');
+    }
+}