File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,9 @@ public static function fromFile(string $path): static
9090 */
9191 public static function render (string $ markdown , ?string $ pageClass = null ): string
9292 {
93- return (new MarkdownService ($ markdown , $ pageClass ))->parse ();
93+ return app (MarkdownService::class, [
94+ 'markdown ' => $ markdown ,
95+ 'pageClass ' => $ pageClass ,
96+ ])->parse ();
9497 }
9598}
Original file line number Diff line number Diff line change 44
55namespace Hyde \Framework \Testing \Unit ;
66
7+ use Mockery ;
78use Hyde \Testing \UnitTestCase ;
89use Hyde \Markdown \Models \Markdown ;
10+ use Hyde \Framework \Services \MarkdownService ;
911
1012/**
1113 * @covers \Hyde\Markdown\Models\Markdown
1214 */
1315class MarkdownFacadeTest extends UnitTestCase
1416{
15- protected static bool $ needsKernel = true ;
16- protected static bool $ needsConfig = true ;
17-
1817 public function testRender (): void
1918 {
19+ $ mock = Mockery::mock (MarkdownService::class);
20+ $ mock ->shouldReceive ('parse ' )->once ()->andReturn ("<h1>Hello World!</h1> \n" );
21+ app ()->bind (MarkdownService::class, fn () => $ mock );
22+
2023 $ html = Markdown::render ('# Hello World! ' );
2124
2225 $ this ->assertIsString ($ html );
2326 $ this ->assertSame ("<h1>Hello World!</h1> \n" , $ html );
27+
28+ Mockery::close ();
2429 }
2530}
You can’t perform that action at this time.
0 commit comments