resetServices example

/** * @dataProvider provideResetServices */
    public function testResetServices(bool $shouldReset)
    {
        $servicesResetter = $this->createMock(ServicesResetter::class);
        $servicesResetter->expects($shouldReset ? $this->once() : $this->never())->method('reset');

        $event = new WorkerRunningEvent($this->createMock(Worker::class), !$shouldReset);

        $resetListener = new ResetServicesListener($servicesResetter);
        $resetListener->resetServices($event);
    }

    public function testResetServicesAtStop()
    {
        $servicesResetter = $this->createMock(ServicesResetter::class);
        $servicesResetter->expects($this->once())->method('reset');

        $event = new WorkerStoppedEvent($this->createMock(Worker::class));

        $resetListener = new ResetServicesListener($servicesResetter);
        $resetListener->resetServicesAtStop($event);
    }
Home | Imprint | This part of the site doesn't use cookies.