-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test to verify that Application::VERSION match the latest git tag
- Loading branch information
Showing
3 changed files
with
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Povils\PHPMND\Tests\Application; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use Povils\PHPMND\Console\Application; | ||
use Povils\PHPMND\Container; | ||
use SebastianBergmann\Version; | ||
use Symfony\Component\Console\Tester\ApplicationTester; | ||
|
||
/** | ||
* @author Laurent Laville | ||
* @group tags | ||
* Allow to exclude this group from CI workflow when tag is not pushed | ||
*/ | ||
class ApplicationTest extends TestCase | ||
{ | ||
private ApplicationTester $applicationTester; | ||
protected function setUp(): void | ||
{ | ||
$application = new Application(Container::create()); | ||
$application->setAutoExit(false); | ||
|
||
$this->applicationTester = new ApplicationTester($application); | ||
} | ||
|
||
public function testApplicationVersionInstalled(): void | ||
{ | ||
$this->applicationTester->run(['--version', '--no-ansi']); | ||
|
||
$installedVersion = \ltrim( | ||
(new Version('', dirname(__DIR__, 2)))->getVersion(), | ||
'-v' | ||
); | ||
|
||
$this->assertSame( | ||
\sprintf('phpmnd version %s by Povilas Susinskas', $installedVersion), | ||
\trim($this->applicationTester->getDisplay()) | ||
); | ||
} | ||
} |