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

Protected Member Functions

void SetUp () override
 
void TearDown () override
 

Static Protected Member Functions

static void EnsureScriptRegistriesInitialized ()
 

Protected Attributes

std::unique_ptr< IWorldpreviousWorld_
 

Detailed Description

Tests that ArenaScript and AllBattlegroundScript hooks return safe defaults when no scripts are registered, ensuring core game logic (MemberWon/MemberLost, SaveToDB, etc.) is not accidentally skipped.

Member Function Documentation

◆ EnsureScriptRegistriesInitialized()

static void ArenaHookDefaultsTest::EnsureScriptRegistriesInitialized ( )
inlinestaticprotected
36 {
37 static bool initialized = false;
38 if (!initialized)
39 {
42 initialized = true;
43 }
44 }
@ ALLBATTLEGROUNDHOOK_END
Definition AllBattlegroundScript.h:46
@ ARENAHOOK_END
Definition ArenaScript.h:34
static void InitEnabledHooksIfNeeded(uint16 totalAvailableHooks)
Definition ScriptMgr.h:759

References ALLBATTLEGROUNDHOOK_END, ARENAHOOK_END, and ScriptRegistry< TScript >::InitEnabledHooksIfNeeded().

Referenced by SetUp().

◆ SetUp()

void ArenaHookDefaultsTest::SetUp ( )
inlineoverrideprotected
47 {
48 previousWorld_ = std::move(sWorld);
49 auto* mock = new ::testing::NiceMock<WorldMock>();
50 ON_CALL(*mock, getIntConfig(::testing::_))
51 .WillByDefault(::testing::Return(0));
52 ON_CALL(*mock, getIntConfig(CONFIG_LEGACY_ARENA_START_RATING))
53 .WillByDefault(::testing::Return(1500));
54 ON_CALL(*mock, getIntConfig(CONFIG_ARENA_START_RATING))
55 .WillByDefault(::testing::Return(0));
56 sWorld.reset(mock);
57
59 }
@ CONFIG_ARENA_START_RATING
Definition WorldConfig.h:291
@ CONFIG_LEGACY_ARENA_START_RATING
Definition WorldConfig.h:292
std::unique_ptr< IWorld > previousWorld_
Definition ArenaHookDefaultsTest.cpp:66
static void EnsureScriptRegistriesInitialized()
Definition ArenaHookDefaultsTest.cpp:35
#define sWorld
Definition World.h:316

References CONFIG_ARENA_START_RATING, CONFIG_LEGACY_ARENA_START_RATING, EnsureScriptRegistriesInitialized(), previousWorld_, and sWorld.

◆ TearDown()

void ArenaHookDefaultsTest::TearDown ( )
inlineoverrideprotected
62 {
63 sWorld = std::move(previousWorld_);
64 }

References previousWorld_, and sWorld.

Member Data Documentation

◆ previousWorld_

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

Referenced by SetUp(), and TearDown().


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