public function testOnSchemaIndexDefinitionIgnoresPrimaryKey() { /** @var Connection|\PHPUnit_Framework_MockObject_MockObject $event */ $connection = $this->getMock('Doctrine\\DBAL\\Connection', ['getDatabasePlatform', 'fetchAssoc'], [], '', false); $connection->expects($this->any())->method('getDatabasePlatform')->willReturn(new MySqlPlatform()); $connection->expects($this->never())->method('fetchAssoc'); /** @var SchemaIndexDefinitionEventArgs|\PHPUnit_Framework_MockObject_MockObject $event */ $event = $this->getMock('Doctrine\\DBAL\\Event\\SchemaIndexDefinitionEventArgs', [], [], '', false); $event->expects($this->any())->method('getConnection')->willReturn($connection); $event->expects($this->any())->method('getTableIndex')->willReturn($this->getIndexEventArg('PRIMARY')); $event->expects($this->never())->method('setIndex'); $listener = new DoctrineSchemaListener($this->getMock('Contao\\CoreBundle\\Doctrine\\Schema\\DcaSchemaProvider', [], [], '', false)); $listener->onSchemaIndexDefinition($event); }