Skip to content

Commit

Permalink
Mock rather than misuse a private Doctrine class
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilkybarkid committed Oct 9, 2013
1 parent 09d9e9f commit 73565fb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Tests/Doctrine/DBAL/Types/PhoneNumberTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DBAL\Mocks\MockPlatform;
use libphonenumber\PhoneNumberUtil;
use Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType;
use PHPUnit_Framework_TestCase as TestCase;
Expand Down Expand Up @@ -42,14 +41,19 @@ class PhoneNumberTypeTest extends TestCase

public static function setUpBeforeClass()
{
require_once __DIR__ . '/../../../../vendor/doctrine/dbal/tests/Doctrine/Tests/DBAL/Mocks/MockPlatform.php';

Type::addType('phone_number', 'Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType');
}

protected function setUp()
{
$this->platform = new MockPlatform();
$this->platform = $this->getMockBuilder('Doctrine\DBAL\Platforms\AbstractPlatform')
->setMethods(array('getVarcharTypeDeclarationSQL'))
->getMockForAbstractClass();

$this->platform->expects($this->any())
->method('getVarcharTypeDeclarationSQL')
->will($this->returnValue('DUMMYVARCHAR()'));

$this->type = Type::getType('phone_number');
$this->phoneNumberUtil = PhoneNumberUtil::getInstance();
}
Expand Down

0 comments on commit 73565fb

Please sign in to comment.