diff --git a/src/PHPCR/Util/QOM/BaseSqlGenerator.php b/src/PHPCR/Util/QOM/BaseSqlGenerator.php index 1cbb392..dca2e2b 100644 --- a/src/PHPCR/Util/QOM/BaseSqlGenerator.php +++ b/src/PHPCR/Util/QOM/BaseSqlGenerator.php @@ -83,7 +83,7 @@ public function evalOr($constraint1, $constraint2) */ public function evalNot($constraint) { - return "NOT $constraint"; + return "(NOT $constraint)"; } /** diff --git a/tests/PHPCR/Tests/Util/QOM/BaseSqlGeneratorTest.php b/tests/PHPCR/Tests/Util/QOM/BaseSqlGeneratorTest.php new file mode 100644 index 0000000..d5984db --- /dev/null +++ b/tests/PHPCR/Tests/Util/QOM/BaseSqlGeneratorTest.php @@ -0,0 +1,15 @@ +generator->evalNot("foo = bar"); + $this->assertSame("(NOT foo = bar)", $string); + } +} diff --git a/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php b/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php index e5cbc75..83f40a7 100644 --- a/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php +++ b/tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php @@ -5,7 +5,7 @@ use PHPCR\Util\QOM\Sql2Generator; use PHPCR\Util\ValueConverter; -class Sql2GeneratorTest extends \PHPUnit_Framework_TestCase +class Sql2GeneratorTest extends BaseSqlGeneratorTest { protected $generator;