Skip to content

Commit

Permalink
Fixed parenthesis for NOT negator
Browse files Browse the repository at this point in the history
  • Loading branch information
dantleech committed Sep 11, 2014
1 parent cdb41ce commit 4b92eda
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PHPCR/Util/QOM/BaseSqlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function evalOr($constraint1, $constraint2)
*/
public function evalNot($constraint)
{
return "NOT $constraint";
return "(NOT $constraint)";
}

/**
Expand Down
15 changes: 15 additions & 0 deletions tests/PHPCR/Tests/Util/QOM/BaseSqlGeneratorTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace PHPCR\Tests\Util\QOM;

use PHPCR\Util\QOM\Sql1Generator;
use PHPCR\Util\ValueConverter;

abstract class BaseSqlGeneratorTest extends \PHPUnit_Framework_TestCase
{
public function testNot()
{
$string = $this->generator->evalNot("foo = bar");
$this->assertSame("(NOT foo = bar)", $string);
}
}
2 changes: 1 addition & 1 deletion tests/PHPCR/Tests/Util/QOM/Sql2GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 4b92eda

Please sign in to comment.