Skip to content

Commit

Permalink
Merge branch '4.0-dev' into j4/mvcfactory/service
Browse files Browse the repository at this point in the history
  • Loading branch information
laoneo committed Mar 8, 2018
2 parents b8fdcfe + 39d07d6 commit 23e7064
Showing 1 changed file with 4 additions and 38 deletions.
42 changes: 4 additions & 38 deletions tests/unit/suites/libraries/cms/error/JErrorPageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,8 @@ public function testEnsureTheErrorPageIsCorrectlyRendered()
->method('render')
->willReturn($documentResponse);

$mockFactory = new class($mockErrorDocument) implements \Joomla\CMS\Document\FactoryInterface
{
private $mockErrorDoc;

public function __construct($mockErrorDoc)
{
$this->mockErrorDoc = $mockErrorDoc;
}

public function createDocument(string $type = 'html', array $attributes = []): \Joomla\CMS\Document\Document
{
return $this->mockErrorDoc;
}

public function createRenderer(\Joomla\CMS\Document\Document $document, string $type): \Joomla\CMS\Document\RendererInterface
{
throw new BadMethodCallException;
}
};
$mockFactory = $this->getMockBuilder(\Joomla\CMS\Document\FactoryInterface::class)->getMock();
$mockFactory->method('createDocument')->willReturn($mockErrorDocument);

// Set our mock document into the container
$container = new \Joomla\DI\Container;
Expand Down Expand Up @@ -129,25 +112,8 @@ public function testEnsureTheErrorPageIsCorrectlyRenderedWithThrowables()
->method('render')
->willReturn($documentResponse);

$mockFactory = new class($mockErrorDocument) implements \Joomla\CMS\Document\FactoryInterface
{
private $mockErrorDoc;

public function __construct($mockErrorDoc)
{
$this->mockErrorDoc = $mockErrorDoc;
}

public function createDocument(string $type = 'html', array $attributes = []): \Joomla\CMS\Document\Document
{
return $this->mockErrorDoc;
}

public function createRenderer(\Joomla\CMS\Document\Document $document, string $type): \Joomla\CMS\Document\RendererInterface
{
throw new BadMethodCallException;
}
};
$mockFactory = $this->getMockBuilder(\Joomla\CMS\Document\FactoryInterface::class)->getMock();
$mockFactory->method('createDocument')->willReturn($mockErrorDocument);

// Set our mock document into the container
$container = new \Joomla\DI\Container;
Expand Down

0 comments on commit 23e7064

Please sign in to comment.