feat: upgrade phpunit to 12.5
This commit is contained in:
@@ -7,7 +7,9 @@ namespace App\Tests\BusProNet\XmlLoader;
|
||||
use App\BusProNet\Model\Pickup;
|
||||
use App\BusProNet\Model\Travel;
|
||||
use App\BusProNet\XmlLoader\PickupLoader;
|
||||
use League\Flysystem\FilesystemOperator;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Contracts\Cache\CacheInterface;
|
||||
|
||||
class PickupLoaderTest extends TestCase
|
||||
{
|
||||
@@ -15,17 +17,21 @@ class PickupLoaderTest extends TestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->loader = $this->createPartialMock(PickupLoader::class, ['loadById']);
|
||||
$this->loader->method('loadById')->willReturnCallback(function (int $id): Pickup {
|
||||
$pickup = new Pickup();
|
||||
$pickup->id = $id;
|
||||
$pickup->code = 'Z'.$id;
|
||||
$pickup->city = 'City '.$id;
|
||||
$pickup->postalCode = '0000'.$id;
|
||||
$pickup->street = 'Street '.$id;
|
||||
// patchPickupsDetails() is the unit under test; loadById() only has to hand back
|
||||
// a Pickup per id, so a subclass beats a partial mock over the XML/cache stack.
|
||||
$this->loader = new class($this->createStub(CacheInterface::class), $this->createStub(FilesystemOperator::class)) extends PickupLoader {
|
||||
public function loadById(int $id, ?string $filename = 'zustiege.xml'): ?Pickup
|
||||
{
|
||||
$pickup = new Pickup();
|
||||
$pickup->id = $id;
|
||||
$pickup->code = 'Z'.$id;
|
||||
$pickup->city = 'City '.$id;
|
||||
$pickup->postalCode = '0000'.$id;
|
||||
$pickup->street = 'Street '.$id;
|
||||
|
||||
return $pickup;
|
||||
});
|
||||
return $pickup;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public function testDropOffsAreOrderedInReverseOfSortedPickups(): void
|
||||
|
||||
Reference in New Issue
Block a user