Pantheon\Terminus\UnitTests\Collections\WorkflowsTest::testFetchWithOperations PHP Метод

testFetchWithOperations() публичный Метод

    public function testFetchWithOperations()
    {
        $data = [(object) ['id' => 'a', 'result' => 'succeeded', 'finished_at' => 4, 'created_at' => 1], (object) ['id' => 'b', 'result' => 'failed', 'finished_at' => 5, 'created_at' => 4], (object) ['id' => 'c', 'finished_at' => 2, 'created_at' => 3]];
        $this->request->expects($this->once())->method('request')->with('TESTURL', ['options' => ['method' => 'get'], 'query' => ['hydrate' => 'operations']])->willReturn(['data' => $data]);
        $workflows = $this->getMockBuilder(Workflows::class)->disableOriginalConstructor()->setMethods(['getUrl', 'add'])->getMock();
        $workflows->expects($this->once())->method('getURl')->willReturn('TESTURL');
        foreach ($data as $i => $model_data) {
            $workflows->expects($this->at($i + 1))->method('add')->with($model_data);
        }
        $workflows->setRequest($this->request);
        $workflows->fetchWithOperations();
    }