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: Handle skipped tests #1755

Merged
merged 5 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use Hyde\Testing\TestCase;
use Illuminate\Support\Facades\Process;
use TypeError;
use Hyde\RealtimeCompiler\ConsoleOutput;

/**
* @covers \Hyde\Console\Commands\ServeCommand
Expand Down Expand Up @@ -166,10 +165,6 @@ public function testHydeServeCommandPassesThroughProcessOutput()

public function testWithFancyOutput()
{
if (! class_exists(ConsoleOutput::class)) {
$this->markTestSkipped('ConsoleOutput class not found.');
}

Process::fake(['php -S localhost:8080 {$this->binaryPath()}' => 'foo']);

$this->artisan('serve')
Expand Down
30 changes: 0 additions & 30 deletions packages/framework/tests/Feature/HydeKernelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@

namespace Hyde\Framework\Testing\Feature;

use Throwable;
use Hyde\Enums\Feature;
use Composer\InstalledVersions;
use Hyde\Facades\Features;
use Hyde\Foundation\Facades\Pages;
use Hyde\Foundation\Facades\Routes;
Expand Down Expand Up @@ -306,34 +304,6 @@ public function testVersionConstantIsAValidSemverString()
);
}

public function testVersionConstantIsUpToDateWithComposer()
{
$version = InstalledVersions::getPrettyVersion('hyde/framework');

if (str_starts_with($version, 'dev-')) {
$this->markTestSkipped('Installed version is for development');
}

$this->assertSame(HydeKernel::VERSION, $version);
}

public function testVersionConstantIsUpToDateWithGit()
{
try {
$version = trim(shell_exec('git describe --abbrev=0 --tags'));
} catch (Throwable) {
// Gracefully skip the test if the version cannot be fetched
$this->markTestSkipped('Could not get version from Git');
}

if ('v'.HydeKernel::VERSION === $version) {
$this->assertSame('v'.HydeKernel::VERSION, $version);
} else {
// Gracefully skip the test if the version is not up-to-date
$this->markTestSkipped('Version constant does not match Git version!');
}
}

public function testVersionMethodReturnsVersionConstant()
{
$this->assertSame(HydeKernel::VERSION, Hyde::version());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected function setUp(): void
{
parent::setUp();

if (file_exists(Hyde::path('README.md')) && ! str_contains(file_get_contents(Hyde::path('README.md')), 'HydePHP - Source Monorepo')) {
if (file_exists(Hyde::path('README.md')) && ! str_contains(file_get_contents(Hyde::path('README.md')), 'HydePHP - Source Code Monorepo')) {
$this->markTestSkipped('Test skipped when not running in the monorepo.');
}
}
Expand Down
Loading