Commit c97fc19d authored by zYne's avatar zYne

--no commit message

--no commit message
parent 91cb642d
......@@ -40,10 +40,10 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$parser->parse('u', 'name', "'some guy' OR zYne");
$this->assertEqual($parser->getCondition(), '(u.name LIKE ? OR u.name LIKE ?)');
$this->assertEqual($parser->getParams(), array('some guy%', 'zYne%'));
$this->assertEqual($parser->getParams(), array('%some guy%', '%zYne%'));
}
public function testHookOrderbyAcceptsArray()
public function testHookOrderbyAcceptsArray()
{
$hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p');
......@@ -53,7 +53,7 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) ORDER BY e.name ASC');
}
public function testHookOrderbyAcceptsDescendingOrder()
public function testHookOrderbyAcceptsDescendingOrder()
{
$hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p');
......@@ -63,7 +63,7 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) ORDER BY e.name DESC');
}
public function testHookOrderbyDoesntAcceptUnknownColumn()
public function testHookOrderbyDoesntAcceptUnknownColumn()
{
$hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p');
......@@ -73,7 +73,7 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)');
}
public function testHookOrderbyAcceptsMultipleParameters()
public function testHookOrderbyAcceptsMultipleParameters()
{
$hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p');
......@@ -81,11 +81,11 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$hook->hookOrderBy($a['orderby']);
$this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0) ORDER BY e.name ASC, e.id DESC');
$users = $hook->getQuery()->execute();
}
public function testHookWhereAcceptsArrays()
public function testHookWhereAcceptsArrays()
{
$hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p');
......@@ -94,10 +94,10 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$hook->hookWhere($a['where']);
$this->assertEqual($hook->getQuery()->getQuery(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.name LIKE ? OR e.name LIKE ?) AND e.loginname LIKE ? AND (e.type = 0)');
$this->assertEqual($hook->getQuery()->getParams(), array('Jack%', 'Daniels%', 'TheMan%'));
$this->assertEqual($hook->getQuery()->getParams(), array('%Jack%', '%Daniels%', '%TheMan%'));
}
public function testHookWhereSupportsIntegerTypes()
public function testHookWhereSupportsIntegerTypes()
{
$hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p');
......@@ -108,7 +108,7 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($hook->getQuery()->getParams(), array(10000));
}
public function testHookWhereDoesntAcceptUnknownColumn()
public function testHookWhereDoesntAcceptUnknownColumn()
{
$hook = new Doctrine_Hook('SELECT u.name FROM User u LEFT JOIN u.Phonenumber p');
......@@ -119,37 +119,37 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($hook->getQuery()->getSql(), 'SELECT e.id AS e__id, e.name AS e__name FROM entity e LEFT JOIN phonenumber p ON e.id = p.entity_id WHERE (e.type = 0)');
}
public function testEqualParserUsesEqualOperator()
public function testEqualParserUsesEqualOperator()
{
$parser = new Doctrine_Hook_Equal();
$parser->parse('u', 'name', 'zYne');
$this->assertEqual($parser->getCondition(), 'u.name = ?');
$this->assertEqual($parser->getParams(), array('zYne'));
}
public function testWordLikeParserUsesLikeOperator()
public function testWordLikeParserUsesLikeOperator()
{
$parser = new Doctrine_Hook_WordLike();
$parser->parse('u', 'name', 'zYne');
$this->assertEqual($parser->getCondition(), 'u.name LIKE ?');
$this->assertEqual($parser->getParams(), array('zYne%'));
$this->assertEqual($parser->getParams(), array('%zYne%'));
}
public function testIntegerParserSupportsIntervals()
public function testIntegerParserSupportsIntervals()
{
$parser = new Doctrine_Hook_Integer();
$parser->parse('m', 'year', '1998-2000');
$this->assertEqual($parser->getCondition(), '(m.year > ? AND m.year < ?)');
$this->assertEqual($parser->getParams(), array('1998', '2000'));
}
public function testIntegerParserSupportsEqualOperator()
public function testIntegerParserSupportsEqualOperator()
{
$parser = new Doctrine_Hook_Integer();
......@@ -159,7 +159,7 @@ class Doctrine_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($parser->getParams(), array('1998'));
}
public function testIntegerParserSupportsNestingConditions()
public function testIntegerParserSupportsNestingConditions()
{
$parser = new Doctrine_Hook_Integer();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment