Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze authored and github-actions[bot] committed Jan 11, 2024
1 parent a14458d commit 587dfbf
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/Console/ExportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public function __construct()
);
});

$this->addOption("skip-all", null, InputOption::VALUE_NONE, 'Skip all hooks');
$this->addOption("skip-before", null, InputOption::VALUE_NONE, 'Skip all before hooks');
$this->addOption("skip-after", null, InputOption::VALUE_NONE, 'Skip all after hooks');
$this->addOption('skip-all', null, InputOption::VALUE_NONE, 'Skip all hooks');
$this->addOption('skip-before', null, InputOption::VALUE_NONE, 'Skip all before hooks');
$this->addOption('skip-after', null, InputOption::VALUE_NONE, 'Skip all after hooks');
}

public function handle(Exporter $exporter)
Expand Down
24 changes: 11 additions & 13 deletions tests/ExportTest.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
<?php

use Illuminate\Support\Facades\Route;
use Spatie\Export\Exporter;

use function PHPUnit\Framework\assertEquals;

use function PHPUnit\Framework\assertFileExists;

use Spatie\Export\Exporter;

const HOME_CONTENT = '<a href="feed/blog.atom" title="all blogposts">Feed</a>Home <a href="about">About</a>';
const ABOUT_CONTENT = 'About';
const FEED_CONTENT = 'Feed';

function assertHomeExists(): void
{
assertExportedFile(__DIR__ . '/dist/index.html', HOME_CONTENT);
assertExportedFile(__DIR__.'/dist/index.html', HOME_CONTENT);
}

function assertAboutExists(): void
{
assertExportedFile(__DIR__ . '/dist/about/index.html', ABOUT_CONTENT);
assertExportedFile(__DIR__.'/dist/about/index.html', ABOUT_CONTENT);
}

function assertFeedBlogAtomExists(): void
{
assertExportedFile(__DIR__ . '/dist/feed/blog.atom', FEED_CONTENT);
assertExportedFile(__DIR__.'/dist/feed/blog.atom', FEED_CONTENT);
}

function assertExportedFile(string $path, string $content): void
Expand All @@ -34,12 +32,12 @@ function assertExportedFile(string $path, string $content): void
}

beforeEach(function () {
$this->distDirectory = __DIR__ . DIRECTORY_SEPARATOR . 'dist';
$this->distDirectory = __DIR__.DIRECTORY_SEPARATOR.'dist';

if (file_exists($this->distDirectory)) {
exec(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'
? 'del ' . $this->distDirectory . ' /q'
: 'rm -r ' . $this->distDirectory);
? 'del '.$this->distDirectory.' /q'
: 'rm -r '.$this->distDirectory);
}

Route::get('/', function () {
Expand Down Expand Up @@ -89,11 +87,11 @@ function assertExportedFile(string $path, string $content): void

it('exports included files', function () {
app(Exporter::class)
->includeFiles([__DIR__ . '/stubs/public' => ''])
->includeFiles([__DIR__.'/stubs/public' => ''])
->export();

assertFileExists(__DIR__ . '/dist/favicon.ico');
assertFileExists(__DIR__ . '/dist/media/image.png');
assertFileExists(__DIR__.'/dist/favicon.ico');
assertFileExists(__DIR__.'/dist/media/image.png');

expect(file_exists(__DIR__ . '/dist/index.php'))->toBeFalse();
expect(file_exists(__DIR__.'/dist/index.php'))->toBeFalse();
});
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function getEnvironmentSetUp($app)
{
$app['config']->set('filesystems.disks.export', [
'driver' => 'local',
'root' => __DIR__ . '/dist',
'root' => __DIR__.'/dist',
]);

$app['config']->set('export.disk', 'export');
Expand Down
2 changes: 1 addition & 1 deletion tests/stubs/public/index.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

die();
exit();

0 comments on commit 587dfbf

Please sign in to comment.