Skip to content
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
7 changes: 5 additions & 2 deletions tests/unit/Differ/DiffCollectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function getDiffFiles(string $baseCommit, string $headCommit): array
* @param bool $includeNonAstChanged whether to include non AST-changed PhpDiffs
* @param GitInterface $git the GitInterface instance
*/
#[DataProvider('getPhpDiffsAstChangedProvider')]
#[DataProvider('provideGetPhpDiffsAstChangedCases')]
public function testGetPhpDiffsAstChanged(int $expectCount, bool $includeNonAstChanged, GitInterface $git, DiffFactory $diffFactory): void
{
$subject = $this->getSubject(git: $git, diffFactory: $diffFactory);
Expand All @@ -135,7 +135,10 @@ public function testGetPhpDiffsAstChanged(int $expectCount, bool $includeNonAstC
$this->assertCount($expectCount, $actual);
}

public static function getPhpDiffsAstChangedProvider(): \Generator
/**
* @return iterable<array{int, bool, GitInterface, DiffFactory}>
*/
public static function provideGetPhpDiffsAstChangedCases(): iterable
{
$git = new class extends DummyGit {
public function getDiffFiles(string $baseCommit, string $headCommit): array
Expand Down
7 changes: 5 additions & 2 deletions tests/unit/Differ/DiffFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testCreateForNonPhp(): void
$this->assertSame($status, $diff->status);
}

#[DataProvider('createForPhpProvider')]
#[DataProvider('provideCreateForPhpCases')]
public function testCreateForPhp(GitStatus $gitStatus, ?string $expectedBase, ?string $expectedHead): void
{
$git = new class extends DummyGit {
Expand All @@ -56,7 +56,10 @@ public function get(string $source): string
$this->assertSame($expectedHead, $actual->head);
}

public static function createForPhpProvider(): \Generator
/**
* @return iterable<array{GitStatus, ?string, ?string}>
*/
public static function provideCreateForPhpCases(): iterable
{
yield 'ADDED' => [GitStatus::ADDED, null, '<?php $hash = \'commit2\'; $path = \'a.php\';'];

Expand Down