X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FQuery%2FParameterTypeInfererTest.php;fp=vendor%2Fdoctrine%2Form%2Ftests%2FDoctrine%2FTests%2FORM%2FQuery%2FParameterTypeInfererTest.php;h=60b118570b23db37682ef334f6a6ebc03b0b2753;hb=8b04b2d11798dee4f3e1358e4f43e97a6df851f6;hp=0000000000000000000000000000000000000000;hpb=73568cf05a785a45f94ca3f2351d9e07bf917958;p=zf2.biz%2Fapplication_blanche.git diff --git a/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php new file mode 100644 index 0000000..60b1185 --- /dev/null +++ b/vendor/doctrine/orm/tests/Doctrine/Tests/ORM/Query/ParameterTypeInfererTest.php @@ -0,0 +1,53 @@ +. + */ +namespace Doctrine\Tests\ORM\Query; + +use Doctrine\ORM\Query\ParameterTypeInferer; +use Doctrine\DBAL\Connection; +use Doctrine\DBAL\Types\Type; +use PDO; + +require_once __DIR__ . '/../../TestInit.php'; + +class ParameterTypeInfererTest extends \Doctrine\Tests\OrmTestCase +{ + + public function providerParameterTypeInferer() + { + return array( + array(1, Type::INTEGER), + array("bar", PDO::PARAM_STR), + array("1", PDO::PARAM_STR), + array(new \DateTime, Type::DATETIME), + array(array(2), Connection::PARAM_INT_ARRAY), + array(array("foo"), Connection::PARAM_STR_ARRAY), + array(array("1","2"), Connection::PARAM_STR_ARRAY), + array(array(), Connection::PARAM_STR_ARRAY), + ); + } + + /** + * @dataProvider providerParameterTypeInferer + */ + + public function testParameterTypeInferer($value, $expected) + { + $this->assertEquals($expected, ParameterTypeInferer::inferType($value)); + } +} \ No newline at end of file