Skip to content

Commit

Permalink
Merge branch '5.4' into 6.3
Browse files Browse the repository at this point in the history
* 5.4:
  [Tests] Streamline
  [Validator] updated Romanian translation
  • Loading branch information
nicolas-grekas committed Oct 31, 2023
2 parents ca4a988 + 0ed1f63 commit e270297
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions Tests/AbstractBrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ public function testGetRequest()

public function testGetRequestNull()
{
$client = $this->getBrowser();

$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getRequest()".');

$client = $this->getBrowser();
$this->assertNull($client->getRequest());
$client->getRequest();
}

public function testXmlHttpRequest()
Expand Down Expand Up @@ -96,20 +97,22 @@ public function testGetResponse()

public function testGetResponseNull()
{
$client = $this->getBrowser();

$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getResponse()".');

$client = $this->getBrowser();
$this->assertNull($client->getResponse());
$client->getResponse();
}

public function testGetInternalResponseNull()
{
$client = $this->getBrowser();

$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalResponse()".');

$client = $this->getBrowser();
$this->assertNull($client->getInternalResponse());
$client->getInternalResponse();
}

public function testGetContent()
Expand All @@ -132,11 +135,12 @@ public function testGetCrawler()

public function testGetCrawlerNull()
{
$client = $this->getBrowser();

$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getCrawler()".');

$client = $this->getBrowser();
$this->assertNull($client->getCrawler());
$client->getCrawler();
}

public function testRequestHttpHeaders()
Expand Down Expand Up @@ -380,7 +384,7 @@ public function testSubmitPreserveAuth()
$this->assertSame('bar', $server['PHP_AUTH_PW']);
}

public function testSubmitPassthrewHeaders()
public function testSubmitPassthroughHeaders()
{
$client = $this->getBrowser();
$client->setNextResponse(new Response('<html><form action="/foo"><input type="submit" /></form></html>'));
Expand Down Expand Up @@ -619,7 +623,7 @@ public function testFollowMetaRefresh(string $content, string $expectedEndingUrl
$this->assertSame($expectedEndingUrl, $client->getRequest()->getUri());
}

public static function getTestsForMetaRefresh()
public static function getTestsForMetaRefresh(): array
{
return [
['<html><head><meta http-equiv="Refresh" content="4" /><meta http-equiv="refresh" content="0; URL=http://www.example.com/redirected"/></head></html>', 'http://www.example.com/redirected'],
Expand Down Expand Up @@ -840,10 +844,11 @@ public function testInternalRequest()

public function testInternalRequestNull()
{
$client = $this->getBrowser();

$this->expectException(BadMethodCallException::class);
$this->expectExceptionMessage('The "request()" method must be called before "Symfony\\Component\\BrowserKit\\AbstractBrowser::getInternalRequest()".');

$client = $this->getBrowser();
$this->assertNull($client->getInternalRequest());
$client->getInternalRequest();
}
}

0 comments on commit e270297

Please sign in to comment.