3434use PHPUnit \Framework \TestCase ;
3535use Prophecy \PhpUnit \ProphecyTrait ;
3636use Prophecy \Prophecy \ObjectProphecy ;
37- use stdClass ;
3837
3938#[UsesClass(GithubActionOutput::class)]
4039#[CoversClass(DevToolsCommandProvider::class)]
@@ -48,13 +47,16 @@ final class DevToolsCommandProviderTest extends TestCase
4847
4948 private ObjectProphecy $ plugin ;
5049
50+ /**
51+ * @var ObjectProphecy<DevTools>
52+ */
53+ private ObjectProphecy $ devTools ;
54+
5155 /**
5256 * @var array<string, FixtureWithoutAsCommand>
5357 */
5458 private array $ applicationCommands = [];
5559
56- private stdClass $ applicationState ;
57-
5860 private DevToolsCommandProvider $ commandProvider ;
5961
6062 /**
@@ -63,9 +65,8 @@ final class DevToolsCommandProviderTest extends TestCase
6365 protected function setUp (): void
6466 {
6567 ContainerFactory::reset ();
66- $ this ->applicationState = new stdClass ();
67- $ this ->applicationState ->commands = &$ this ->applicationCommands ;
6868 $ this ->plugin = $ this ->prophesize (DevToolsPluginInterface::class);
69+ $ this ->devTools = $ this ->prophesize (DevTools::class);
6970
7071 $ this ->plugin ->isRegisteredCommand (null )
7172 ->willReturn (false );
@@ -92,22 +93,10 @@ protected function setUp(): void
9293 'plugin ' => $ this ->plugin ->reveal (),
9394 ]);
9495
95- ContainerFactory::set (DevTools::class, new readonly class ($ this ->applicationState ) {
96- /**
97- * @param stdClass $state
98- */
99- public function __construct (
100- private stdClass $ state ,
101- ) {}
102-
103- /**
104- * @return array<string, FixtureWithoutAsCommand>
105- */
106- public function all (): array
107- {
108- return $ this ->state ->commands ;
109- }
110- });
96+ $ testCase = $ this ;
97+ $ this ->devTools ->all ()
98+ ->will (static fn (): array => $ testCase ->applicationCommands );
99+ ContainerFactory::set (DevTools::class, $ this ->devTools ->reveal ());
111100 }
112101
113102 /**
0 commit comments