]> BookStack Code Mirror - bookstack/blobdiff - tests/TestResponse.php
Applied StyleCI changes, added php/larastan to attribution
[bookstack] / tests / TestResponse.php
index 39a9d796b12a218085e092235ffe21f553d91bd6..5e2be3ac35c103caa3b897dc4fec0fc5d7322984 100644 (file)
@@ -2,7 +2,7 @@
 
 namespace Tests;
 
-use Illuminate\Foundation\Testing\TestResponse as BaseTestResponse;
+use Illuminate\Testing\TestResponse as BaseTestResponse;
 use PHPUnit\Framework\Assert as PHPUnit;
 use Symfony\Component\DomCrawler\Crawler;
 
@@ -26,6 +26,14 @@ class TestResponse extends BaseTestResponse
         return $this->crawlerInstance;
     }
 
+    /**
+     * Get the HTML of the first element at the given selector.
+     */
+    public function getElementHtml(string $selector): string
+    {
+        return $this->crawler()->filter($selector)->first()->outerHtml();
+    }
+
     /**
      * Assert the response contains the specified element.
      *