Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal build service refactor tie in #65

Merged
merged 15 commits into from
Apr 8, 2022
Prev Previous commit
Next Next commit
Create a helper to create and reset test files
  • Loading branch information
caendesilva committed Apr 8, 2022
commit 79eb5b7646f05fa739f2c7dc535999e2832fd912
29 changes: 29 additions & 0 deletions tests/Setup/MockContentSourceFiles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Tests\Setup;

use Hyde\Framework\Hyde;
use Hyde\Framework\Models\MarkdownPost;
use Hyde\Framework\Models\MarkdownPage;
use Hyde\Framework\Models\DocumentationPage;
use Hyde\Framework\Models\BladePage;
use Hyde\Framework\Services\BuildService;

trait MockContentSourceFiles
{
public function createContentSourceTestFiles()
{
touch(Hyde::path(BuildService::getFilePathForModelClassFiles(MarkdownPost::class) . '/test.md'));
touch(Hyde::path(BuildService::getFilePathForModelClassFiles(MarkdownPage::class) . '/test.md'));
touch(Hyde::path(BuildService::getFilePathForModelClassFiles(DocumentationPage::class) . '/test.md'));
touch(Hyde::path(BuildService::getFilePathForModelClassFiles(BladePage::class) . '/test.blade.php'));
}

public function deleteContentSourceTestFiles()
{
unlink(Hyde::path(BuildService::getFilePathForModelClassFiles(MarkdownPost::class) . '/test.md'));
unlink(Hyde::path(BuildService::getFilePathForModelClassFiles(MarkdownPage::class) . '/test.md'));
unlink(Hyde::path(BuildService::getFilePathForModelClassFiles(DocumentationPage::class) . '/test.md'));
unlink(Hyde::path(BuildService::getFilePathForModelClassFiles(BladePage::class) . '/test.blade.php'));
}
}