diff --git a/classes/xml/xmlquery/argument/ConditionArgument.class.php b/classes/xml/xmlquery/argument/ConditionArgument.class.php index b5d3a280b..2e2267793 100644 --- a/classes/xml/xmlquery/argument/ConditionArgument.class.php +++ b/classes/xml/xmlquery/argument/ConditionArgument.class.php @@ -31,6 +31,9 @@ case 'like' : $this->value = '%'.$value.'%'; break; + case 'in': + if(!is_array($value)) $this->value = array($value); + break; } /* //if(!in_array($operation,array('in','notin','between')) && is_array($value)){ diff --git a/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php b/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php index d2f386b0b..116cf232a 100644 --- a/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php +++ b/test-phpUnit/classes/xml/xmlquery/argument/ConditionArgumentTest.php @@ -5,6 +5,17 @@ */ class ConditionArgumentTest extends CubridTest { + function testIn(){ + $args->document_srl = 1234; + $document_srl_argument = new ConditionArgument('document_srl', $args->document_srl, 'in'); + $document_srl_argument->checkNotNull(); + $document_srl_argument->createConditionValue(); + if(!$document_srl_argument->isValid()) return $document_srl_argument->getErrorMessage(); + $document_srl_argument->setColumnType('number'); + + $condition = new Condition('"extra_vars"."document_srl"',$document_srl_argument,"in", 'and'); + $this->assertEquals('and "extra_vars"."document_srl" in (1234)', $condition->toString()); + } /** * @todo Implement testCreateConditionValue(). */ diff --git a/test-phpUnit/classes/xml/xmlquery/queryargument/QueryArgumentTest.php b/test-phpUnit/classes/xml/xmlquery/queryargument/QueryArgumentTest.php index d8911682f..b13e953db 100644 --- a/test-phpUnit/classes/xml/xmlquery/queryargument/QueryArgumentTest.php +++ b/test-phpUnit/classes/xml/xmlquery/queryargument/QueryArgumentTest.php @@ -7,7 +7,7 @@ class QueryArgumentTest extends CubridTest { var $xmlPath = "data/"; - function QueryArgumentClass(){ + function QueryArgumentTest(){ $this->xmlPath = str_replace('QueryArgumentTest.php', '', str_replace('\\', '/', __FILE__)) . $this->xmlPath; }