Changed viewpoint to use uuid-based primary key
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ class Action
|
||||
* @param string|null $title
|
||||
* @param array $parameters
|
||||
*/
|
||||
public function __construct(int $destinationSceneId, ?string $title = null, array $parameters = [])
|
||||
public function __construct(string $destinationSceneId, ?string $title = null, array $parameters = [])
|
||||
{
|
||||
$this->id = bin2hex(random_bytes(8));
|
||||
$this->destinationSceneId = $destinationSceneId;
|
||||
@@ -43,7 +43,7 @@ class Action
|
||||
* go if they take this action.
|
||||
* @return int
|
||||
*/
|
||||
public function getDestinationSceneId(): int
|
||||
public function getDestinationSceneId(): string
|
||||
{
|
||||
return $this->destinationSceneId;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ use LotGD\Core\Exceptions\ArgumentException;
|
||||
use LotGD\Core\Tools\Model\Creator;
|
||||
use LotGD\Core\Tools\Model\Deletor;
|
||||
use LotGD\Core\Tools\Model\SceneBasics;
|
||||
use Ramsey\Uuid\Uuid;
|
||||
use Ramsey\Uuid\UuidInterface;
|
||||
|
||||
/**
|
||||
* A scene is a location within the game, such as the Village or the Tavern. Designed
|
||||
@@ -26,8 +28,8 @@ class Scene implements CreateableInterface, SceneConnectable
|
||||
use Deletor;
|
||||
use SceneBasics;
|
||||
|
||||
/** @Id @Column(type="integer") @GeneratedValue */
|
||||
private $id;
|
||||
/** @Id @Column(type="string", length=36, unique=True, name="id", options={"fixed" = true}) */
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* @OneToMany(targetEntity="SceneConnectionGroup", mappedBy="scene", cascade={"persist", "remove"})
|
||||
@@ -61,6 +63,8 @@ class Scene implements CreateableInterface, SceneConnectable
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->id = Uuid::uuid4()->toString();
|
||||
|
||||
$this->connectionGroups = new ArrayCollection();
|
||||
$this->outgoingConnections = new ArrayCollection();
|
||||
$this->incomingConnections = new ArrayCollection();
|
||||
@@ -70,7 +74,7 @@ class Scene implements CreateableInterface, SceneConnectable
|
||||
* Returns the primary ID for this scene.
|
||||
* @return int
|
||||
*/
|
||||
public function getId(): int
|
||||
public function getId(): string
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ class SceneConnection
|
||||
{
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="Scene")
|
||||
* @ManyToOne(targetEntity="Scene", inversedBy="outgoingConnections")
|
||||
* @JoinColumn(name="outgoingScene", referencedColumnName="id")
|
||||
*/
|
||||
private $outgoingScene;
|
||||
|
||||
/**
|
||||
* @Id
|
||||
* @ManyToOne(targetEntity="Scene")
|
||||
* @ManyToOne(targetEntity="Scene", inversedBy="incomingConnections")
|
||||
* @JoinColumn(name="incomingScene", referencedColumnName="id")
|
||||
*/
|
||||
private $incomingScene;
|
||||
|
||||
@@ -329,7 +329,7 @@ class Viewpoint implements CreateableInterface
|
||||
* Removes any actions that correspond to a given scene ID, if present.
|
||||
* @param int $id
|
||||
*/
|
||||
public function removeActionsWithSceneId(int $id)
|
||||
public function removeActionsWithSceneId(string $id)
|
||||
{
|
||||
foreach ($this->getActionGroups() as $group) {
|
||||
$actions = $group->getActions();
|
||||
|
||||
+14
-10
@@ -37,15 +37,16 @@ class DefaultSceneProvider implements EventHandler
|
||||
));
|
||||
}
|
||||
|
||||
$context->setDataField("scene", $g->getEntityManager()->getRepository(Scene::class)->find(1));
|
||||
$context->setDataField("scene", $g->getEntityManager()->getRepository(Scene::class)
|
||||
->find("30000000-0000-0000-0000-000000000001"));
|
||||
break;
|
||||
case 'h/lotgd/core/navigate-to/lotgd/tests/village':
|
||||
$v = $context->getDataField('viewpoint');
|
||||
|
||||
self::$actionGroups = [new ActionGroup('default', 'Title', 0)];
|
||||
self::$actionGroups[0]->setActions([
|
||||
new Action(2), // This is a real sceneId in game.yml
|
||||
new Action(101),
|
||||
new Action("30000000-0000-0000-0000-000000000002"), // This is a real sceneId in game.yml
|
||||
new Action("30000000-0000-0000-0000-000000000101"),
|
||||
]);
|
||||
$v->setActionGroups(self::$actionGroups);
|
||||
|
||||
@@ -217,7 +218,7 @@ class GameTest extends CoreModelTestCase
|
||||
$this->g->getEventManager()->subscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$action = new Action(7, null, ["foo" => "baz"]);
|
||||
$action = new Action("30000000-0000-0000-0000-000000000007", null, ["foo" => "baz"]);
|
||||
$actionId = $action->getId();
|
||||
|
||||
$ag = new ActionGroup("group1", "Group 1", 5);
|
||||
@@ -247,7 +248,7 @@ class GameTest extends CoreModelTestCase
|
||||
$this->g->getEventManager()->subscribe('#h/lotgd/core/navigate-to/lotgd/tests/paramaters#', DefaultSceneProvider::class, 'lotgd/core/tests');
|
||||
$this->getEntityManager()->flush();
|
||||
|
||||
$action = new Action(7, null, ["foo" => "baz"]);
|
||||
$action = new Action("30000000-0000-0000-0000-000000000007", null, ["foo" => "baz"]);
|
||||
$actionId = $action->getId();
|
||||
|
||||
$ag = new ActionGroup("group1", "Group 1", 5);
|
||||
@@ -298,9 +299,9 @@ class GameTest extends CoreModelTestCase
|
||||
$this->assertSame([
|
||||
"Parent Scene",
|
||||
[
|
||||
ActionGroup::DefaultGroup => [1],
|
||||
"lotgd/tests/none/child1" => [5],
|
||||
"lotgd/tests/none/child2" => [6],
|
||||
ActionGroup::DefaultGroup => ["30000000-0000-0000-0000-000000000001"],
|
||||
"lotgd/tests/none/child1" => ["30000000-0000-0000-0000-000000000005"],
|
||||
"lotgd/tests/none/child2" => ["30000000-0000-0000-0000-000000000006"],
|
||||
ActionGroup::HiddenGroup => [],
|
||||
]
|
||||
], $viewpointToArray($v1));
|
||||
@@ -310,7 +311,10 @@ class GameTest extends CoreModelTestCase
|
||||
$this->assertSame([
|
||||
"Child Scene 1",
|
||||
[
|
||||
ActionGroup::DefaultGroup => [6, 4],
|
||||
ActionGroup::DefaultGroup => [
|
||||
"30000000-0000-0000-0000-000000000006",
|
||||
"30000000-0000-0000-0000-000000000004"
|
||||
],
|
||||
ActionGroup::HiddenGroup => [],
|
||||
]
|
||||
], $viewpointToArray($v2));
|
||||
@@ -320,7 +324,7 @@ class GameTest extends CoreModelTestCase
|
||||
$this->assertSame([
|
||||
"Child Scene 2",
|
||||
[
|
||||
ActionGroup::DefaultGroup => [4],
|
||||
ActionGroup::DefaultGroup => ["30000000-0000-0000-0000-000000000004"],
|
||||
ActionGroup::HiddenGroup => [],
|
||||
]
|
||||
], $viewpointToArray($v3));
|
||||
|
||||
@@ -3,8 +3,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace LotGD\Core\Tests\Models;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
|
||||
use LotGD\Core\Exceptions\ArgumentException;
|
||||
use LotGD\Core\Models\{Scene, SceneConnection, SceneConnectionGroup};
|
||||
use LotGD\Core\Tests\CoreModelTestCase;
|
||||
@@ -54,6 +52,8 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
// create new scene, flush and clear. Number of scenes in db should be +1
|
||||
$newScene = Scene::create($this->getTestSceneData());
|
||||
$id = $newScene->getId();
|
||||
|
||||
$newScene->save($em);
|
||||
$this->flushAndClear();
|
||||
unset($newScene);
|
||||
@@ -63,7 +63,7 @@ class SceneModelTest extends CoreModelTestCase
|
||||
$this->assertSame($n1 + 1, $n2);
|
||||
|
||||
// fetch new scene, delete, flush and clear.
|
||||
$newScene = $em->getRepository(Scene::class)->findOneBy($this->getTestSceneData());
|
||||
$newScene = $em->getRepository(Scene::class)->find($id);
|
||||
$newScene->delete($em);
|
||||
$this->flushAndClear();
|
||||
|
||||
@@ -87,7 +87,7 @@ class SceneModelTest extends CoreModelTestCase
|
||||
// create new scene, connect to another one. Number of scenes must be +1, number of connections must be +1
|
||||
// this tests for cascade=persist
|
||||
$scene = Scene::create($this->getTestSceneData());
|
||||
$scene->connect($em->getRepository(Scene::class)->find(1));
|
||||
$scene->connect($em->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001"));
|
||||
$scene->save($em);
|
||||
$this->flushAndClear();
|
||||
unset($scene);
|
||||
@@ -144,7 +144,7 @@ class SceneModelTest extends CoreModelTestCase
|
||||
public function testGetters()
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
$scene = $em->getRepository(Scene::class)->find(2);
|
||||
$scene = $em->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
|
||||
$this->assertEquals("The Forest", $scene->getTitle());
|
||||
$this->assertEquals("This is a very dangerous and dark forest", $scene->getDescription());
|
||||
@@ -154,7 +154,7 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfHasConnectionGroupReturnsTrueIfConnectionGroupExists()
|
||||
{
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find( "30000000-0000-0000-0000-000000000001");
|
||||
|
||||
$this->assertTrue($scene->hasConnectionGroup("lotgd/tests/village/outside"));
|
||||
$this->assertTrue($scene->hasConnectionGroup("lotgd/tests/village/market"));
|
||||
@@ -163,14 +163,14 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfHasConnectionGroupReturnsFalseIfConnectionGroupDoesNotExist()
|
||||
{
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(2);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find( "30000000-0000-0000-0000-000000000002");
|
||||
|
||||
$this->assertFalse($scene2->hasConnectionGroup("lotgd/tests/village/outside"));
|
||||
$this->assertFalse($scene2->hasConnectionGroup("lotgd/tests/village/market"));
|
||||
$this->assertFalse($scene2->hasConnectionGroup("lotgd/tests/village/empty"));
|
||||
|
||||
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
|
||||
$this->assertFalse($scene1->hasConnectionGroup("lotgd/tests/village/23426"));
|
||||
}
|
||||
@@ -178,7 +178,7 @@ class SceneModelTest extends CoreModelTestCase
|
||||
public function testIfAddConnectionGroupWorks()
|
||||
{
|
||||
$connectionGroup = new SceneConnectionGroup("lotgd/tests/village/new", "New Street");
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
|
||||
$this->assertFalse($scene->hasConnectionGroup("lotgd/tests/village/new"));
|
||||
|
||||
@@ -191,8 +191,9 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfAddConnectionGroupThrowsArgumentExceptionIfGroupIsAlreadyAssignedToItself()
|
||||
{
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)->findOneBy(["scene" => 1, "name" => "lotgd/tests/village/outside"]);
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)
|
||||
->findOneBy(["scene" => "30000000-0000-0000-0000-000000000001", "name" => "lotgd/tests/village/outside"]);
|
||||
|
||||
$this->expectException(ArgumentException::class);
|
||||
$scene->addConnectionGroup($connectionGroup);
|
||||
@@ -200,8 +201,9 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfAddConnectionGroupThrowsArgumentExceptionIfGroupIsAlreadyAssignedToSomwhereElse()
|
||||
{
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find(2);
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)->findOneBy(["scene" => 1, "name" => "lotgd/tests/village/outside"]);
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)
|
||||
->findOneBy(["scene" => "30000000-0000-0000-0000-000000000001", "name" => "lotgd/tests/village/outside"]);
|
||||
|
||||
$this->expectException(ArgumentException::class);
|
||||
$scene->addConnectionGroup($connectionGroup);
|
||||
@@ -209,8 +211,9 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testifDropConnectionGroupWorks()
|
||||
{
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)->findOneBy(["scene" => 1, "name" => "lotgd/tests/village/outside"]);
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)
|
||||
->findOneBy(["scene" => "30000000-0000-0000-0000-000000000001", "name" => "lotgd/tests/village/outside"]);
|
||||
|
||||
$this->assertTrue($scene->hasConnectionGroup("lotgd/tests/village/outside"));
|
||||
|
||||
@@ -223,8 +226,9 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfDropConnectionGroupThrowsArgumentExceptionIfEntityIsRemovedFromNonOwningScene()
|
||||
{
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find(2);
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)->findOneBy(["scene" => 1, "name" => "lotgd/tests/village/outside"]);
|
||||
$scene = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
$connectionGroup = $this->getEntityManager()->getRepository(SceneConnectionGroup::class)
|
||||
->findOneBy(["scene" => "30000000-0000-0000-0000-000000000001", "name" => "lotgd/tests/village/outside"]);
|
||||
|
||||
$this->expectException(ArgumentException::class);
|
||||
$scene->dropConnectionGroup($connectionGroup);
|
||||
@@ -232,8 +236,8 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfGetConnectedScenesReturnsConnectedScenes()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(2);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
|
||||
$this->assertCount(3, $scene1->getConnectedScenes());
|
||||
$this->assertCount(1, $scene2->getConnectedScenes());
|
||||
@@ -246,9 +250,9 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfIsConnectedToReturnsExpectedReturnValue()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(2);
|
||||
$scene5 = $this->getEntityManager()->getRepository(Scene::class)->find(5);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
$scene5 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000005");
|
||||
|
||||
$this->assertTrue($scene1->isConnectedTo($scene2));
|
||||
$this->assertTrue($scene2->isConnectedTo($scene1));
|
||||
@@ -260,8 +264,8 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfTwoScenesCanGetConnected()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(2);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(5);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000005");
|
||||
|
||||
$scene1->connect($scene2);
|
||||
|
||||
@@ -275,8 +279,8 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfASceneConnectionGroupCanGetConnectedToAScene()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(5);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000005");
|
||||
|
||||
$scene1->getConnectionGroup("lotgd/tests/village/outside")->connect($scene2);
|
||||
|
||||
@@ -290,8 +294,8 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfASceneCanGetConnectedToASceneConnectionGroup()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(5);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000005");
|
||||
|
||||
$scene2->connect($scene1->getConnectionGroup("lotgd/tests/village/outside"));
|
||||
|
||||
@@ -305,8 +309,8 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfASceneConnectionGroupCanGetConnectedToAnotherSceneConnectionGroup()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(5);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000005");
|
||||
$scene2->addConnectionGroup(new SceneConnectionGroup("test/orphaned", "Orphan group"));
|
||||
|
||||
$scene1
|
||||
@@ -325,7 +329,7 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfConnectingASceneToItselfThrowsAnException()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
|
||||
$this->expectException(ArgumentException::class);
|
||||
$scene1->connect($scene1);
|
||||
@@ -344,8 +348,8 @@ class SceneModelTest extends CoreModelTestCase
|
||||
|
||||
public function testIfConnectingASceneToAnotherAlreadyConnectedSceneThrowsAnException()
|
||||
{
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find(1);
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find(2);
|
||||
$scene1 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000001");
|
||||
$scene2 = $this->getEntityManager()->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
|
||||
$this->expectException(ArgumentException::class);
|
||||
$scene1->connect($scene2);
|
||||
|
||||
@@ -65,7 +65,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
|
||||
$testCharacter = $em->getRepository(Character::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
$testScene = $em->getRepository(Scene::class)->find(2);
|
||||
$testScene = $em->getRepository(Scene::class)->find("30000000-0000-0000-0000-000000000002");
|
||||
|
||||
$this->assertSame("The Village", $testCharacter->getViewpoint()->getTitle());
|
||||
|
||||
@@ -82,12 +82,12 @@ class ViewpointTest extends CoreModelTestCase
|
||||
|
||||
$ag1 = new ActionGroup('id1', 'title1', 42);
|
||||
$ag1->setActions([
|
||||
new Action(1),
|
||||
new Action(2)
|
||||
new Action("30000000-0000-0000-0000-000000000001"),
|
||||
new Action("30000000-0000-0000-0000-000000000002")
|
||||
]);
|
||||
$ag2 = new ActionGroup('id2', 'title2', 101);
|
||||
$ag2->setActions([
|
||||
new Action(3)
|
||||
new Action("30000000-0000-0000-0000-000000000003")
|
||||
]);
|
||||
|
||||
$actionGroups = [
|
||||
@@ -107,7 +107,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$this->assertEquals($ag2, $input->findActionGroupById('id2'));
|
||||
$this->assertNull($input->findActionGroupById('not-there'));
|
||||
|
||||
$testAction = new Action(4);
|
||||
$testAction = new Action("30000000-0000-0000-0000-000000000004");
|
||||
$input->addActionToGroupId($testAction, 'not-there');
|
||||
$this->assertNull($input->findActionById($testAction->getId()));
|
||||
|
||||
@@ -140,9 +140,9 @@ class ViewpointTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$a1 = new Action(1);
|
||||
$a2 = new Action(2);
|
||||
$a3 = new Action(3);
|
||||
$a1 = new Action("30000000-0000-0000-0000-000000000001");
|
||||
$a2 = new Action("30000000-0000-0000-0000-000000000002");
|
||||
$a3 = new Action("30000000-0000-0000-0000-000000000003");
|
||||
|
||||
$ag1 = new ActionGroup('id1', 'title1', 42);
|
||||
$ag1->setActions([
|
||||
@@ -152,7 +152,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
]);
|
||||
$ag2 = new ActionGroup('id2', 'title2', 101);
|
||||
$ag2->setActions([
|
||||
new Action(4)
|
||||
new Action("30000000-0000-0000-0000-000000000004")
|
||||
]);
|
||||
|
||||
$actionGroups = [
|
||||
@@ -169,7 +169,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$output = $em->getRepository(Viewpoint::class)->find("10000000-0000-0000-0000-000000000002");
|
||||
|
||||
// Not finding the scene ID should change nothing.
|
||||
$output->removeActionsWithSceneId(1000);
|
||||
$output->removeActionsWithSceneId("30000000-0000-0000-0000-000000001000");
|
||||
$this->assertEquals($actionGroups, $output->getActionGroups());
|
||||
|
||||
$ag1_output = new ActionGroup('id1', 'title1', 42);
|
||||
@@ -182,7 +182,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
$ag1_output,
|
||||
$ag2
|
||||
];
|
||||
$output->removeActionsWithSceneId(2);
|
||||
$output->removeActionsWithSceneId("30000000-0000-0000-0000-000000000002");
|
||||
$this->assertEquals($actionGroupsWithout2, $output->getActionGroups());
|
||||
}
|
||||
|
||||
@@ -215,9 +215,9 @@ class ViewpointTest extends CoreModelTestCase
|
||||
{
|
||||
$em = $this->getEntityManager();
|
||||
|
||||
$a1 = new Action(1);
|
||||
$a2 = new Action(2);
|
||||
$a3 = new Action(3);
|
||||
$a1 = new Action("30000000-0000-0000-0000-000000000001");
|
||||
$a2 = new Action("30000000-0000-0000-0000-000000000002");
|
||||
$a3 = new Action("30000000-0000-0000-0000-000000000003");
|
||||
|
||||
$ag1 = new ActionGroup('id1', 'title1', 42);
|
||||
$ag1->setActions([
|
||||
@@ -227,7 +227,7 @@ class ViewpointTest extends CoreModelTestCase
|
||||
]);
|
||||
$ag2 = new ActionGroup('id2', 'title2', 101);
|
||||
$ag2->setActions([
|
||||
new Action(4)
|
||||
new Action("30000000-0000-0000-0000-000000000004")
|
||||
]);
|
||||
|
||||
$actionGroups = [
|
||||
|
||||
+21
-21
@@ -22,74 +22,74 @@ viewpoints:
|
||||
actionGroups: "a:0:{}"
|
||||
scenes:
|
||||
-
|
||||
id: 1
|
||||
id: "30000000-0000-0000-0000-000000000001"
|
||||
title: "The Village"
|
||||
description: "This is the village."
|
||||
template: "lotgd/tests/village"
|
||||
-
|
||||
id: 2
|
||||
id: "30000000-0000-0000-0000-000000000002"
|
||||
title: "The Forest"
|
||||
description: "This is a very dangerous and dark forest"
|
||||
template: "lotgd/tests/forest"
|
||||
-
|
||||
id: 3
|
||||
id: "30000000-0000-0000-0000-000000000003"
|
||||
title: "The Weaponry"
|
||||
description: "This is the place where you can buy awesome weapons"
|
||||
template: "lotgd/tests/weaponry"
|
||||
-
|
||||
id: 4
|
||||
id: "30000000-0000-0000-0000-000000000004"
|
||||
title: "Parent Scene"
|
||||
description: "This is a parent scene that connects to two children."
|
||||
template: "lotgd/tests/none"
|
||||
-
|
||||
id: 5
|
||||
id: "30000000-0000-0000-0000-000000000005"
|
||||
title: "Child Scene 1"
|
||||
description: "This is a parent scene that connects to two children."
|
||||
template: "lotgd/tests/none"
|
||||
-
|
||||
id: 6
|
||||
id: "30000000-0000-0000-0000-000000000006"
|
||||
title: "Child Scene 2"
|
||||
description: "This is a parent scene that connects to two children."
|
||||
template: "lotgd/tests/none"
|
||||
-
|
||||
id: 7
|
||||
id: "30000000-0000-0000-0000-000000000007"
|
||||
title: "Parameter test"
|
||||
description: "This is a parameter test"
|
||||
template: "lotgd/tests/paramaters"
|
||||
scene_connection_groups:
|
||||
-
|
||||
scene: 4
|
||||
scene: "30000000-0000-0000-0000-000000000004"
|
||||
name: "lotgd/tests/none/child1"
|
||||
title: "Child 1"
|
||||
-
|
||||
scene: 4
|
||||
scene: "30000000-0000-0000-0000-000000000004"
|
||||
name: "lotgd/tests/none/child2"
|
||||
title: "Child 2"
|
||||
scene_connections:
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 2
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000002"
|
||||
directionality: 0
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 3
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000003"
|
||||
directionality: 0
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 4
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000004"
|
||||
directionality: 0
|
||||
-
|
||||
outgoingScene: 4
|
||||
incomingScene: 5
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000004"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000005"
|
||||
outgoingConnectionGroupName: "lotgd/tests/none/child1"
|
||||
directionality: 0
|
||||
-
|
||||
outgoingScene: 4
|
||||
incomingScene: 6
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000004"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000006"
|
||||
outgoingConnectionGroupName: "lotgd/tests/none/child2"
|
||||
directionality: 0
|
||||
-
|
||||
outgoingScene: 5
|
||||
incomingScene: 6
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000005"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000006"
|
||||
directionality: 1
|
||||
|
||||
|
||||
+15
-15
@@ -1,53 +1,53 @@
|
||||
scenes:
|
||||
-
|
||||
id: 1
|
||||
id: "30000000-0000-0000-0000-000000000001"
|
||||
title: "The Village"
|
||||
description: "This is the village."
|
||||
template: "lotgd/tests/village"
|
||||
-
|
||||
id: 2
|
||||
id: "30000000-0000-0000-0000-000000000002"
|
||||
title: "The Forest"
|
||||
description: "This is a very dangerous and dark forest"
|
||||
template: "lotgd/tests/forest"
|
||||
-
|
||||
id: 3
|
||||
id: "30000000-0000-0000-0000-000000000003"
|
||||
title: "The Weaponry"
|
||||
description: "This is the place where you can buy awesome weapons"
|
||||
template: "lotgd/tests/weaponry"
|
||||
-
|
||||
id: 4
|
||||
id: "30000000-0000-0000-0000-000000000004"
|
||||
title: "Another Village"
|
||||
description: "This is another village"
|
||||
template: "lotgd/tests/village"
|
||||
-
|
||||
id: 5
|
||||
id: "30000000-0000-0000-0000-000000000005"
|
||||
title: "Orphan"
|
||||
description: "This is an orphan scene"
|
||||
template: "lotgd/tests/orphan"
|
||||
scene_connection_groups:
|
||||
-
|
||||
scene: 1
|
||||
scene: "30000000-0000-0000-0000-000000000001"
|
||||
name: "lotgd/tests/village/outside"
|
||||
title: "Outside"
|
||||
-
|
||||
scene: 1
|
||||
scene: "30000000-0000-0000-0000-000000000001"
|
||||
name: "lotgd/tests/village/market"
|
||||
title: "Market"
|
||||
-
|
||||
scene: 1
|
||||
scene: "30000000-0000-0000-0000-000000000001"
|
||||
name: "lotgd/tests/village/empty"
|
||||
title: "Empty"
|
||||
-
|
||||
scene: 2
|
||||
scene: "30000000-0000-0000-0000-000000000002"
|
||||
name: "lotgd/tests/forest/category"
|
||||
title: "Empty"
|
||||
scene_connections:
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 2
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000002"
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 3
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000003"
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 4
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000004"
|
||||
@@ -18,24 +18,24 @@ viewpoints:
|
||||
actionGroups: "a:0:{}"
|
||||
scenes:
|
||||
-
|
||||
id: 1
|
||||
id: "30000000-0000-0000-0000-000000000001"
|
||||
title: "The Village"
|
||||
description: "This is the village."
|
||||
template: "lotgd/tests/village"
|
||||
-
|
||||
id: 2
|
||||
id: "30000000-0000-0000-0000-000000000002"
|
||||
title: "The Forest"
|
||||
description: "This is a very dangerous and dark forest"
|
||||
template: "lotgd/tests/forest"
|
||||
-
|
||||
id: 3
|
||||
id: "30000000-0000-0000-0000-000000000003"
|
||||
title: "The Weaponry"
|
||||
description: "This is the place where you can buy awesome weapons"
|
||||
template: "lotgd/tests/weaponry"
|
||||
scene_connections:
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 2
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000002"
|
||||
-
|
||||
outgoingScene: 1
|
||||
incomingScene: 3
|
||||
outgoingScene: "30000000-0000-0000-0000-000000000001"
|
||||
incomingScene: "30000000-0000-0000-0000-000000000003"
|
||||
Reference in New Issue
Block a user