test cache i prywatnej metody

    public function it_is_get_data_test(
        ServiceConflictsFinder $serviceConflictsFinder,
        CacheProviderInterface $cacheProvider
    ): void {
        $serviceId = 1;
        $serviceId2 = 2;

        $serviceConflictsFinder->getData($serviceId)->willReturn([2, 3])->shouldBeCalledOnce();
        $serviceConflictsFinder->getData($serviceId2)->willReturn([7, 8])->shouldBeCalledOnce();
        $cacheProvider->load(
            sprintf('service_conflict_data_%s', $serviceId),
            CacheLifetime::HOUR,
            Argument::that(
                function ($serviceId) {
                    call_user_func($serviceId);

                    return [2, 3];
                }
            )
        )->willReturn([2, 3])->shouldBeCalledOnce();
        $cacheProvider->load(
            sprintf('service_conflict_data_%s', $serviceId2),
            CacheLifetime::HOUR,
            Argument::that(
                function ($serviceId2) {
                    call_user_func($serviceId2);

                    return [7, 8];
                }
            )
        )->willReturn([7, 8])->shouldBeCalledOnce();

        $this->getDataOfConflictsServices([1, 2])->shouldBe([1 => [2, 3], 2 => [7, 8]]);
    }
Komentarze wyłączone