-
-
Notifications
You must be signed in to change notification settings - Fork 735
Closed
Labels
Description
Bug Report
| Subject | Details |
|---|---|
| Rector version | v2.0.14 |
Similar to #9135. I'm using zenstruck/browser with HasBrowser.
Minimal PHP Code Causing Issue
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Zenstruck\Browser\Test\HasBrowser;
abstract class FunctionalTestCase extends WebTestCase
{
use HasBrowser;
}namespace App\Tests\Functional\Controller\Api;
use App\Tests\DataProvider\ApiVersionProvider;
use App\Tests\Functional\FunctionalTestCase;
use App\Tests\Story\ApiUserStory;
use PHPUnit\Framework\Attributes\DataProviderExternal;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\Attributes\TestDox;
use function Safe\json_decode;
#[Group('api')]
final class StaticPagesControllerTest extends FunctionalTestCase
{
#[DataProviderExternal(ApiVersionProvider::class, 'all')]
#[TestDox('/api/$version/page/contact returns 200')]
#[Test]
public function pageContact(string $version): void
{
$json = $this->browser()
->actingAs(ApiUserStory::get(ApiUserStory::USER_ARBITRARY), firewall: 'api')
->visit(sprintf('/api/%s/page/contact', $version))
->assertSuccessful()
->assertHeaderEquals('Cache-Control', 'no-cache, public, s-maxage=60, stale-if-error=86400, stale-while-revalidate=86400')
->assertJson()
->content()
;
self::assertStringEqualsFile(__DIR__ . '/../../Fixtures/expected_page_contact.html', json_decode($json)->html);
}
}It diffs like this:
use App\Tests\DataProvider\ApiVersionProvider;
use App\Tests\Functional\FunctionalTestCase;
-use App\Tests\Story\ApiUserStory;
use PHPUnit\Framework\Attributes\DataProviderExternal;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\Test;
@@ @@
#[Test]
public function pageContact(string $version): void
{
- $json = $this->browser()
- ->actingAs(ApiUserStory::get(ApiUserStory::USER_ARBITRARY), firewall: 'api')
- ->visit(sprintf('/api/%s/page/contact', $version))
- ->assertSuccessful()
- ->assertHeaderEquals('Cache-Control', 'no-cache, public, s-maxage=60, stale-if-error=86400, stale-while-revalidate=86400')
- ->assertJson()
+ $json = self::assertJson()
->content()
;
----------- end diff -----------Expected Behaviour
I don't expect changes on non-PHPUnit methods.