This repository has been archived by the owner on Nov 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#107 - Improved GridBuilder test to work without requiring the contai…
…ner, debrecated old TestCore.
- Loading branch information
Showing
3 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace Tests\eXpansion\Framework\Core; | ||
|
||
use eXpansion\Framework\GameManiaplanet\DataProviders\ChatDataProvider; | ||
use eXpansion\Framework\GameManiaplanet\DataProviders\Listener\ListenerInterfaceMpLegacyChat; | ||
use eXpansion\Framework\Core\Helpers\ChatOutput; | ||
use eXpansion\Framework\Core\Services\Console; | ||
use eXpansion\Framework\Core\Storage\Data\Player; | ||
use eXpansion\Framework\Core\Storage\PlayerStorage; | ||
use Maniaplanet\DedicatedServer\Xmlrpc\FaultException; | ||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
class SimpleTestCore extends KernelTestCase | ||
{ | ||
/** @var ContainerInterface */ | ||
protected $container; | ||
|
||
/** @var Application */ | ||
protected $consoleApplication; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
// Loading this to force composer autoload to load all possible eXceptions. | ||
new FaultException('test'); | ||
|
||
//start the symfony kernel | ||
$kernel = static::createKernel(); | ||
$kernel->boot(); | ||
|
||
$this->container = $kernel->getContainer(); | ||
|
||
$this->consoleApplication = new Application($kernel); | ||
} | ||
|
||
protected function getMockPlayerStorage($player) | ||
{ | ||
$playerStorage = $this->getMockBuilder(PlayerStorage::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$playerStorage->method('getPlayerInfo') | ||
->willReturn($player); | ||
|
||
return $playerStorage; | ||
} | ||
|
||
/** | ||
* @return ChatOutput|object | ||
*/ | ||
protected function getChatOutputHelper() | ||
{ | ||
return $this->container->get(ChatOutput::class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters