示例#1
0
 public function setUp()
 {
     parent::setUp();
     // Prepare a universe with one planet.
     // 1) an terrestrial planet
     $universeEntity = new UniverseEntity();
     $universeEntity->setMaxCelestialBodies(1);
     $universeEntity->setMaxSystems(1);
     $universeEntity->setMinCelestialBodies(1);
     $universeEntity->setMinSystems(1);
     $this->em->persist($universeEntity);
     $galaxyEntity = new GalaxyEntity();
     $galaxyEntity->setNumber(0);
     $galaxyEntity->setUniverse($universeEntity);
     $this->em->persist($galaxyEntity);
     $systemEntity = new SystemEntity();
     $systemEntity->setGalaxy($galaxyEntity);
     $systemEntity->setNumber(0);
     $this->em->persist($systemEntity);
     $terrestrialPlanetEntity = new TerrestrialPlanetEntity();
     $terrestrialPlanetEntity->setNumber(0);
     $terrestrialPlanetEntity->setSystem($systemEntity);
     $this->em->persist($terrestrialPlanetEntity);
     $this->em->flush();
     $this->celestialBody = $terrestrialPlanetEntity;
     /* @var $configBuilder \Codeception\Specify\ConfigBuilder */
     $configBuilder = $this->specifyConfig();
     $configBuilder->shallowClone();
 }
示例#2
0
 public function setUp()
 {
     parent::setUp();
     $this->clearDb();
     // Prepare a universe with
     // - 2 galaxies (0: chaos, 1: normal)
     // - chaos galaxy has 1 system with one free planet
     // - normal galaxy has 2 systems
     // -- 0: system with 1 free planet but a nebula
     // -- 1: system with 1 free planet and 1 planet with an outpost
     $universeEntity = new UniverseEntity();
     $universeEntity->setMaxCelestialBodies(2);
     $universeEntity->setMaxSystems(2);
     $universeEntity->setMinCelestialBodies(1);
     $universeEntity->setMinSystems(1);
     $this->em->persist($universeEntity);
     // --- chaos galaxy -------------------------------------------------------
     $g_0 = new GalaxyEntity();
     $g_0->setNumber(0);
     $g_0->setUniverse($universeEntity);
     $this->em->persist($g_0);
     $s_0_0 = new SystemEntity();
     $s_0_0->setGalaxy($g_0);
     $s_0_0->setNumber(0);
     $this->em->persist($s_0_0);
     $cb_0_0_0 = new AsteroidEntity();
     $cb_0_0_0->setNumber(0);
     $cb_0_0_0->setSystem($s_0_0);
     $this->em->persist($cb_0_0_0);
     // --- normal galaxy ------------------------------------------------------
     $g_1 = new GalaxyEntity();
     $g_1->setNumber(1);
     $g_1->setUniverse($universeEntity);
     $this->em->persist($g_1);
     // --- system with nebula -------------------------------------------------
     $redNebula = new SystemWideModifierEntity();
     $redNebula->setLabel('roter Nebel');
     $redNebula->setNebulaColor(hexdec('FF0000'));
     $this->em->persist($redNebula);
     $s_1_0 = new SystemEntity();
     $s_1_0->setGalaxy($g_1);
     $s_1_0->setModifier($redNebula);
     $s_1_0->setNumber(0);
     $this->em->persist($s_1_0);
     $cb_1_0_0 = new IceGiantEntity();
     $cb_1_0_0->setNumber(0);
     $cb_1_0_0->setSystem($s_1_0);
     $this->em->persist($cb_1_0_0);
     // --- system without nebula ----------------------------------------------
     $s_1_1 = new SystemEntity();
     $s_1_1->setGalaxy($g_1);
     $s_1_1->setNumber(1);
     $this->em->persist($s_1_1);
     $cb_1_1_0 = new VoidEntity();
     $cb_1_1_0->setNumber(0);
     $cb_1_1_0->setSystem($s_1_1);
     $this->em->persist($cb_1_1_0);
     $cb_1_1_1 = new TerrestrialPlanetEntity();
     $cb_1_1_1->setNumber(1);
     $cb_1_1_1->setSystem($s_1_1);
     $this->em->persist($cb_1_1_1);
     $user = new UserEntity();
     $user->setName('Someone');
     $this->em->persist($user);
     $outpostEntity = new OutpostEntity();
     $outpostEntity->setCelestialBody($cb_1_1_1);
     $outpostEntity->setName("Someone's outpost");
     $outpostEntity->setOwner($user);
     $this->em->persist($outpostEntity);
     $this->em->flush();
     // $cb_1_1_0 is the only celestial body suitable for a new player.
     // all other celestial bodies are in a chaos galaxy, in a system with
     // nebula, or have an outpost
     $this->celestialBodyForNewPlayer = $cb_1_1_0;
     $this->repo = $this->em->getRepository(CelestialBodyEntity::class);
     /* @var $configBuilder \Codeception\Specify\ConfigBuilder */
     $configBuilder = $this->specifyConfig();
     $configBuilder->shallowClone();
 }