Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpunit update #59

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ composer.lock
state/*-*
build/*
phpunit.xml
.phpunit.result.cache
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
],
"require": {
"php": "~7.1",
"php": "^7.3",
"silex/silex": "~2.0",
"guzzle/guzzle": ">=3.8",
"symfony/process": "~3|~4|~5",
Expand All @@ -23,7 +23,7 @@
"require-dev": {
"internations/kodierungsregelwerksammlung": "~0.23.0",
"internations/testing-component": "1.0.1",
"phpunit/phpunit": "^7"
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {"InterNations\\Component\\HttpMock\\": "src/"}
Expand Down
11 changes: 8 additions & 3 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.4/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
convertErrorsToExceptions="true"
convertWarningsToExceptions="true"
Expand All @@ -10,15 +10,20 @@
colors="true"
timeoutForLargeTests="100">

<coverage>
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>

<testsuites>
<testsuite name="internations/http-mock">
<directory>./tests/</directory>
</testsuite>
</testsuites>

<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="junit" target="build/logs/junit.xml" />
<junit outputFile="build/logs/junit.xml"/>
</logging>

<php>
Expand Down
6 changes: 3 additions & 3 deletions tests/AppIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ class AppIntegrationTest extends AbstractTestCase
*/
private $client;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
static::$server1 = new Server(HTTP_MOCK_PORT, HTTP_MOCK_HOST);
static::$server1->start();
}

public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
static::assertSame('', (string) static::$server1->getOutput(), (string) static::$server1->getOutput());
static::assertSame('', (string) static::$server1->getErrorOutput(), (string) static::$server1->getErrorOutput());
static::$server1->stop();
}

public function setUp()
public function setUp(): void
{
static::$server1->clean();
$this->client = static::$server1->getClient();
Expand Down
2 changes: 1 addition & 1 deletion tests/Matcher/ExtractorFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ExtractorFactoryTest extends AbstractTestCase
/** @var Request|MockObject */
private $request;

public function setUp()
public function setUp(): void
{
$this->extractorFactory = new ExtractorFactory();
$this->request = $this->createMock('Symfony\Component\HttpFoundation\Request');
Expand Down
6 changes: 3 additions & 3 deletions tests/MockBuilderIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class MockBuilderIntegrationTest extends TestCase
/** @var Server */
private $server;

public function setUp()
public function setUp(): void
{
$this->matches = new MatcherFactory();
$this->builder = new MockBuilder($this->matches, new ExtractorFactory());
Expand All @@ -36,7 +36,7 @@ public function setUp()
$this->server->clean();
}

public function tearDown()
public function tearDown(): void
{
$this->server->stop();
}
Expand Down Expand Up @@ -93,7 +93,7 @@ public function testCreateExpectation()

$this->assertSame('response body', (string) $client->post('/foo')->send()->getBody());

$this->assertContains('CLOSURE MATCHER: POST /foo', $this->server->getErrorOutput());
$this->assertTrue(strpos($this->server->getErrorOutput(), 'CLOSURE MATCHER: POST /foo') !== false);
}

public function testCreateTwoExpectationsAfterEachOther()
Expand Down
10 changes: 5 additions & 5 deletions tests/PHPUnit/HttpMockMultiPHPUnitIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ class HttpMockMultiPHPUnitIntegrationTest extends AbstractTestCase
{
use HttpMockTrait;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
static::setUpHttpMockBeforeClass(null, null, null, 'firstNamedServer');
static::setUpHttpMockBeforeClass(static::getHttpMockDefaultPort() + 1, null, null, 'secondNamedServer');
}

public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
static::tearDownHttpMockAfterClass();
}

public function setUp()
public function setUp(): void
{
$this->setUpHttpMock();
}

public function tearDown()
public function tearDown(): void
{
$this->tearDownHttpMock();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testErrorLogOutput()
$this->tearDown();
$this->fail('Exception expected');
} catch (\Exception $e) {
$this->assertContains('HTTP mock server standard error output should be empty', $e->getMessage());
$this->assertTrue(strpos($e->getMessage(), 'HTTP mock server standard error output should be empty') !== false);
}
}

Expand Down
8 changes: 4 additions & 4 deletions tests/PHPUnit/HttpMockPHPUnitIntegrationBasePathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ class HttpMockPHPUnitIntegrationBasePathTest extends AbstractTestCase
{
use HttpMockTrait;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
static::setUpHttpMockBeforeClass(null, null, '/custom-base-path');
}

public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
static::tearDownHttpMockAfterClass();
}

public function setUp()
public function setUp(): void
{
$this->setUpHttpMock();
}

public function tearDown()
public function tearDown(): void
{
$this->tearDownHttpMock();
}
Expand Down
10 changes: 5 additions & 5 deletions tests/PHPUnit/HttpMockPHPUnitIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ class HttpMockPHPUnitIntegrationTest extends AbstractTestCase
{
use HttpMockTrait;

public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
static::setUpHttpMockBeforeClass();
}

public static function tearDownAfterClass()
public static function tearDownAfterClass(): void
{
static::tearDownHttpMockAfterClass();
}

public function setUp()
public function setUp(): void
{
$this->setUpHttpMock();
}

public function tearDown()
public function tearDown(): void
{
$this->tearDownHttpMock();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testErrorLogOutput()
$this->tearDown();
$this->fail('Exception expected');
} catch (\Exception $e) {
$this->assertContains('HTTP mock server standard error output should be empty', $e->getMessage());
$this->assertTrue(strpos($e->getMessage(), 'HTTP mock server standard error output should be empty') !== false);
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Request/UnifiedRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class UnifiedRequestTest extends AbstractTestCase
/** @var UnifiedRequest */
private $unifiedEnclosingEntityRequest;

public function setUp()
public function setUp(): void
{
$this->wrappedRequest = $this->createMock('Guzzle\Http\Message\RequestInterface');
$this->wrappedEntityEnclosingRequest = $this->createMock('Guzzle\Http\Message\EntityEnclosingRequestInterface');
Expand Down
2 changes: 1 addition & 1 deletion tests/RequestCollectionFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RequestCollectionFacadeTest extends AbstractTestCase
/** @var RequestCollectionFacade */
private $facade;

public function setUp()
public function setUp(): void
{
$this->client = $this->createMock('Guzzle\Http\ClientInterface');
$this->facade = new RequestCollectionFacade($this->client);
Expand Down