-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
105 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/vendor/ | ||
composer.lock | ||
.phpunit.result.cache | ||
.phpunit.cache | ||
coverage.xml | ||
/coverage/ | ||
junit.xml |
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 |
---|---|---|
@@ -1,17 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
colors="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<coverage processUncoveredFiles="true"> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</coverage> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" colors="true" cacheDirectory=".phpunit.cache"> | ||
<testsuites> | ||
<testsuite name="unit"> | ||
<directory suffix="Test.php">./tests/Unit</directory> | ||
</testsuite> | ||
<testsuite name="architecture"> | ||
<directory suffix="Test.php">./tests/Architecture</directory> | ||
</testsuite> | ||
</testsuites> | ||
<source> | ||
<include> | ||
<directory suffix=".php">./src</directory> | ||
</include> | ||
</source> | ||
</phpunit> |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Lentex\Gaudigame\Engine\Contracts; | ||
|
||
interface CalculationModel | ||
|
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 |
---|---|---|
@@ -1,20 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Lentex\Gaudigame\Engine\Contracts; | ||
|
||
interface Score | ||
{ | ||
public function canBeEvaluated(): bool; | ||
|
||
public function home(): int; | ||
|
||
public function away(): int; | ||
|
||
public function isDraw(): bool; | ||
|
||
public function isHomeWin(): bool; | ||
|
||
public function isAwayWin(): bool; | ||
|
||
public function margin(): int; | ||
} |
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 |
---|---|---|
@@ -1,38 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Lentex\Gaudigame\Engine; | ||
|
||
use Lentex\Gaudigame\Engine\Contracts\CalculationModel; | ||
|
||
class DefaultCalculationModel implements CalculationModel | ||
final class DefaultCalculationModel implements CalculationModel | ||
{ | ||
private const int EXACT = 3; | ||
private const int EXACT_GAP = 2; | ||
private const int DRAW_GAP = 1; | ||
private const int TENDENCY = 1; | ||
private const int WRONG = 0; | ||
private const int NO = 0; | ||
|
||
public function getPointsForExactGuess(): int | ||
{ | ||
return 3; | ||
return self::EXACT; | ||
} | ||
|
||
public function getPointsForExactGap(): int | ||
{ | ||
return 2; | ||
return self::EXACT_GAP; | ||
} | ||
|
||
public function getPointsForDrawGap(): int | ||
{ | ||
return 1; | ||
return self::DRAW_GAP; | ||
} | ||
|
||
public function getPointsForTendency(): int | ||
{ | ||
return 1; | ||
return self::TENDENCY; | ||
} | ||
|
||
public function getPointsForWrongGuess(): int | ||
{ | ||
return 0; | ||
return self::WRONG; | ||
} | ||
|
||
public function getPointsForNoGuess(): int | ||
{ | ||
return 0; | ||
return self::NO; | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
arch('strict types') | ||
->expect('Lentex\Gaudigame\Engine') | ||
->toUseStrictTypes(); | ||
|
||
arch('contracts') | ||
->expect('Lentex\Gaudigame\Engine\Contracts') | ||
->toBeInterface(); | ||
|
||
arch('final') | ||
->expect('Lentex\Gaudigame\Engine') | ||
->classes() | ||
->toBeFinal(); |
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
2 changes: 1 addition & 1 deletion
2
tests/MatchCalculatorTest.php → tests/Unit/MatchCalculatorTest.php
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