Skip to content

Commit

Permalink
remove unneeded test
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow committed May 31, 2022
1 parent 0709f30 commit 34e21bc
Showing 1 changed file with 3 additions and 45 deletions.
48 changes: 3 additions & 45 deletions tests/Util/PhpVersionTest.php → tests/Util/PhpCompatUtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,16 @@

namespace Symfony\Bundle\MakerBundle\Tests\Util;

use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Bundle\MakerBundle\FileManager;
use Symfony\Bundle\MakerBundle\Util\PhpCompatUtil;
use Symfony\Component\HttpKernel\Kernel;

/**
* @author Jesse Rushlow <jr@rushlow.dev>
*/
class PhpVersionTest extends TestCase
class PhpCompatUtilTest extends TestCase
{
/**
* @dataProvider phpVersionDataProvider
*/
public function testUsesPhpPlatformFromComposerJsonFileForCanUseAttributes(string $version, bool $expectedResult): void
{
$this->markTestSkipped('This test needs to be refactored if we keep the util.');
$mockFileManager = $this->mockFileManager(sprintf('{"platform-overrides": {"php": "%s"}}', $version));

$version = new PhpCompatUtil($mockFileManager);

// $result = $version->canUseAttributes();

/*
* Symfony 5.2 is required to compare the result. Otherwise it will always
* return false regardless of the PHP Version. If the test suite is run w/
* Symfony < 5.2, we assert false here but still rely on the assertions above.
*/
if (Kernel::VERSION_ID < 50200) {
$expectedResult = false;
}

self::assertSame($expectedResult, $result);
}

public function phpVersionDataProvider(): \Generator
{
yield ['8', true];
yield ['8.0', true];
yield ['8.0.1', true];
yield ['8RC1', true];
yield ['8.1alpha1', true];
yield ['8.0.0beta2', true];
yield ['8beta', true];
yield ['7', false];
yield ['7.0', false];
yield ['7.1.1', false];
yield ['7.0.0RC3', false];
}

public function testFallBackToPhpVersionWithoutLockFile(): void
{
$mockFileManager = $this->createMock(FileManager::class);
Expand Down Expand Up @@ -99,10 +60,7 @@ public function testWithoutPlatformVersionSet(): void
self::assertSame(\PHP_VERSION, $result);
}

/**
* @return \PHPUnit\Framework\MockObject\MockObject|FileManager
*/
private function mockFileManager(string $json)
private function mockFileManager(string $json): MockObject|FileManager
{
$mockFileManager = $this->createMock(FileManager::class);
$mockFileManager
Expand Down

0 comments on commit 34e21bc

Please sign in to comment.