From 846ab6018e8d14ceab4575c9d6bb96e171baec2a Mon Sep 17 00:00:00 2001 From: Vassyli Date: Fri, 19 Jan 2018 17:42:33 +0100 Subject: [PATCH] LibraryConfiguration now also knows crate packages. --- composer.json | 1 + src/LibraryConfiguration.php | 2 +- tests/BattleTest.php | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 847e8ef..3f3ced3 100644 --- a/composer.json +++ b/composer.json @@ -2,6 +2,7 @@ "name": "lotgd/core", "description": "Core functionality for Legend of the Green Dragon, a text-based RPG game.", "license": "AGPL-3.0", + "version": "0.4.0", "autoload": { "psr-4": { "LotGD\\Core\\": "src/", diff --git a/src/LibraryConfiguration.php b/src/LibraryConfiguration.php index 8a42702..bb9a7f7 100644 --- a/src/LibraryConfiguration.php +++ b/src/LibraryConfiguration.php @@ -43,7 +43,7 @@ class LibraryConfiguration if ($basePackage && $basePackage->getName() === $package->getName()) { // Whatever the base package is in this repo is at $cwd. $path = $cwd; - } else if ($package->getType() === "lotgd-module") { + } elseif (in_array($package->getType(), ["lotgd-module", "lotgd-crate"])) { // lotgd-modules are installed in the vendor directory. $installationManager = $composerManager->getComposer()->getInstallationManager(); $path = $installationManager->getInstallPath($package); diff --git a/tests/BattleTest.php b/tests/BattleTest.php index e3a92ce..60e92d1 100644 --- a/tests/BattleTest.php +++ b/tests/BattleTest.php @@ -73,6 +73,9 @@ class BattleTest extends CoreModelTestCase $battle = new Battle($this->getMockGame($character), $character, $monster); + $this->assertSame($character, $battle->getPlayer()); + $this->assertSame($monster, $battle->getMonster()); + for ($n = 0; $n < 99; $n++) { $oldPlayerHealth = $character->getHealth(); $oldMonsterHealth = $monster->getHealth();