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; }
function setUp() { $this->char_id = TestAccountCreateAndDestroy::char_id(true); $this->char_id_2 = TestAccountCreateAndDestroy::char_id_2(true); $this->messageData = ['message' => 'Random phpunit Test Message', 'send_from' => $this->char_id, 'send_to' => $this->char_id_2, 'unread' => 1, 'type' => 0]; $this->message_id = null; }
function setUp() { $this->char_id = TestAccountCreateAndDestroy::char_id($confirm = true); $this->char_id_2 = TestAccountCreateAndDestroy::char_id_2($confirm = true); $this->message = Message::create(['message' => 'Random phpunit Test Message', 'send_to' => $this->char_id, 'send_from' => $this->char_id_2, 'unread' => 1, 'type' => null]); $this->delete_this_message = null; }
public function setUp() { SessionFactory::init(new MockArraySessionStorage()); $char_id = TestAccountCreateAndDestroy::char_id(); $char = Player::find($char_id); $account = Account::findByChar($char); $account_id = $account->id(); SessionFactory::getSession()->set('authenticated', true); SessionFactory::getSession()->set('player_id', $char_id); SessionFactory::getSession()->set('account_id', $account_id); }
function setUp() { $clan_identity = 'randomNewTestClan'; $id_already_exists = query_item('select clan_id from clan where clan_name = :name', [':name' => $clan_identity]); if ($id_already_exists) { $this->deleteClan($id_already_exists); } $this->clan = ClanFactory::create($clan_identity, ['founder' => 'phpunittest', 'description' => 'Some clan description']); $this->clan_id = $this->clan->getId(); $this->char_id = TestAccountCreateAndDestroy::char_id(); $this->char_id_2 = TestAccountCreateAndDestroy::char_id_2(); }
/** * Just return a character wholesale */ public static function char() { return Player::find(TestAccountCreateAndDestroy::char_id()); }
public function testCloneKillKillingWipesHealthAndTurns() { $char_id = TestAccountCreateAndDestroy::char_id(); $charObj = Player::find($char_id); $char_id_2 = TestAccountCreateAndDestroy::char_id_2(); $charObj_2 = Player::find($char_id_2); // Will create characters with 127.0.0.1 ip, but that shouldn't be clone kill able. $this->assertFalse(CloneKill::canKill($char_id, $char_id_2)); $this->syncIps('555.66.77.88', $char_id, $char_id_2); $this->assertTrue(CloneKill::canKill($char_id, $char_id_2), 'Should be able to clone kill similar and same ip characters!'); CloneKill::kill($charObj, $charObj, $charObj_2); // Obliterate them. $pc1 = Player::find($char_id); $pc2 = Player::find($char_id_2); $this->assertEquals(0, $pc1->health); $this->assertEquals(0, $pc2->health); $this->assertEquals(0, $pc1->turns); $this->assertEquals(0, $pc2->turns); }