Pinq\Tests\Integration\Providers\DSL\DSLProviderTest::testRequestCallsLoadsAndCachesCompiledRequest PHP Method

testRequestCallsLoadsAndCachesCompiledRequest() public method

    public function testRequestCallsLoadsAndCachesCompiledRequest()
    {
        $requestTemplateMock = $this->queryTemplateMock('Pinq\\Providers\\DSL\\Compilation\\IRequestTemplate');
        $compiledRequestMock = $this->getMockForAbstractClass('Pinq\\Providers\\DSL\\Compilation\\ICompiledRequest');
        $cacheMock = $this->queryCacheAdapterMock($requestTemplateMock, $compiledRequestMock);
        $configurationMock = $this->getMockBuilder('Pinq\\Providers\\DSL\\QueryCompilerConfiguration')->setMethods(['buildCompiledQueryCache', 'createRequestTemplate', 'compileRequestQuery'])->disableOriginalConstructor()->getMockForAbstractClass();
        $configurationMock->expects($this->once())->method('buildCompiledQueryCache')->will($this->returnValue($cacheMock));
        $configurationMock->expects($this->once())->method('createRequestTemplate')->will($this->returnValue($requestTemplateMock));
        $configurationMock->expects($this->once())->method('compileRequestQuery')->will($this->returnValue($compiledRequestMock));
        $configurationMock->__construct();
        /** @var $provider \Pinq\Providers\DSL\QueryProvider|\PHPUnit_Framework_MockObject_MockObject */
        $provider = $this->getMockForAbstractClass('Pinq\\Providers\\DSL\\QueryProvider', [new Queries\SourceInfo(''), $configurationMock]);
        $provider->expects($this->once())->method('loadCompiledRequest')->with($this->identicalTo($compiledRequestMock))->will($this->returnValue([1, 2, 3]));
        $queryable = $provider->createQueryable();
        //Perform request
        $queryable->getIterator();
    }