1 changed files with 0 additions and 88 deletions
@ -1,88 +0,0 @@
|
||||
<?php |
||||
|
||||
namespace Drupal\Tests\islandora\Kernel; |
||||
|
||||
use Drupal\Core\Config\ConfigFactoryInterface; |
||||
use Drupal\Core\Config\ImmutableConfig; |
||||
use Drupal\islandora\GeminiClientFactory; |
||||
use Islandora\Crayfish\Commons\Client\GeminiClient; |
||||
use Prophecy\Argument; |
||||
use Psr\Log\LoggerInterface; |
||||
use Symfony\Component\HttpKernel\Exception\PreconditionFailedHttpException; |
||||
|
||||
/** |
||||
* Tests GeminiClientFactory. |
||||
* |
||||
* @package Drupal\Tests\islandora\Kernel |
||||
* @group islandora |
||||
* @coversDefaultClass \Drupal\islandora\GeminiClientFactory |
||||
*/ |
||||
class GeminiClientFactoryTest extends IslandoraKernelTestBase { |
||||
|
||||
/** |
||||
* Logger. |
||||
* |
||||
* @var \Psr\Log\LoggerInterface |
||||
*/ |
||||
private $logger; |
||||
|
||||
/** |
||||
* {@inheritdoc} |
||||
*/ |
||||
public function setUp() { |
||||
parent::setUp(); |
||||
|
||||
$prophecy = $this->prophesize(LoggerInterface::class); |
||||
$prophecy->notice(Argument::any()); |
||||
$this->logger = $prophecy->reveal(); |
||||
} |
||||
|
||||
/** |
||||
* @covers ::create |
||||
*/ |
||||
public function testNoUrlBlank() { |
||||
$this->expectException(PreconditionFailedHttpException::class); |
||||
$prophecy = $this->prophesize(ImmutableConfig::class); |
||||
$prophecy->get(Argument::any())->willReturn(''); |
||||
$immutConfig = $prophecy->reveal(); |
||||
|
||||
$prophecy = $this->prophesize(ConfigFactoryInterface::class); |
||||
$prophecy->get(Argument::any())->willReturn($immutConfig); |
||||
$configFactory = $prophecy->reveal(); |
||||
|
||||
GeminiClientFactory::create($configFactory, $this->logger); |
||||
} |
||||
|
||||
/** |
||||
* @covers ::create |
||||
*/ |
||||
public function testNoUrlNull() { |
||||
$this->expectException(PreconditionFailedHttpException::class); |
||||
$prophecy = $this->prophesize(ImmutableConfig::class); |
||||
$prophecy->get(Argument::any())->willReturn(NULL); |
||||
$immutConfig = $prophecy->reveal(); |
||||
|
||||
$prophecy = $this->prophesize(ConfigFactoryInterface::class); |
||||
$prophecy->get(Argument::any())->willReturn($immutConfig); |
||||
$configFactory = $prophecy->reveal(); |
||||
|
||||
GeminiClientFactory::create($configFactory, $this->logger); |
||||
} |
||||
|
||||
/** |
||||
* @covers ::create |
||||
* @throws \Exception |
||||
*/ |
||||
public function testUrl() { |
||||
$prophecy = $this->prophesize(ImmutableConfig::class); |
||||
$prophecy->get(Argument::any())->willReturn('http://localhost:8000/gemini'); |
||||
$immutConfig = $prophecy->reveal(); |
||||
|
||||
$prophecy = $this->prophesize(ConfigFactoryInterface::class); |
||||
$prophecy->get(Argument::any())->willReturn($immutConfig); |
||||
$configFactory = $prophecy->reveal(); |
||||
|
||||
$this->assertInstanceOf(GeminiClient::class, GeminiClientFactory::create($configFactory, $this->logger)); |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue