AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
SpellProcTest Class Reference

Test fixture for SpellMgr proc tests. More...

Inheritance diagram for SpellProcTest:

Protected Member Functions

void SetUp () override
 
void TearDown () override
 
SpellInfoCreateSpellInfo (uint32 id=1, uint32 familyName=0, uint32 familyFlag0=0, uint32 familyFlag1=0, uint32 familyFlag2=0)
 

Protected Attributes

IWorld_originalWorld = nullptr
 
NiceMock< WorldMock > * _worldMock = nullptr
 
std::vector< SpellInfo * > _spellInfos
 

Detailed Description

Test fixture for SpellMgr proc tests.

Tests the CanSpellTriggerProcOnEvent function and related proc logic.

Member Function Documentation

◆ CreateSpellInfo()

SpellInfo * SpellProcTest::CreateSpellInfo ( uint32  id = 1,
uint32  familyName = 0,
uint32  familyFlag0 = 0,
uint32  familyFlag1 = 0,
uint32  familyFlag2 = 0 
)
inlineprotected
63 {
64 auto* spellInfo = SpellInfoBuilder()
65 .WithId(id)
66 .WithSpellFamilyName(familyName)
67 .WithSpellFamilyFlags(familyFlag0, familyFlag1, familyFlag2)
68 .Build();
69 _spellInfos.push_back(spellInfo);
70 return spellInfo;
71 }
Builder class for creating SpellInfo test instances.
Definition SpellInfoTestHelper.h:160
SpellInfoBuilder & WithId(uint32 id)
Definition SpellInfoTestHelper.h:164
SpellInfoBuilder & WithSpellFamilyFlags(uint32 flag0, uint32 flag1=0, uint32 flag2=0)
Definition SpellInfoTestHelper.h:176
SpellInfo * Build()
Definition SpellInfoTestHelper.h:250
SpellInfoBuilder & WithSpellFamilyName(uint32 familyName)
Definition SpellInfoTestHelper.h:170
std::vector< SpellInfo * > _spellInfos
Definition SpellProcTest.cpp:75

References _spellInfos, SpellInfoBuilder::Build(), SpellInfoBuilder::WithId(), SpellInfoBuilder::WithSpellFamilyFlags(), and SpellInfoBuilder::WithSpellFamilyName().

◆ SetUp()

void SpellProcTest::SetUp ( )
inlineoverrideprotected
36 {
37 _originalWorld = sWorld.release();
38 _worldMock = new NiceMock<WorldMock>();
39 sWorld.reset(_worldMock);
40
41 static std::string emptyString;
42 ON_CALL(*_worldMock, GetDataPath()).WillByDefault(ReturnRef(emptyString));
43 }
NiceMock< WorldMock > * _worldMock
Definition SpellProcTest.cpp:74
IWorld * _originalWorld
Definition SpellProcTest.cpp:73
#define sWorld
Definition World.h:316

References _originalWorld, _worldMock, and sWorld.

◆ TearDown()

void SpellProcTest::TearDown ( )
inlineoverrideprotected
46 {
47 IWorld* currentWorld = sWorld.release();
48 delete currentWorld;
49 _worldMock = nullptr;
50
52 _originalWorld = nullptr;
53
54 // Clean up any SpellInfo objects we created
55 for (auto* spellInfo : _spellInfos)
56 delete spellInfo;
57 _spellInfos.clear();
58 }
Definition IWorld.h:63

References _originalWorld, _spellInfos, _worldMock, and sWorld.

Member Data Documentation

◆ _originalWorld

IWorld* SpellProcTest::_originalWorld = nullptr
protected

Referenced by SetUp(), and TearDown().

◆ _spellInfos

std::vector<SpellInfo*> SpellProcTest::_spellInfos
protected

Referenced by CreateSpellInfo(), and TearDown().

◆ _worldMock

NiceMock<WorldMock>* SpellProcTest::_worldMock = nullptr
protected

Referenced by SetUp(), and TearDown().


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