Skip to content

Commit

Permalink
Tests base classes refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-boudry committed May 24, 2024
1 parent dfef268 commit c1f5df9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
3 changes: 1 addition & 2 deletions tests/AlgoTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
namespace Tests;

use CondorcetPHP\Condorcet\Tools\Converters\{DavidHillFormat, DebianFormat};
use PHPUnit\Framework\TestCase as BaseTestCase;

abstract class AlgoTestCase extends BaseTestCase
abstract class AlgoTestCase extends CondorcetTestCase
{
public static DavidHillFormat $tidemanA77;
public static DebianFormat $debian2020;
Expand Down
13 changes: 13 additions & 0 deletions tests/CondorcetTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Tests;

use CondorcetPHP\Condorcet\Election;
use PHPUnit\Framework\TestCase;

abstract class CondorcetTestCase extends TestCase
{
public Election $election;
}
3 changes: 1 addition & 2 deletions tests/DriversTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

use CondorcetPHP\Condorcet\Election;
use PHPUnit\Framework\Attributes\RequiresPhpExtension;
use PHPUnit\Framework\TestCase;

#[RequiresPhpExtension('pdo_sqlite')]
class DriversTestCase extends TestCase
class DriversTestCase extends CondorcetTestCase
{
protected function hashVotesList(Election $elec): string
{
Expand Down
1 change: 1 addition & 0 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
|
*/

uses(Tests\CondorcetTestCase::class);
uses(Tests\AlgoTestCase::class)->in('src/Algo');

/*
Expand Down
6 changes: 3 additions & 3 deletions tests/src/Tools/Randomizers/ArrayRandomizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace CondorcetPHP\Condorcet\Tests;
namespace CondorcetPHP\Condorcet\Tests\src\Tools\Randomizers;

use CondorcetPHP\Condorcet\Tools\Randomizers\ArrayRandomizer;
use PHPUnit\Framework\TestCase;
use Tests\CondorcetTestCase;

class ArrayRandomizerTest extends TestCase
class ArrayRandomizerTest extends CondorcetTestCase
{
public const SEED = 'CondorcetSeed';

Expand Down
3 changes: 2 additions & 1 deletion tests/src/Tools/Randomizers/VoteRandomizerTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

declare(strict_types=1);
use CondorcetPHP\Condorcet\Tests\ArrayRandomizerTest;

use CondorcetPHP\Condorcet\Tests\src\Tools\Randomizers\ArrayRandomizerTest;
use CondorcetPHP\Condorcet\Tools\Randomizers\{ArrayRandomizer, VoteRandomizer};
use CondorcetPHP\Condorcet\Utils\CondorcetUtil;

Expand Down

0 comments on commit c1f5df9

Please sign in to comment.