+1
-1
@@ -32,7 +32,7 @@
|
||||
|
||||
],
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"phpunit/phpunit": "^7.0|^8.0",
|
||||
"phpunit/php-code-coverage": "*",
|
||||
"friendsofphp/php-cs-fixer": "*"
|
||||
}
|
||||
|
||||
Generated
+28
-28
@@ -1860,16 +1860,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64"
|
||||
"reference": "b592b26a24265a35172d8a2094d8b10f22b7cc39"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/d50bbeeb0e17e6dd4124ea391eff235e932cbf64",
|
||||
"reference": "d50bbeeb0e17e6dd4124ea391eff235e932cbf64",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/b592b26a24265a35172d8a2094d8b10f22b7cc39",
|
||||
"reference": "b592b26a24265a35172d8a2094d8b10f22b7cc39",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1931,20 +1931,20 @@
|
||||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-06-05T13:25:51+00:00"
|
||||
"time": "2019-06-13T11:03:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/filesystem.git",
|
||||
"reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf"
|
||||
"reference": "b9896d034463ad6fd2bf17e2bf9418caecd6313d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/bf2af40d738dec5e433faea7b00daa4431d0a4cf",
|
||||
"reference": "bf2af40d738dec5e433faea7b00daa4431d0a4cf",
|
||||
"url": "https://api.github.com/repos/symfony/filesystem/zipball/b9896d034463ad6fd2bf17e2bf9418caecd6313d",
|
||||
"reference": "b9896d034463ad6fd2bf17e2bf9418caecd6313d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1981,20 +1981,20 @@
|
||||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-06-03T20:27:40+00:00"
|
||||
"time": "2019-06-23T08:51:25+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/finder.git",
|
||||
"reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176"
|
||||
"reference": "33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176",
|
||||
"reference": "b3d4f4c0e4eadfdd8b296af9ca637cfbf51d8176",
|
||||
"url": "https://api.github.com/repos/symfony/finder/zipball/33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a",
|
||||
"reference": "33c21f7d5d3dc8a140c282854a7e13aeb5d0f91a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2030,7 +2030,7 @@
|
||||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-05-26T20:47:49+00:00"
|
||||
"time": "2019-06-13T11:03:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
@@ -2209,7 +2209,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
@@ -2316,7 +2316,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/yaml.git",
|
||||
@@ -3783,16 +3783,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f"
|
||||
"reference": "d257021c1ab28d48d24a16de79dfab445ce93398"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/4e6c670af81c4fb0b6c08b035530a9915d0b691f",
|
||||
"reference": "4e6c670af81c4fb0b6c08b035530a9915d0b691f",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d257021c1ab28d48d24a16de79dfab445ce93398",
|
||||
"reference": "d257021c1ab28d48d24a16de79dfab445ce93398",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3849,7 +3849,7 @@
|
||||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2019-05-30T16:10:05+00:00"
|
||||
"time": "2019-06-13T11:03:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher-contracts",
|
||||
@@ -3911,16 +3911,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/options-resolver.git",
|
||||
"reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332"
|
||||
"reference": "40762ead607c8f792ee4516881369ffa553fee6f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/914e0edcb7cd0c9f494bc023b1d47534f4542332",
|
||||
"reference": "914e0edcb7cd0c9f494bc023b1d47534f4542332",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/40762ead607c8f792ee4516881369ffa553fee6f",
|
||||
"reference": "40762ead607c8f792ee4516881369ffa553fee6f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3961,7 +3961,7 @@
|
||||
"configuration",
|
||||
"options"
|
||||
],
|
||||
"time": "2019-05-10T05:38:46+00:00"
|
||||
"time": "2019-06-13T11:01:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php70",
|
||||
@@ -4079,7 +4079,7 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/stopwatch",
|
||||
"version": "v4.3.1",
|
||||
"version": "v4.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/stopwatch.git",
|
||||
|
||||
+16
-17
@@ -6,14 +6,14 @@ namespace LotGD\Core\Tests\Models;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
|
||||
use Doctrine\Common\Util\Debug;
|
||||
use LotGD\Core\{
|
||||
Battle,
|
||||
use LotGD\Core\{Battle,
|
||||
DiceBag,
|
||||
Exceptions\BattleIsOverException,
|
||||
Exceptions\BattleNotOverException,
|
||||
Game,
|
||||
Models\Buff,
|
||||
Models\Character,
|
||||
Models\Monster
|
||||
};
|
||||
Models\Monster};
|
||||
use LotGD\Core\Models\BattleEvents\{
|
||||
BuffMessageEvent,
|
||||
CriticalHitEvent,
|
||||
@@ -202,9 +202,6 @@ class BattleTest extends CoreModelTestCase
|
||||
$this->assertSame($battle->getWinner(), $highLevelMonster);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException LotGD\Core\Exceptions\BattleNotOverException
|
||||
*/
|
||||
public function testBattleNotOverExceptionFromWinner()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
@@ -214,12 +211,11 @@ class BattleTest extends CoreModelTestCase
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
|
||||
$this->expectException(BattleNotOverException::class);
|
||||
|
||||
$battle->getWinner();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException LotGD\Core\Exceptions\BattleNotOverException
|
||||
*/
|
||||
public function testBattleNotOverExceptionFromLoser()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
@@ -229,12 +225,13 @@ class BattleTest extends CoreModelTestCase
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
|
||||
$this->expectException(BattleNotOverException::class);
|
||||
|
||||
$battle->getLoser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the BattleIsOverException gets thrown.
|
||||
* @expectedException LotGD\Core\Exceptions\BattleIsOverException
|
||||
*/
|
||||
public function testBattleIsOverException()
|
||||
{
|
||||
@@ -245,6 +242,8 @@ class BattleTest extends CoreModelTestCase
|
||||
|
||||
$battle = new Battle($this->getMockGame($character), $character, $monster);
|
||||
|
||||
$this->expectException(BattleIsOverException::class);
|
||||
|
||||
// Fighting for 99 rounds should be enough for determining a loser - and to
|
||||
// throw the exception.
|
||||
for ($n = 0; $n < 99; $n++) {
|
||||
@@ -1358,7 +1357,7 @@ class BattleTest extends CoreModelTestCase
|
||||
]));
|
||||
|
||||
$modifier = $player->getBuffs()->getGoodguyAttackModifier();
|
||||
$this->assertEquals(0.15498, $modifier, '', 0.001);
|
||||
$this->assertEqualsWithDelta(0.15498, $modifier, 0.001);
|
||||
}
|
||||
|
||||
public function testBufflistGoodguyDefenseModifier()
|
||||
@@ -1387,7 +1386,7 @@ class BattleTest extends CoreModelTestCase
|
||||
]));
|
||||
|
||||
$modifier = $player->getBuffs()->getGoodguyDefenseModifier();
|
||||
$this->assertEquals(7.2408, $modifier, '', 0.001);
|
||||
$this->assertEqualsWithDelta(7.2408, $modifier, 0.001);
|
||||
}
|
||||
|
||||
public function testBufflistGoodguyDamageModifier()
|
||||
@@ -1416,7 +1415,7 @@ class BattleTest extends CoreModelTestCase
|
||||
]));
|
||||
|
||||
$modifier = $player->getBuffs()->getGoodguyDamageModifier();
|
||||
$this->assertEquals(2.5, $modifier, '', 0.001);
|
||||
$this->assertEqualsWithDelta(2.5, $modifier, 0.001);
|
||||
}
|
||||
|
||||
public function testBufflistBadguyAttackModifier()
|
||||
@@ -1445,7 +1444,7 @@ class BattleTest extends CoreModelTestCase
|
||||
]));
|
||||
|
||||
$modifier = $player->getBuffs()->getBadguyAttackModifier();
|
||||
$this->assertEquals(0.15498, $modifier, '', 0.001);
|
||||
$this->assertEqualsWithDelta(0.15498, $modifier, 0.001);
|
||||
}
|
||||
|
||||
public function testBufflistBadguyDefenseModifier()
|
||||
@@ -1474,7 +1473,7 @@ class BattleTest extends CoreModelTestCase
|
||||
]));
|
||||
|
||||
$modifier = $player->getBuffs()->getBadguyDefenseModifier();
|
||||
$this->assertEquals(7.2408, $modifier, '', 0.001);
|
||||
$this->assertEqualsWithDelta(7.2408, $modifier, 0.001);
|
||||
}
|
||||
|
||||
public function testBufflistBadguyDamageModifier()
|
||||
@@ -1503,7 +1502,7 @@ class BattleTest extends CoreModelTestCase
|
||||
]));
|
||||
|
||||
$modifier = $player->getBuffs()->getBadguyDamageModifier();
|
||||
$this->assertEquals(2.5, $modifier, '', 0.001);
|
||||
$this->assertEqualsWithDelta(2.5, $modifier, 0.001);
|
||||
}
|
||||
|
||||
public function testBuffActivatedAt()
|
||||
|
||||
@@ -19,7 +19,7 @@ class BootstrapTest extends TestCase
|
||||
{
|
||||
private $logger;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->logger = new Logger('test');
|
||||
$this->logger->pushHandler(new NullHandler());
|
||||
@@ -83,11 +83,11 @@ class BootstrapTest extends TestCase
|
||||
$game->getEntityManager()->persist($user);
|
||||
$game->getEntityManager()->flush();
|
||||
$id = $user->getId();
|
||||
$this->assertInternalType("int", $id);
|
||||
$this->assertIsInt($id);
|
||||
$game->getEntityManager()->clear();
|
||||
$user = $game->getEntityManager()->getRepository(UserEntity::class)->find($id);
|
||||
$this->assertInternalType("int", $user->getId());
|
||||
$this->assertInternalType("string", $user->getName());
|
||||
$this->assertIsInt($user->getId());
|
||||
$this->assertIsSTring($user->getName());
|
||||
$this->assertSame("Monthy", $user->getName());
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ class BootstrapTest extends TestCase
|
||||
$game->getEntityManager()->persist($user);
|
||||
$game->getEntityManager()->flush();
|
||||
$id = $user->getId();
|
||||
$this->assertInternalType("int", $id);
|
||||
$this->assertIsInt($id);
|
||||
$game->getEntityManager()->clear();
|
||||
$user = $game->getEntityManager()->getRepository(UserEntity::class)->find($id);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class ComposerManagerTest extends TestCase
|
||||
{
|
||||
private $logger;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->logger = new Logger('test');
|
||||
$this->logger->pushHandler(new NullHandler());
|
||||
|
||||
@@ -17,7 +17,7 @@ class ConfigurationTest extends TestCase
|
||||
private $logger;
|
||||
private $configDir;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
$this->configDir = __DIR__ . DIRECTORY_SEPARATOR . join(DIRECTORY_SEPARATOR, ['datasets', 'config']);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class EventManagerTest extends CoreModelTestCase
|
||||
/** @var string default data set */
|
||||
protected $dataset = "eventManager";
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
+1
-1
@@ -79,7 +79,7 @@ class GameTest extends CoreModelTestCase
|
||||
|
||||
public $g;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ abstract class ModelTestCase extends TestCase
|
||||
return self::$em;
|
||||
}
|
||||
|
||||
protected function setUp()
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->getConnection();
|
||||
|
||||
@@ -150,7 +150,7 @@ abstract class ModelTestCase extends TestCase
|
||||
}
|
||||
}
|
||||
|
||||
protected function tearDown() {
|
||||
protected function tearDown(): void {
|
||||
parent::tearDown();
|
||||
|
||||
/** @var \PDO $pdo */
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace LotGD\Core\Tests\Models;
|
||||
use LotGD\Core\EventHandler;
|
||||
use LotGD\Core\EventManager;
|
||||
use LotGD\Core\Events\EventContext;
|
||||
use LotGD\Core\Exceptions\UnexpectedArrayKeyException;
|
||||
use LotGD\Core\Game;
|
||||
use LotGD\Core\GameBuilder;
|
||||
use LotGD\Core\Models\Character;
|
||||
@@ -110,21 +111,21 @@ class CharacterModelTest extends CoreModelTestCase
|
||||
|
||||
/**
|
||||
* Tests character creation with faulty data
|
||||
* @param type $characterData
|
||||
* @param array $characterData
|
||||
* @dataProvider invalidCharacters
|
||||
* @expectedException TypeError
|
||||
*/
|
||||
public function testFaultyCreation(array $characterData)
|
||||
{
|
||||
$this->expectException(\TypeError::class);
|
||||
Character::create($characterData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if invalid array key given during Character::create throws an exception
|
||||
* @expectedException \LotGD\Core\Exceptions\UnexpectedArrayKeyException
|
||||
*/
|
||||
public function testUnknownArrayKey()
|
||||
{
|
||||
$this->expectException(UnexpectedArrayKeyException::class);
|
||||
Character::create([
|
||||
"name" => "Walter",
|
||||
"maxHealth" => 15,
|
||||
|
||||
@@ -39,7 +39,7 @@ class CharaterStatsTest extends CoreModelTestCase
|
||||
/** @var string default data set */
|
||||
protected $dataset = "character_stats";
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
@@ -48,7 +48,7 @@ class CharaterStatsTest extends CoreModelTestCase
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
public function tearDown(): void
|
||||
{
|
||||
$game = $this->g;
|
||||
$game->getEventManager()->unsubscribe("#h/lotgd/core/characterStats/populate#", TestEventProvider::class, "lotgd/test");
|
||||
|
||||
@@ -48,7 +48,7 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character1, $character2]);
|
||||
|
||||
// $thread1 should come from the database
|
||||
$this->assertInternalType("int", $thread1->getId());
|
||||
$this->assertIsInt($thread1->getId());
|
||||
|
||||
$this->assertSame(3, count($thread1->getMessages()));
|
||||
$this->assertSame(2, count($character1->getMessageThreads()));
|
||||
@@ -98,7 +98,7 @@ class MessageModelTest extends CoreModelTestCase
|
||||
$thread1 = $em->getRepository(MessageThread::class)->findOrCreateFor([$character1, $character2, $character3, $character4]);
|
||||
|
||||
// $thread1 should come from the database
|
||||
$this->assertInternalType("int", $thread1->getId());
|
||||
$this->assertIsInt($thread1->getId());
|
||||
$this->assertSame(3, count($thread1->getMessages()));
|
||||
$this->assertSame(2, count($character1->getMessageThreads()));
|
||||
$this->assertSame(2, count($character2->getMessageThreads()));
|
||||
|
||||
@@ -30,7 +30,7 @@ class ModuleManagerTest extends CoreModelTestCase
|
||||
protected $game;
|
||||
protected $mm;
|
||||
|
||||
public function setUp()
|
||||
public function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ class TimeKeeperTests extends TestCase {
|
||||
private $gameOffsetSeconds;
|
||||
private $gameDaysPerDay;
|
||||
|
||||
public function setUp() {
|
||||
public function setUp(): void {
|
||||
$this->gameEpoch = new \DateTime('2015-07-27 00:00:00 PDT');;
|
||||
$this->gameOffsetSeconds = 0;
|
||||
$this->gameDaysPerDay = 2;
|
||||
|
||||
Reference in New Issue
Block a user