Skip to content

Commit

Permalink
Aligned unit tests to PHPUnit 8
Browse files Browse the repository at this point in the history
  • Loading branch information
webhdx committed Jun 10, 2019
1 parent 26ee97a commit 1316ba9
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use EzSystems\EzPlatformSolrSearchEngineBundle\DependencyInjection\EzSystemsEzPlatformSolrSearchEngineExtension;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;

class EzPublishEzPlatformSolrSearchEngineExtensionTest extends AbstractExtensionTestCase
{
Expand All @@ -20,19 +21,19 @@ class EzPublishEzPlatformSolrSearchEngineExtensionTest extends AbstractExtension
*/
private $extension;

protected function setUp()
protected function setUp(): void
{
$this->extension = new EzSystemsEzPlatformSolrSearchEngineExtension();

parent::setUp();
}

protected function getContainerExtensions()
protected function getContainerExtensions(): array
{
return array($this->extension);
}

protected function getMinimalConfiguration()
protected function getMinimalConfiguration(): array
{
return [];
}
Expand Down Expand Up @@ -149,11 +150,10 @@ public function testEndpoint($endpointName, $endpointValues, $expectedArgument)
);
}

/**
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
*/
public function testEndpointCoreRequired()
{
$this->expectException(InvalidConfigurationException::class);

$this->load(
array(
'endpoints' => array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class AggregateCriterionVisitorPassTest extends AbstractCompilerPassTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setDefinition(
Expand All @@ -33,7 +33,7 @@ protected function setUp()
*
* $container->addCompilerPass(new MyCompilerPass());
*/
protected function registerCompilerPass(ContainerBuilder $container)
protected function registerCompilerPass(ContainerBuilder $container): void
{
$container->addCompilerPass(new AggregateCriterionVisitorPass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class AggregateFacetBuilderVisitorPassTest extends AbstractCompilerPassTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setDefinition(
Expand All @@ -37,7 +37,7 @@ protected function setUp()
*
* $container->addCompilerPass(new MyCompilerPass());
*/
protected function registerCompilerPass(ContainerBuilder $container)
protected function registerCompilerPass(ContainerBuilder $container): void
{
$container->addCompilerPass(new AggregateFacetBuilderVisitorPass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class AggregateSortClauseVisitorPassTest extends AbstractCompilerPassTestCase
{
protected function setUp()
protected function setUp(): void
{
parent::setUp();
$this->setDefinition(
Expand All @@ -33,7 +33,7 @@ protected function setUp()
*
* $container->addCompilerPass(new MyCompilerPass());
*/
protected function registerCompilerPass(ContainerBuilder $container)
protected function registerCompilerPass(ContainerBuilder $container): void
{
$container->addCompilerPass(new AggregateSortClauseVisitorPass());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ public function testGetEntryEndpoint()
);
}

/**
* @expectedException \RuntimeException
*/
public function testGetEntryEndpointThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
$entryEndpoints = array();

$endpointResolver = $this->getEndpointResolver($entryEndpoints);
Expand Down Expand Up @@ -920,7 +918,6 @@ public function providerForTestGetSearchTargetsThrowsRuntimeException()

/**
* @dataProvider providerForTestGetSearchTargetsThrowsRuntimeException
* @expectedException \RuntimeException
*
* @param string[] $endpointMap
* @param null|string $defaultEndpoint
Expand All @@ -935,6 +932,8 @@ public function testGetSearchTargetsThrowsRuntimeException(
$languageSettings,
$message
) {
$this->expectException(RuntimeException::class);

$endpointResolver = $this->getEndpointResolver(
array(),
$endpointMap,
Expand Down Expand Up @@ -1041,11 +1040,9 @@ public function testGetEndpoints(
$this->assertEquals($expected, $endpoints);
}

/**
* @expectedException \RuntimeException
*/
public function testGetEndpointsThrowsRuntimeException()
{
$this->expectException(RuntimeException::class);
$endpointResolver = $this->getEndpointResolver(
array(),
array(),
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/Search/Gateway/EndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
*/
namespace EzSystems\EzPlatformSolrSearchEngine\Tests\Search\Gateway;

use eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException;
use EzSystems\EzPlatformSolrSearchEngine\Gateway\Endpoint;
use EzSystems\EzPlatformSolrSearchEngine\Tests\Search\TestCase;

Expand Down Expand Up @@ -91,11 +92,10 @@ public function testEndpointDsnParsingOverridesAllIfSet()
$this->assertEquals($expected, $actual);
}

/**
* @expectedException \eZ\Publish\API\Repository\Exceptions\PropertyNotFoundException
*/
public function testEndpointDsnParsingWithQuery()
{
$this->expectException(PropertyNotFoundException::class);

$actual = new Endpoint(['dsn' => 'https://10.10.10.10:5434/jolr?query']);
}
}
4 changes: 2 additions & 2 deletions tests/lib/Slot/RemoveTranslationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ class RemoveTranslationTest extends TestCase
/**
* Check if required signal exists due to BC.
*/
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
if (!class_exists(RemoveTranslationSignal::class)) {
self::markTestSkipped('RemoveTranslationSignal does not exist');
}
}

public function setUp()
public function setUp(): void
{
parent::setUp();

Expand Down

0 comments on commit 1316ba9

Please sign in to comment.