public function testPartialHealWithZeroGoldGivesErrorInPageParts() { $request = new Request(['heal_points' => 999], []); RequestWrapper::inject($request); $this->char->harm((int) floor($this->char->health / 2)); // Have to be wounded first. $this->char->setGold(0); $initial_health = $this->char->health; $this->assertGreaterThan(0, $initial_health); $this->char->save(); $this->char->setClass('viper'); // Default dragon class has chi skill $cont = new ShrineController(); $response = $cont->heal($this->m_dependencies); $final_char = Player::find($this->char->id()); $reflection = new \ReflectionProperty(get_class($response), 'data'); $reflection->setAccessible(true); $response_data = $reflection->getValue($response); $this->assertNotEmpty($response_data['error']); $this->assertEquals($initial_health, $final_char->health); }
public function testPartialHealWithZeroGoldGivesErrorInPageParts() { $request = new Request(['heal_points' => 999], []); RequestWrapper::inject($request); $this->char->harm(30); // Have to be wounded first. $this->char->set_gold(0); $initial_health = $this->char->health(); $this->char->save(); $this->char->setClass('viper'); // Default dragon class has chi skill $cont = new ShrineController(); $result = $cont->heal(); $final_char = Player::find($this->char->id()); $this->assertNotEmpty($result['parts']['error']); $this->assertEquals($initial_health, $final_char->health()); }