Skip to content

Commit

Permalink
Add unit test of the application class
Browse files Browse the repository at this point in the history
  • Loading branch information
guvra committed Jun 11, 2024
1 parent bc47a54 commit 175b583
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/unit/Console/ApplicationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Smile\GdprDump\Tests\Unit\Console;

use Smile\GdprDump\Console\Application;
use Smile\GdprDump\Tests\Unit\TestCase;

class ApplicationTest extends TestCase
{
/**
* Test the "getVersion" method.
*/
public function testVersion(): void
{
$application = new Application();
$installed = require __DIR__ . '/../../../vendor/composer/installed.php';
$version = (string) $installed['versions']['smile/gdpr-dump']['pretty_version'];
$reference = (string) $installed['versions']['smile/gdpr-dump']['reference'];

// In the context of a unit test, the reference is always defined
$expectedVersion = $version . '@' . substr($reference, 0, 7);
$this->assertSame($application->getVersion(), $expectedVersion);
}
}

0 comments on commit 175b583

Please sign in to comment.