-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
137 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Php\PieUnitTest\Downloading; | ||
|
||
use GuzzleHttp\Psr7\Response; | ||
use InvalidArgumentException; | ||
use Php\Pie\Downloading\AssertHttp; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
#[CoversClass(AssertHttp::class)] | ||
final class AssertHttpTest extends TestCase | ||
{ | ||
public function testResponseStatusCode(): void | ||
{ | ||
$response = new Response(404, [], 'some body content'); | ||
|
||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('Expected HTTP 201 response, got 404 - response: some body content'); | ||
AssertHttp::responseStatusCode(201, $response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Php\PieUnitTest\Downloading; | ||
|
||
use Php\Pie\Downloading\Path; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
#[CoversClass(Path::class)] | ||
final class PathTest extends TestCase | ||
{ | ||
public function testVaguelyRandomTempPath(): void | ||
{ | ||
$path1 = Path::vaguelyRandomTempPath(); | ||
$path2 = Path::vaguelyRandomTempPath(); | ||
|
||
self::assertNotSame($path1, $path2); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Php\PieUnitTest\Platform; | ||
|
||
use Php\Pie\Platform\Architecture; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
#[CoversClass(Architecture::class)] | ||
final class ArchitectureTest extends TestCase | ||
{ | ||
/** | ||
* @return array<non-empty-string, array{0: non-empty-string, 1: Architecture}> | ||
* | ||
* @psalm-suppress PossiblyUnusedMethod | ||
*/ | ||
public static function architectureMapProvider(): array | ||
{ | ||
return [ | ||
'x64' => ['x64', Architecture::x86_64], | ||
'x86_64' => ['x86_64', Architecture::x86_64], | ||
'AMD64' => ['AMD64', Architecture::x86_64], | ||
'arm64' => ['arm64', Architecture::arm64], | ||
'x86' => ['x86', Architecture::x86], | ||
'something' => ['something', Architecture::x86], | ||
]; | ||
} | ||
|
||
/** @param non-empty-string $architectureString */ | ||
#[DataProvider('architectureMapProvider')] | ||
public function testParseArchitecture(string $architectureString, Architecture $expectedArchitecture): void | ||
{ | ||
self::assertSame($expectedArchitecture, Architecture::parseArchitecture($architectureString)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters