]> BookStack Code Mirror - bookstack/blobdiff - tests/TestCase.php
Fixes for CodeStyle vol.2
[bookstack] / tests / TestCase.php
index f20b20fd83146cc9d84fb0bb9facbce126a548c0..080515173d67cdd6cdf3605dc9e66c7ad1de42a4 100644 (file)
@@ -1,6 +1,8 @@
-<?php namespace Tests;
+<?php
 
-use BookStack\Entities\Entity;
+namespace Tests;
+
+use BookStack\Entities\Models\Entity;
 use Illuminate\Foundation\Testing\DatabaseTransactions;
 use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
 
@@ -12,38 +14,31 @@ abstract class TestCase extends BaseTestCase
 
     /**
      * The base URL to use while testing the application.
+     *
      * @var string
      */
     protected $baseUrl = 'http://localhost';
 
-    /**
-     * Assert a permission error has occurred.
-     * @param TestResponse $response
-     * @return TestCase
-     */
-    protected function assertPermissionError(TestResponse $response)
-    {
-        $response->assertRedirect('/');
-        $this->assertSessionHas('error');
-        session()->remove('error');
-        return $this;
-    }
-
     /**
      * Assert the session contains a specific entry.
+     *
      * @param string $key
+     *
      * @return $this
      */
     protected function assertSessionHas(string $key)
     {
         $this->assertTrue(session()->has($key), "Session does not contain a [{$key}] entry");
+
         return $this;
     }
 
     /**
      * Override of the get method so we can get visibility of custom TestResponse methods.
-     * @param  string  $uri
-     * @param  array  $headers
+     *
+     * @param string $uri
+     * @param array  $headers
+     *
      * @return TestResponse
      */
     public function get($uri, array $headers = [])
@@ -54,7 +49,8 @@ abstract class TestCase extends BaseTestCase
     /**
      * Create the test response instance from the given response.
      *
-     * @param  \Illuminate\Http\Response $response
+     * @param \Illuminate\Http\Response $response
+     *
      * @return TestResponse
      */
     protected function createTestResponse($response)
@@ -66,9 +62,9 @@ abstract class TestCase extends BaseTestCase
      * Assert that an activity entry exists of the given key.
      * Checks the activity belongs to the given entity if provided.
      */
-    protected function assertActivityExists(string $key, Entity $entity = null)
+    protected function assertActivityExists(string $type, Entity $entity = null)
     {
-        $detailsToCheck = ['key' => $key];
+        $detailsToCheck = ['type' => $type];
 
         if ($entity) {
             $detailsToCheck['entity_type'] = $entity->getMorphClass();
@@ -77,4 +73,4 @@ abstract class TestCase extends BaseTestCase
 
         $this->assertDatabaseHas('activities', $detailsToCheck);
     }
-}
\ No newline at end of file
+}