Skip to content
Permalink
Browse files

Refactored CharacterScene as CharacterViewpoint

closes #15
  • Loading branch information...
Vassyli committed Apr 29, 2016
1 parent 2bb9bca commit 53d82646bf48c63314020310c92b1d11b9c16cf3
@@ -35,7 +35,7 @@ class Character
private $health = 10;
/** @OneToMany(targetEntity="CharacterProperty", mappedBy="owner", cascade={"persist"}) */
private $properties;
/** @OneToMany(targetEntity="CharacterScene", mappedBy="owner", cascade={"persist"}) */
/** @OneToMany(targetEntity="CharacterViewpoint", mappedBy="owner", cascade={"persist"}) */
private $characterScene;
/** @var array */
@@ -144,12 +144,12 @@ public function getHealth(): int
/**
* Returns the current character scene and creates one if it is non-existant
* @return \LotGD\Core\Models\CharacterScene
* @return \LotGD\Core\Models\CharacterViewpoint
*/
public function getCharacterScene(): CharacterScene
public function getCharacterScene(): CharacterViewpoint
{
if (count($this->characterScene) === 0) {
$characterScene = CharacterScene::Create(["owner" => $this]);
$characterScene = CharacterViewpoint::Create(["owner" => $this]);
$this->characterScene->add($characterScene);
}
@@ -10,9 +10,9 @@
* A CharacterScene is the current Scene a character is experiencing with
* all changes from modules included.
* @Entity
* @Table(name="character_scenes")
* @Table(name="character_viewpoints")
*/
class CharacterScene
class CharacterViewpoint
{
use Creator;
use SceneBasics;
@@ -4,17 +4,17 @@
namespace LotGD\Core\Tests\Models;
use LotGD\Core\Models\Character;
use LotGD\Core\Models\CharacterScene;
use LotGD\Core\Models\CharacterViewpoint;
use LotGD\Core\Models\Scene;
use LotGD\Core\Tests\ModelTestCase;
/**
* Tests the management of CharacterScenes
*/
class CharacterSceneModelTest extends ModelTestCase
class CharacterViewpointTest extends ModelTestCase
{
/** @var string default data set */
protected $dataset = "characterScenes";
protected $dataset = "characterViewpoints";
public function testGetters() {
$em = $this->getEntityManager();
@@ -24,7 +24,7 @@ public function testGetters() {
$this->assertSame(2, $testCharacter->getId());
$characterScene = $testCharacter->getCharacterScene();
$this->assertInstanceOf(CharacterScene::class, $characterScene);
$this->assertInstanceOf(CharacterViewpoint::class, $characterScene);
$this->assertSame("The Village", $characterScene->getTitle());
$this->assertSame("This is the village.", $characterScene->getDescription());
@@ -33,7 +33,7 @@ public function testGetters() {
$this->assertSame(1, $testCharacter->getId());
$characterScene = $testCharacter->getCharacterScene();
$this->assertInstanceOf(CharacterScene::class, $characterScene);
$this->assertInstanceOf(CharacterViewpoint::class, $characterScene);
$em->flush();
}
@@ -7,7 +7,7 @@ characters:
id: 2
name: "Char with a Scene"
displayName: "B"
character_scenes:
character_viewpoints:
-
owner_id: 2
title: "The Village"

0 comments on commit 53d8264

Please sign in to comment.
You can’t perform that action at this time.