<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\Event\Test;

use PHPUnit\Framework\TestCase;

/**
 * @covers \PHPUnit\Event\Test\AfterTest
 */
final class AfterTestTest extends TestCase
{
    public function testConstructorSetsValues(): void
    {
        $test = new Test();

        $result = $this->createMock(Result::class);

        $event = new AfterTest(
            $test,
            $result
        );

        $this->assertSame($test, $event->test());
        $this->assertSame($result, $event->result());
    }
}

<?php declare(strict_types=1);
/*
 * This file is part of PHPUnit.
 *
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace PHPUnit\Event\Test;

use PHPUnit\Framework\TestCase;

/**
 * @covers \PHPUnit\Event\Test\AfterTest
 */
final class AfterTestTest extends TestCase
{
    public function testConstructorSetsValues(): void
    {
        $test = new Test();

        $result = new class implements Result {
            public function is(Result $other): bool
            {
                return false;
            }

            public function asString(): string
            {
                return get_class($this);
            }
        };

        $event = new AfterTest(
            $test,
            $result
        );

        $this->assertSame($test, $event->test());
        $this->assertSame($result, $event->result());
    }
}

Use anonymous class as test double
Fix: Use anonymous class as test double

Co-authored-by: Andreas Möller <96e8155732e8324ae26f64d4516eb6fe696ac84f@localheinz.com>
Co-authored-by: Arne Blankerts <2d7739f42ebd62662a710577d3d9078342a69dee@Blankerts.de>
