true, '--database' => 'sqlite']); $output = new NullOutput; $seeder = m::mock(Seeder::class); $seeder->shouldReceive('setContainer')->once()->andReturnSelf(); $seeder->shouldReceive('setCommand')->once()->andReturnSelf(); $seeder->shouldReceive('__invoke')->once(); $resolver = m::mock(ConnectionResolverInterface::class); $resolver->shouldReceive('getDefaultConnection')->once(); $resolver->shouldReceive('setDefaultConnection')->once()->with('sqlite'); $container = m::mock(Container::class); $container->shouldReceive('call'); $container->shouldReceive('environment')->once()->andReturn('testing'); $container->shouldReceive('make')->with('DatabaseSeeder')->andReturn($seeder); $container->shouldReceive('make')->with(OutputStyle::class, m::any())->andReturn( new OutputStyle($input, $output) ); $command = new SeedCommand($resolver); $command->setLaravel($container); // call run to set up IO, then fire manually. $command->run($input, $output); $command->handle(); $container->shouldHaveReceived('call')->with([$command, 'handle']); } protected function tearDown(): void { m::close(); } }