Skip to content

Commit

Permalink
Merge pull request #1755 from hydephp/handle-skipped-tests
Browse files Browse the repository at this point in the history
Internal: Handle skipped tests
  • Loading branch information
caendesilva authored Jun 29, 2024
2 parents 4ccc8d2 + 221ac91 commit 7170185
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 36 deletions.
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

0 comments on commit 7170185

Please sign in to comment.