. */ /** * Doctrine_Expression_TestCase * * @package Doctrine * @author Konsta Vesterinen * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @category Object Relational Mapping * @link www.phpdoctrine.com * @since 1.0 * @version $Revision$ */ class Doctrine_Expression_TestCase extends Doctrine_UnitTestCase { public function prepareData() { } public function testSavingWithAnExpression() { $e = new Doctrine_Expression("CONCAT('some', 'one')"); $this->assertEqual($e->getSql(), "CONCAT('some', 'one')"); $u = new User(); $u->name = $e; $u->save(); $u->refresh(); $this->assertEqual($u->name, 'someone'); } public function testExpressionParserSupportsNumericalClauses() { $e = new Doctrine_Expression('1 + 2'); $this->assertEqual($e->getSql(), '1 + 2'); } public function testExpressionParserSupportsFunctionComposition() { $e = new Doctrine_Expression("SUBSTRING(CONCAT('some', 'one'), 0, 3)"); $this->assertEqual($e->getSql(), "SUBSTR(CONCAT('some', 'one'), 0, 3)"); } }