Kraken\_Unit\Channel\Record\ResponseRecordStorageTest::testApiExpireResponses_ExpiresResponsesWhichTimeoutIsLessThanTimeNow PHP Method

testApiExpireResponses_ExpiresResponsesWhichTimeoutIsLessThanTimeNow() public method

    public function testApiExpireResponses_ExpiresResponsesWhichTimeoutIsLessThanTimeNow()
    {
        $obj = $this->createResponseRecordStorage();
        $now = TimeSupport::now();
        $rep1 = new ResponseRecord($pid1 = 'pid1', $alias1 = 'alias1', $now + 1000000.0);
        $rep2 = new ResponseRecord($pid2 = 'pid2', $alias2 = 'alias2', $now);
        $this->callProtectedMethod($obj, 'addResponse', [$pid1, $rep1]);
        $this->callProtectedMethod($obj, 'addResponse', [$pid2, $rep2]);
        $this->callProtectedMethod($obj, 'resolveOrRejectResponse', [$pid2, new Exception()]);
        $this->assertTrue(array_key_exists($pid2, $this->getProtectedProperty($obj, 'handledReps')));
        $reps = $this->getProtectedProperty($obj, 'handledReps');
        $this->setProtectedProperty($reps[$pid2], 'timeout', $now - 1000);
        $this->callProtectedMethod($obj, 'expireResponses');
        $this->assertFalse(array_key_exists('pid', $this->getProtectedProperty($obj, 'handledReps')));
    }