AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
LowLevelsMinPlayersOverrideTest Class Reference
Inheritance diagram for LowLevelsMinPlayersOverrideTest:

Protected Member Functions

void SetUp () override
 
void TearDown () override
 
void SetIntConfig (ServerConfigs index, uint32 value)
 

Static Protected Member Functions

static PvPDifficultyEntry MakeBracket (uint32 minLevel, uint32 maxLevel)
 
static void SetupTemplate (Battleground &bg, BattlegroundTypeId bgTypeId)
 
static void SetupRealBg (Battleground &bg, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const &bracket)
 

Protected Attributes

::testing::NiceMock< WorldMock > * worldMock_ = nullptr
 
std::unique_ptr< IWorldpreviousWorld_
 

Static Protected Attributes

static constexpr uint32 TemplateMinPlayers = 5
 

Detailed Description

Tests the resolution order of the low-levels MinPlayersPerTeam override: per-BG config key > global config key > battleground_template value, and the guards that keep it away from arenas, templates (member function) and max-level brackets.

Member Function Documentation

◆ MakeBracket()

static PvPDifficultyEntry LowLevelsMinPlayersOverrideTest::MakeBracket ( uint32  minLevel,
uint32  maxLevel 
)
inlinestaticprotected
64 {
65 return PvPDifficultyEntry(/*mapId*/ 0, /*bracketId*/ 0, minLevel, maxLevel, /*difficulty*/ 0);
66 }
Definition DBCStructure.h:1431

◆ SetIntConfig()

void LowLevelsMinPlayersOverrideTest::SetIntConfig ( ServerConfigs  index,
uint32  value 
)
inlineprotected
58 {
59 ON_CALL(*worldMock_, getIntConfig(index))
60 .WillByDefault(::testing::Return(value));
61 }
::testing::NiceMock< WorldMock > * worldMock_
Definition LowLevelsMinPlayersOverrideTest.cpp:82

References worldMock_.

◆ SetUp()

void LowLevelsMinPlayersOverrideTest::SetUp ( )
inlineoverrideprotected
38 {
39 // Battleground's destructor fires OnBattlegroundDestroy; the hook
40 // registry must be sized before any hook is invoked.
42
43 previousWorld_ = std::move(sWorld);
44 worldMock_ = new ::testing::NiceMock<WorldMock>();
45 ON_CALL(*worldMock_, getIntConfig(::testing::_))
46 .WillByDefault(::testing::Return(0));
47 ON_CALL(*worldMock_, getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
48 .WillByDefault(::testing::Return(80));
49 sWorld.reset(worldMock_);
50 }
@ ALLBATTLEGROUNDHOOK_END
Definition AllBattlegroundScript.h:47
@ CONFIG_MAX_PLAYER_LEVEL
Definition WorldConfig.h:195
std::unique_ptr< IWorld > previousWorld_
Definition LowLevelsMinPlayersOverrideTest.cpp:83
static void InitEnabledHooksIfNeeded(uint16 totalAvailableHooks)
Definition ScriptMgr.h:767
#define sWorld
Definition World.h:318

References ALLBATTLEGROUNDHOOK_END, CONFIG_MAX_PLAYER_LEVEL, ScriptRegistry< TScript >::InitEnabledHooksIfNeeded(), previousWorld_, sWorld, and worldMock_.

◆ SetupRealBg()

static void LowLevelsMinPlayersOverrideTest::SetupRealBg ( Battleground bg,
BattlegroundTypeId  bgTypeId,
PvPDifficultyEntry const &  bracket 
)
inlinestaticprotected
77 {
78 SetupTemplate(bg, bgTypeId);
79 bg.SetBracket(&bracket);
80 }
void SetBracket(PvPDifficultyEntry const *bracketEntry)
Definition Battleground.cpp:1873
static void SetupTemplate(Battleground &bg, BattlegroundTypeId bgTypeId)
Definition LowLevelsMinPlayersOverrideTest.cpp:69

References Battleground::SetBracket(), and SetupTemplate().

◆ SetupTemplate()

static void LowLevelsMinPlayersOverrideTest::SetupTemplate ( Battleground bg,
BattlegroundTypeId  bgTypeId 
)
inlinestaticprotected
70 {
71 bg.SetBgTypeID(bgTypeId);
73 }
void SetBgTypeID(BattlegroundTypeId TypeID)
Definition Battleground.h:365
void SetMinPlayersPerTeam(uint32 MinPlayers)
Definition Battleground.h:389
static constexpr uint32 TemplateMinPlayers
Definition LowLevelsMinPlayersOverrideTest.cpp:35

References Battleground::SetBgTypeID(), Battleground::SetMinPlayersPerTeam(), and TemplateMinPlayers.

Referenced by SetupRealBg().

◆ TearDown()

void LowLevelsMinPlayersOverrideTest::TearDown ( )
inlineoverrideprotected
53 {
54 sWorld = std::move(previousWorld_);
55 }

References previousWorld_, and sWorld.

Member Data Documentation

◆ previousWorld_

std::unique_ptr<IWorld> LowLevelsMinPlayersOverrideTest::previousWorld_
protected

Referenced by SetUp(), and TearDown().

◆ TemplateMinPlayers

constexpr uint32 LowLevelsMinPlayersOverrideTest::TemplateMinPlayers = 5
staticconstexprprotected

Referenced by SetupTemplate().

◆ worldMock_

::testing::NiceMock<WorldMock>* LowLevelsMinPlayersOverrideTest::worldMock_ = nullptr
protected

Referenced by SetIntConfig(), and SetUp().


The documentation for this class was generated from the following file: