Skip to content

Commit

Permalink
Merge pull request #564 from netglue/phpunit-meta
Browse files Browse the repository at this point in the history
Convert PHPUnit annotations to attributes
  • Loading branch information
gsteel authored Jan 29, 2025
2 parents 8bcc014 + e1f6289 commit f23986d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
6 changes: 3 additions & 3 deletions test/Unit/Document/Fragment/DocumentLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function testConstructor(): DocumentLink
return $link;
}

/** @depends testConstructor */
#[Depends('testConstructor')]
public function testThatCastingALinkToAStringWillYieldItsId(DocumentLink $link): void
{
self::assertSame('id', (string) $link);
Expand Down Expand Up @@ -105,13 +105,13 @@ public function testThatTagsHaveExpectedMembers(DocumentLink $link): void
$this->assertContainsEquals('b', $link->tags());
}

/** @depends testConstructor */
#[Depends('testConstructor')]
public function testTheLinkMayHaveAUrlAndItIsNullByDefault(DocumentLink $link): void
{
self::assertNull($link->url());
}

/** @depends testConstructorWithUrl */
#[Depends('testConstructorWithUrl')]
public function testThatUrlReturnsTheExpectedValue(DocumentLink $link): void
{
self::assertSame('/some/url', $link->url());
Expand Down
9 changes: 3 additions & 6 deletions test/Unit/Document/Fragment/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public static function documentLinkProvider(): array
];
}

/** @dataProvider documentLinkProvider */
#[DataProvider('documentLinkProvider')]
public function testThatDocumentLinksWithReadyMadeUrlsWillHaveTheExpectedValue(string $json, string|null $expect): void
{
$data = Json::decodeObject($json);
Expand All @@ -342,11 +342,8 @@ public function testThatDocumentLinksWithReadyMadeUrlsWillHaveTheExpectedValue(s
self::assertSame($expect, $link->url());
}

/**
* @param class-string $expectedType
*
* @dataProvider scalarTypes
*/
/** @param class-string $expectedType */
#[DataProvider('scalarTypes')]
public function testThatTheFactoryCanBeNewedAndInvoked(string|int|float|bool|null $value, string $expectedType): void
{
$factory = new Factory();
Expand Down

0 comments on commit f23986d

Please sign in to comment.