diff --git a/tests/Benchmark/AppRequirementFactoryBench.php b/tests/Benchmark/AppRequirementFactoryBench.php index 1d070f2b8..45499a1ae 100644 --- a/tests/Benchmark/AppRequirementFactoryBench.php +++ b/tests/Benchmark/AppRequirementFactoryBench.php @@ -28,9 +28,27 @@ { private const FIXTURES = __DIR__.'/../../fixtures/bench/requirement-checker'; + private ComposerJson $composerJson; + private ComposerLock $composerLock; + public function setUp(): void { self::assertVendorsAreInstalled(); + + $this->composerJson = new ComposerJson( + '', + json_decode( + file_get_contents(self::FIXTURES.'/composer.json'), + true, + ), + ); + $this->composerLock = new ComposerLock( + '', + json_decode( + file_get_contents(self::FIXTURES.'/composer.lock'), + true, + ), + ); } #[Iterations(1000)] @@ -38,20 +56,8 @@ public function setUp(): void public function bench(): void { AppRequirementsFactory::create( - new ComposerJson( - '', - json_decode( - file_get_contents(self::FIXTURES.'/composer.json'), - true, - ), - ), - new ComposerLock( - '', - json_decode( - file_get_contents(self::FIXTURES.'/composer.lock'), - true, - ), - ), + $this->composerJson, + $this->composerLock, CompressionAlgorithm::BZ2, ); }