Skip to content

Commit

Permalink
Merge pull request #228 from asm89/ddc-551-parameter-inference
Browse files Browse the repository at this point in the history
Fixed testsuite
  • Loading branch information
asm89 committed Dec 19, 2011
2 parents 7f8f391 + 8c6c49a commit 4f67ea3
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/Doctrine/Tests/ORM/Functional/SQLFilterTest.php
Expand Up @@ -2,7 +2,7 @@

namespace Doctrine\Tests\ORM\Functional;

use Doctrine\DBAL\Types\Type;
use Doctrine\DBAL\Types\Type as DBALType;
use Doctrine\ORM\Query\Filter\SQLFilter;
use Doctrine\ORM\Mapping\ClassMetaData;
use Doctrine\Common\Cache\ArrayCache;
Expand Down Expand Up @@ -214,7 +214,7 @@ public function testSQLFilterGetSetParameter()

$filter = new MyLocaleFilter($em);

$filter->setParameter('locale', 'en', Type::STRING);
$filter->setParameter('locale', 'en', DBALType::STRING);

$this->assertEquals("'en'", $filter->getParameter('locale'));
}
Expand Down Expand Up @@ -270,16 +270,16 @@ public function testSQLFilterToString()
$filterCollection = $this->addMockFilterCollection($em);

$filter = new MyLocaleFilter($em);
$filter->setParameter('locale', 'en', Type::STRING);
$filter->setParameter('foo', 'bar', Type::STRING);
$filter->setParameter('locale', 'en', DBALType::STRING);
$filter->setParameter('foo', 'bar', DBALType::STRING);

$filter2 = new MyLocaleFilter($em);
$filter2->setParameter('foo', 'bar', Type::STRING);
$filter2->setParameter('locale', 'en', Type::STRING);
$filter2->setParameter('foo', 'bar', DBALType::STRING);
$filter2->setParameter('locale', 'en', DBALType::STRING);

$parameters = array(
'foo' => array('value' => 'bar', 'type' => Type::STRING),
'locale' => array('value' => 'en', 'type' => Type::STRING),
'foo' => array('value' => 'bar', 'type' => DBALType::STRING),
'locale' => array('value' => 'en', 'type' => DBALType::STRING),
);

$this->assertEquals(serialize($parameters), ''.$filter);
Expand Down Expand Up @@ -319,7 +319,7 @@ public function testQueryGeneration_DependsOnFilters()
$conf = $this->_em->getConfiguration();
$conf->addFilter("country", "\Doctrine\Tests\ORM\Functional\CMSCountryFilter");
$this->_em->getFilters()->enable("country")
->setParameter("country", "en", Type::STRING);
->setParameter("country", "en", DBALType::STRING);

$this->assertNotEquals($firstSQLQuery, $query->getSQL());
}
Expand All @@ -336,7 +336,7 @@ public function testToOneFilter()

$conf = $this->_em->getConfiguration();
$conf->addFilter("country", "\Doctrine\Tests\ORM\Functional\CMSCountryFilter");
$this->_em->getFilters()->enable("country")->setParameter("country", "Germany", Type::STRING);
$this->_em->getFilters()->enable("country")->setParameter("country", "Germany", DBALType::STRING);

// We get one user after enabling the filter
$this->assertEquals(1, count($query->getResult()));
Expand All @@ -352,7 +352,7 @@ public function testManyToManyFilter()

$conf = $this->_em->getConfiguration();
$conf->addFilter("group_prefix", "\Doctrine\Tests\ORM\Functional\CMSGroupPrefixFilter");
$this->_em->getFilters()->enable("group_prefix")->setParameter("prefix", "bar_%", Type::STRING);
$this->_em->getFilters()->enable("group_prefix")->setParameter("prefix", "bar_%", DBALType::STRING);

// We get one user after enabling the filter
$this->assertEquals(1, count($query->getResult()));
Expand All @@ -369,7 +369,7 @@ public function testWhereFilter()

