Contao\CoreBundle\Test\Doctrine\Schema\DoctrineSchemaListenerTest::testOnSchemaIndexDefinitionWithoutSubpart PHP Метод

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

Tests the onSchemaIndexDefinition() method without subpart.
    public function testOnSchemaIndexDefinitionWithoutSubpart()
    {
        /** @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->any())->method('fetchAssoc')->willReturn(['Table' => 'tl_member', 'Non_unique' => '0', 'Key_name' => 'username', 'Seq_in_index' => '1', 'Column_name' => 'username', 'Collation' => 'A', 'Cardinality' => null, 'Sub_part' => null, 'Packed' => null, 'Null' => 'YES', 'Index_type' => 'BTREE', 'Comment' => '', 'Index_comment' => '']);
        /** @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('getTable')->willReturn('tl_member');
        $event->expects($this->any())->method('getTableIndex')->willReturn($this->getIndexEventArg('username'));
        $event->expects($this->never())->method('setIndex');
        $listener = new DoctrineSchemaListener($this->getMock('Contao\\CoreBundle\\Doctrine\\Schema\\DcaSchemaProvider', [], [], '', false));
        $listener->onSchemaIndexDefinition($event);
    }