Skip to content

Commit

Permalink
Merge pull request #1570 from hydephp/refactor-test-to-not-use-comple…
Browse files Browse the repository at this point in the history
…x-mocks

Refactor unit test to replace complex mock with inlined build loop hydephp/develop@a6bcd95
  • Loading branch information
github-actions committed Feb 13, 2024
1 parent 883e9fa commit 3da0a1d
Showing 1 changed file with 6 additions and 29 deletions.
35 changes: 6 additions & 29 deletions tests/Unit/RelativeLinksAcrossPagesRetainsIntegrityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
namespace Hyde\Framework\Testing\Unit;

use Hyde\Facades\Filesystem;
use Hyde\Support\Models\Route;
use Hyde\Foundation\Facades\Routes;
use Hyde\Framework\Actions\StaticPageBuilder;
use Hyde\Framework\Actions\CreatesNewMarkdownPostFile;
use Hyde\Framework\Services\BuildService;
use Illuminate\Console\OutputStyle;
use Mockery;
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
use Symfony\Component\Console\Helper\ProgressBar;

use function config;

Expand Down Expand Up @@ -70,30 +68,9 @@ protected function assertSee(string $page, string|array $text): void

public function testRelativeLinksAcrossPagesRetainsIntegrity()
{
$service = new BuildService(Mockery::mock(OutputStyle::class, [
'getFormatter' => Mockery::mock(OutputFormatterInterface::class, [
'hasStyle' => false,
'setStyle' => null,
]),
'createProgressBar' => new ProgressBar(Mockery::mock(OutputStyle::class, [
'isDecorated' => false,
'getVerbosity' => 0,
'write' => null,
'getFormatter' => Mockery::mock(OutputFormatterInterface::class, [
'hasStyle' => false,
'setStyle' => null,
'isDecorated' => false,
'setDecorated' => null,
'format' => null,
]),
])),
'writeln' => null,
'newLine' => null,
'write' => null,
]));

$service->transferMediaAssets();
$service->compileStaticPages();
Routes::getRoutes()->each(function (Route $route): void {
StaticPageBuilder::handle($route->getPage());
});

$this->assertSee('root', [
'<link rel="stylesheet" href="media/app.css">',
Expand Down

0 comments on commit 3da0a1d

Please sign in to comment.