$conf = $this->_em->getConfiguration();
$conf->addFilter("group_prefix", "\Doctrine\Tests\ORM\Functional\CMSGroupPrefixFilter");
$this->_em->getFilters()->enable("group_prefix")->setParameter("prefix", "bar_%", Type::STRING);
$this->_em->getFilters()->enable("group_prefix")->setParameter("prefix", "bar_%", DBALType::STRING);

// We get one user after enabling the filter
$this->assertEquals(1, count($query->getResult()));
Expand All @@ -388,7 +388,7 @@ private function useCMSArticleTopicFilter()
{
$conf = $this->_em->getConfiguration();
$conf->addFilter("article_topic", "\Doctrine\Tests\ORM\Functional\CMSArticleTopicFilter");
$this->_em->getFilters()->enable("article_topic")->setParameter("topic", "Test1", Type::STRING);
$this->_em->getFilters()->enable("article_topic")->setParameter("topic", "Test1", DBALType::STRING);
}

public function testOneToMany_ExtraLazyCountWithFilter()
Expand Down Expand Up @@ -435,7 +435,7 @@ private function useCMSGroupPrefixFilter()
{
$conf = $this->_em->getConfiguration();
$conf->addFilter("group_prefix", "\Doctrine\Tests\ORM\Functional\CMSGroupPrefixFilter");
$this->_em->getFilters()->enable("group_prefix")->setParameter("prefix", "foo%", Type::STRING);
$this->_em->getFilters()->enable("group_prefix")->setParameter("prefix", "foo%", DBALType::STRING);
}

public function testManyToMany_ExtraLazyCountWithFilter()
Expand Down Expand Up @@ -556,7 +556,7 @@ public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingSubEn
$conf->addFilter("person_name", "\Doctrine\Tests\ORM\Functional\CompanyPersonNameFilter");
$this->_em->getFilters()
->enable("person_name")
->setParameter("name", "Guilh%", Type::STRING);
->setParameter("name", "Guilh%", DBALType::STRING);

$managers = $this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyManager')->findAll();
$this->assertEquals(1, count($managers));
Expand All @@ -576,7 +576,7 @@ public function testJoinSubclassPersister_FilterOnlyOnRootTableWhenFetchingRootE
$conf->addFilter("person_name", "\Doctrine\Tests\ORM\Functional\CompanyPersonNameFilter");
$this->_em->getFilters()
->enable("person_name")
->setParameter("name", "Guilh%", Type::STRING);
->setParameter("name", "Guilh%", DBALType::STRING);

$persons = $this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyPerson')->findAll();
$this->assertEquals(1, count($persons));
Expand Down Expand Up @@ -622,7 +622,7 @@ public function testSingleTableInheritance_FilterOnlyOnRootTableWhenFetchingSubE
$conf->addFilter("completed_contract", "\Doctrine\Tests\ORM\Functional\CompletedContractFilter");
$this->_em->getFilters()
->enable("completed_contract")
->setParameter("completed", true, Type::BOOLEAN);
->setParameter("completed", true, DBALType::BOOLEAN);

$this->assertEquals(1, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyFlexUltraContract')->findAll()));
$this->assertEquals(1, count($this->_em->createQuery("SELECT cfc FROM Doctrine\Tests\Models\Company\CompanyFlexUltraContract cfc")->getResult()));
Expand All @@ -639,7 +639,7 @@ public function testSingleTableInheritance_FilterOnlyOnRootTableWhenFetchingRoot
$conf->addFilter("completed_contract", "\Doctrine\Tests\ORM\Functional\CompletedContractFilter");
$this->_em->getFilters()
->enable("completed_contract")
->setParameter("completed", true, Type::BOOLEAN);
->setParameter("completed", true, DBALType::BOOLEAN);

$this->assertEquals(2, count($this->_em->getRepository('Doctrine\Tests\Models\Company\CompanyFlexContract')->findAll()));
$this->assertEquals(2, count($this->_em->createQuery("SELECT cfc FROM Doctrine\Tests\Models\Company\CompanyFlexContract cfc")->getResult()));
Expand Down

0 comments on commit 4f67ea3

Please sign in to comment.