php+symfony - phpunit test - Cannot instantiate interface error

Just as the error message tells you: In your test you try to create an instance of an interface with new ManagerRegistry(). But you cannot instantiate interfaces.

In your OrdersService you have those services, because you add them as constructor arguments and symfony's dependency injection component handles their creation.

In your unit test you generally don't want to have real instances of all these dependencies (with all their own dependencies etc.). Instead you want a mocked version. A mock that just acts as it were the real object. Therefore you need to create mocks for all dependencies an add them to OrdersService in your test:

public function addShoes3()
{
    $registry = $this->createMock(ManagerRegistry::class);
    $ordersRepository = $this->createMock(OrdersRepository::class);
    $router = $this->createMock(RouterInterface::class);

    $ordersService = new OrdersService($ordersRepository, $manager, $router);
    $actual = $ordersService->add(40002, 400);
    $expected = $ordersService->add(40002, 400);

    $this->assertEquals($expected, $actual);
}