You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm setting up a mock under the above PHP version, using PHPUnit 6.5.21, and have run into problems simply trying to get an empty test to run. I haven't hooked up any specific framework, beyond the bits that http-mock itself pulls in.
Here's the guts of my base test class:
<?php
namespace Tests;
use PHPUnit\Framework\TestCase as BaseTestCase;
use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
abstract class TestCase extends BaseTestCase
use HttpMockTrait;
public static function setUpBeforeClass()
{
static::setUpHttpMockBeforeClass(null, 'localhost');
}
public static function tearDownAfterClass()
{
static::tearDownHttpMockAfterClass();
}
public function setUp()
{
$this->setUpHttpMock();
parent::setUp();
$this->http->mock
->when()
->methodIs('POST')
->then()
->body('')
->end();
$this->http->setUp();
}
public function tearDown()
{
$this->tearDownHttpMock();
parent::tearDown();
}
}
And the test in question
class baseTest extends TestCase {
public function testSimpleRequest()
{
$request = $this->http->requests->latest();
}
}
Test result:
1) ...\Tests\baseTest::testSimpleRequest
UnexpectedValueException: Expected status code 200 from "/_request/last", got 404
.../vendor/internations/http-mock/src/RequestCollectionFacade.php:158
.../vendor/internations/http-mock/src/RequestCollectionFacade.php:141
.../vendor/internations/http-mock/src/RequestCollectionFacade.php:27
.../tests/baseTest.php:18
I'm not sure what else I can trim out. Have I managed to do something dumb like leave out a "start the mock server" step? From a quick read through the getting started guide, it doesn't seem like that.
The text was updated successfully, but these errors were encountered:
I'm setting up a mock under the above PHP version, using PHPUnit 6.5.21, and have run into problems simply trying to get an empty test to run. I haven't hooked up any specific framework, beyond the bits that http-mock itself pulls in.
Here's the guts of my base test class:
And the test in question
Test result:
I'm not sure what else I can trim out. Have I managed to do something dumb like leave out a "start the mock server" step? From a quick read through the getting started guide, it doesn't seem like that.
The text was updated successfully, but these errors were encountered: