public function testViewAnotherClan()
 {
     // create new character to lead the new clan
     $char_id_2 = TestAccountCreateAndDestroy::char_id_2();
     // create new clan
     $clan = Clan::create(Player::find($char_id_2), 'phpunit_test_clan2');
     // view new clan
     $request = Request::create('/clan/view', 'GET', ['clan_id' => $clan->id]);
     RequestWrapper::inject($request);
     $response = $this->controller->view($this->m_dependencies);
     // delete new clan
     $this->deleteClan($clan->id);
     $this->assertInstanceOf(StreamedViewResponse::class, $response);
 }
Example #2
0
 function setUp()
 {
     $this->char_id = TestAccountCreateAndDestroy::char_id();
     $this->char_id_2 = TestAccountCreateAndDestroy::char_id_2();
     $this->clan = Clan::create(Player::find($this->char_id_2), $this->clan_identity);
     $this->clan_id = $this->clan->id;
 }
Example #3
0
 /**
  * Creates a new clan with the current user as the leader
  *
  * @param Container
  * @return Response
  * @note
  * Player must be high enough level to create a clan
  *
  * @see CLAN_CREATOR_MIN_LEVEL
  */
 public function create(Container $p_dependencies)
 {
     $player = $p_dependencies['current_player'];
     if ($player->level >= self::CLAN_CREATOR_MIN_LEVEL) {
         $default_clan_name = 'Clan ' . $player->name();
         while (!Clan::isUniqueClanName($default_clan_name)) {
             $default_clan_name = $default_clan_name . rand(1, 999);
         }
         $clan = Clan::create($player, $default_clan_name);
         $parts = ['action_message' => 'Your clan was created with the default name: ' . $clan->getName() . '. Change it below.', 'title' => 'Clan ' . $clan->getName(), 'clan' => $clan, 'pageParts' => ['edit']];
     } else {
         $parts = ['error' => 'You do not have enough renown to create a clan. You must be at least level ' . self::CLAN_CREATOR_MIN_LEVEL . '.', 'title' => 'You cannot create a clan yet', 'clans' => Clan::rankings(), 'pageParts' => ['list']];
     }
     return $this->render($parts);
 }