shouldReceive('flushFinderCache')->once(); $viewFactory->shouldReceive('replaceNamespace')->once()->with('mail', $markdown->htmlComponentPaths())->andReturnSelf(); $viewFactory->shouldReceive('exists')->with('mail.default')->andReturn(false); $viewFactory->shouldReceive('make')->with('view', [])->andReturnSelf(); $viewFactory->shouldReceive('make')->with('mail::themes.default', [])->andReturnSelf(); $viewFactory->shouldReceive('render')->twice()->andReturn('', 'body {}'); $result = $markdown->render('view', []); $this->assertNotFalse(strpos($result, '')); } public function testRenderFunctionReturnsHtmlWithCustomTheme() { $viewFactory = m::mock(Factory::class); $markdown = new Markdown($viewFactory); $markdown->theme('yaz'); $viewFactory->shouldReceive('flushFinderCache')->once(); $viewFactory->shouldReceive('replaceNamespace')->once()->with('mail', $markdown->htmlComponentPaths())->andReturnSelf(); $viewFactory->shouldReceive('exists')->with('mail.yaz')->andReturn(true); $viewFactory->shouldReceive('make')->with('view', [])->andReturnSelf(); $viewFactory->shouldReceive('make')->with('mail.yaz', [])->andReturnSelf(); $viewFactory->shouldReceive('render')->twice()->andReturn('', 'body {}'); $result = $markdown->render('view', []); $this->assertNotFalse(strpos($result, '')); } public function testRenderFunctionReturnsHtmlWithCustomThemeWithMailPrefix() { $viewFactory = m::mock(Factory::class); $markdown = new Markdown($viewFactory); $markdown->theme('mail.yaz'); $viewFactory->shouldReceive('flushFinderCache')->once(); $viewFactory->shouldReceive('replaceNamespace')->once()->with('mail', $markdown->htmlComponentPaths())->andReturnSelf(); $viewFactory->shouldReceive('exists')->with('mail.yaz')->andReturn(true); $viewFactory->shouldReceive('make')->with('view', [])->andReturnSelf(); $viewFactory->shouldReceive('make')->with('mail.yaz', [])->andReturnSelf(); $viewFactory->shouldReceive('render')->twice()->andReturn('', 'body {}'); $result = $markdown->render('view', []); $this->assertNotFalse(strpos($result, '')); } public function testRenderTextReturnsText() { $viewFactory = m::mock(Factory::class); $markdown = new Markdown($viewFactory); $viewFactory->shouldReceive('flushFinderCache')->once(); $viewFactory->shouldReceive('replaceNamespace')->once()->with('mail', $markdown->textComponentPaths())->andReturnSelf(); $viewFactory->shouldReceive('make')->with('view', [])->andReturnSelf(); $viewFactory->shouldReceive('render')->andReturn('text'); $result = $markdown->renderText('view', [])->toHtml(); $this->assertSame('text', $result); } public function testParseReturnsParsedMarkdown() { $viewFactory = m::mock(Factory::class); $markdown = new Markdown($viewFactory); $result = $markdown->parse('# Something')->toHtml(); $this->assertSame("

Something

\n", $result); } }