Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Doctrine\Tests\DBAL\Schema\Visitor;
- use Doctrine\DBAL\Platforms\AbstractPlatform;
- use \Doctrine\DBAL\Schema\Visitor\DropSchemaSqlCollector;
- class DropSchemaSqlCollectorTest extends \PHPUnit_Framework_TestCase
- {
- public function testGetQueriesUsesAcceptedForeignKeys()
- {
- $tableOne = $this->getMockWithoutArguments('Doctrine\DBAL\Schema\Table');
- $tableTwo = $this->getMockWithoutArguments('Doctrine\DBAL\Schema\Table');
- $keyConstraintOne = $this->getStubKeyConstraint('first');
- $keyConstraintTwo = $this->getStubKeyConstraint('second');
- $platform = $this->getMock('Doctrine\Tests\DBAL\Schema\Visitor\PlatformStub');
- $collector = new DropSchemaSqlCollector($platform);
- $platform->expects($this->exactly(2))
- ->method('getDropForeignKeySQL');
- $platform->expects($this->at(0))
- ->method('getDropForeignKeySQL')
- ->with($keyConstraintOne, $tableOne);
- $platform->expects($this->at(1))
- ->method('getDropForeignKeySQL')
- ->with($keyConstraintTwo, $tableTwo);
- $collector->acceptForeignKey($tableOne, $keyConstraintOne);
- $collector->acceptForeignKey($tableTwo, $keyConstraintTwo);
- $collector->getQueries();
- }
- private function getMockWithoutArguments($className)
- {
- return $this->getMockBuilder($className)->disableOriginalConstructor()->getMock();
- }
- private function getStubKeyConstraint($name)
- {
- $constraint = $this->getMockWithoutArguments('Doctrine\DBAL\Schema\ForeignKeyConstraint');
- $constraint->expects($this->any())
- ->method('getName')
- ->will($this->returnValue($name));
- return $constraint;
- }
- }
- class PlatformStub extends AbstractPlatform {
- /**
- * Returns the SQL snippet that declares a boolean column.
- *
- * @param array $columnDef
- *
- * @return string
- */
- public function getBooleanTypeDeclarationSQL( array $columnDef ) {
- // TODO: Implement getBooleanTypeDeclarationSQL() method.
- }
- /**
- * Returns the SQL snippet that declares a 4 byte integer column.
- *
- * @param array $columnDef
- *
- * @return string
- */
- public function getIntegerTypeDeclarationSQL( array $columnDef ) {
- // TODO: Implement getIntegerTypeDeclarationSQL() method.
- }
- /**
- * Returns the SQL snippet that declares an 8 byte integer column.
- *
- * @param array $columnDef
- *
- * @return string
- */
- public function getBigIntTypeDeclarationSQL( array $columnDef ) {
- // TODO: Implement getBigIntTypeDeclarationSQL() method.
- }
- /**
- * Returns the SQL snippet that declares a 2 byte integer column.
- *
- * @param array $columnDef
- *
- * @return string
- */
- public function getSmallIntTypeDeclarationSQL( array $columnDef ) {
- // TODO: Implement getSmallIntTypeDeclarationSQL() method.
- }
- /**
- * Returns the SQL snippet that declares common properties of an integer column.
- *
- * @param array $columnDef
- *
- * @return string
- */
- protected function _getCommonIntegerTypeDeclarationSQL( array $columnDef ) {
- // TODO: Implement _getCommonIntegerTypeDeclarationSQL() method.
- }
- /**
- * Lazy load Doctrine Type Mappings.
- *
- * @return void
- */
- protected function initializeDoctrineTypeMappings() {
- // TODO: Implement initializeDoctrineTypeMappings() method.
- }
- /**
- * Returns the SQL snippet used to declare a CLOB column type.
- *
- * @param array $field
- *
- * @return string
- */
- public function getClobTypeDeclarationSQL( array $field ) {
- // TODO: Implement getClobTypeDeclarationSQL() method.
- }
- /**
- * Returns the SQL Snippet used to declare a BLOB column type.
- *
- * @param array $field
- *
- * @return string
- */
- public function getBlobTypeDeclarationSQL( array $field ) {
- // TODO: Implement getBlobTypeDeclarationSQL() method.
- }
- /**
- * Gets the name of the platform.
- *
- * @return string
- */
- public function getName() {
- // TODO: Implement getName() method.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement