public function testGetFields() { $mainTable = 'main_table'; $expectedDescribedTable = ['described_table' => null]; $this->resource->expects($this->any())->method('getMainTable')->willReturn($mainTable); $this->connection->expects($this->once())->method('describeTable')->with($mainTable)->willReturn($expectedDescribedTable); $this->assertEquals($expectedDescribedTable, $this->entityMetadata->getFields($this->model)); //get from cached $this->connection->expects($this->never())->method('describeTable'); $this->assertEquals($expectedDescribedTable, $this->entityMetadata->getFields($this->model)); }