From 62f097798cac34859d499a65fbd08419ed3dee39 Mon Sep 17 00:00:00 2001 From: mattab <matthieu.aubry@gmail.com> Date: Mon, 28 Sep 2015 17:47:52 +1300 Subject: [PATCH] New test case for "Action Does not contain X" --- tests/PHPUnit/Integration/SegmentTest.php | 12 ++++++++---- tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/PHPUnit/Integration/SegmentTest.php b/tests/PHPUnit/Integration/SegmentTest.php index 3245f32bfd..b44e78bd9b 100644 --- a/tests/PHPUnit/Integration/SegmentTest.php +++ b/tests/PHPUnit/Integration/SegmentTest.php @@ -19,7 +19,7 @@ use Piwik\Tracker\TableLogAction; /** * @group Core - * @group SegmentTest + * @group Segment */ class SegmentTest extends IntegrationTestCase { @@ -651,8 +651,9 @@ class SegmentTest extends IntegrationTestCase * pageUrl!=abcdefg -- Matches all * pageUrl=@does-not-exist -- Matches none * pageUrl=='.urlencode($pageUrlFoundInDb) -- Matches one + * pageUrl!@found -- Matches all */ - $segment = 'visitServerHour==12,pageUrl==xyz;pageUrl!=abcdefg,pageUrl=@does-not-exist,pageUrl=='.urlencode($pageUrlFoundInDb); + $segment = 'visitServerHour==12,pageUrl==xyz;pageUrl!=abcdefg,pageUrl=@does-not-exist,pageUrl=='.urlencode($pageUrlFoundInDb).',pageUrl!@found'; $segment = new Segment($segment, $idSites = array()); $query = $segment->getSelectQuery($select, $from, $where, $bind); @@ -672,14 +673,17 @@ class SegmentTest extends IntegrationTestCase OR (1 = 0)) AND ((1 = 1) OR ( log_link_visit_action.idaction_url IN (SELECT idaction FROM log_action WHERE ( name LIKE CONCAT('%', ?, '%') AND type = 1 )) ) - OR log_link_visit_action.idaction_url = ? ) + OR log_link_visit_action.idaction_url = ? + OR ( log_link_visit_action.idaction_url IN (SELECT idaction FROM log_action WHERE ( name NOT LIKE CONCAT('%', ?, '%') AND type = 1 )) ) + ) GROUP BY log_visit.idvisit ORDER BY NULL ) AS log_inner", "bind" => array( 12, "does-not-exist", - $actionIdFoundInDb + $actionIdFoundInDb, + "found" )); $this->assertEquals($this->removeExtraWhiteSpaces($expected), $this->removeExtraWhiteSpaces($query)); diff --git a/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php b/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php index ede256707b..6d9dcc67b1 100644 --- a/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php +++ b/tests/PHPUnit/Unit/Segment/SegmentExpressionTest.php @@ -10,6 +10,10 @@ namespace Piwik\Tests\Unit; use Piwik\Segment\SegmentExpression; +/** + * @group SegmentExpressionTest + * @group Segment + */ class SegmentExpressionTest extends \PHPUnit_Framework_TestCase { /** -- GitLab