-
-
Notifications
You must be signed in to change notification settings - Fork 475
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
detect dev for install command (#1413)
* detect dev for install command * fix data provider usage in PackageTest * use version as argument for getInstallCommand
- Loading branch information
1 parent
7dc5521
commit cf52e7a
Showing
8 changed files
with
171 additions
and
3 deletions.
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
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,46 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Tests\Entity; | ||
|
||
use App\Entity\Tag; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class TagTest extends TestCase | ||
{ | ||
#[DataProvider('provideValidNames')] | ||
public function testIsDevWithValidNames(string $name): void | ||
{ | ||
$tag = new Tag($name); | ||
|
||
self::assertTrue($tag->isDev()); | ||
} | ||
|
||
public static function provideValidNames(): array | ||
{ | ||
return [ | ||
['dev'], | ||
['testing'], | ||
['static analysis'], | ||
]; | ||
} | ||
|
||
#[DataProvider('provideInvalidNames')] | ||
public function testIsDevWithInvalidNames(string $name): void | ||
{ | ||
$tag = new Tag($name); | ||
|
||
self::assertFalse($tag->isDev()); | ||
} | ||
|
||
public static function provideInvalidNames(): array | ||
{ | ||
return [ | ||
['orm'], | ||
['project'], | ||
['static-analysis'], | ||
]; | ||
} | ||
} |
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,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Tests\Entity; | ||
|
||
use App\Entity\Tag; | ||
use App\Entity\Version; | ||
use PHPUnit\Framework\Attributes\DataProvider; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class VersionTest extends TestCase | ||
{ | ||
#[DataProvider('provideValidDevTagSets')] | ||
public function testHasDevTagWith(array $tags): void | ||
{ | ||
$version = new Version(); | ||
|
||
foreach ($tags as $tag) { | ||
$version->addTag(new Tag($tag)); | ||
} | ||
|
||
self::assertTrue($version->hasDevTag()); | ||
} | ||
|
||
public static function provideValidDevTagSets(): array | ||
{ | ||
return [ | ||
'only dev' => [['dev']], | ||
'dev first' => [['dev', 'database']], | ||
'dev last' => [['database', 'dev']], | ||
'dev middle' => [['orm', 'dev', 'database']], | ||
'multiple' => [['dev', 'testing']], | ||
]; | ||
} | ||
#[DataProvider('provideInvalidDevTagSets')] | ||
public function testHasDevTagWithout(array $tags): void | ||
{ | ||
$version = new Version(); | ||
|
||
foreach ($tags as $tag) { | ||
$version->addTag(new Tag($tag)); | ||
} | ||
|
||
self::assertFalse($version->hasDevTag()); | ||
} | ||
|
||
public static function provideInvalidDevTagSets(): array | ||
{ | ||
return [ | ||
'none' => [[]], | ||
'one' => [['orm']], | ||
'two' => [['database', 'orm']], | ||
'three' => [['currency', 'database', 'clock']], | ||
]; | ||
} | ||
} |