Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mattab committed Dec 5, 2014
1 parent 04e3b93 commit 966fb42
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions tests/PHPUnit/Integration/SegmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function tearDown()
parent::tearDown();
}

protected function _filterWhitsSpaces($valueToFilter)
protected function _filterWhiteSpaces($valueToFilter)
{
if (is_array($valueToFilter)) {
foreach ($valueToFilter as $key => $value) {
$valueToFilter[$key] = $this->_filterWhitsSpaces($value);
$valueToFilter[$key] = $this->_filterWhiteSpaces($value);
}
return $valueToFilter;
} else {
Expand Down Expand Up @@ -117,11 +117,11 @@ public function testCommon($segment, $expected)
$segment = new Segment($segment, $idSites = array());
$sql = $segment->getSelectQuery($select, $from, false);

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($sql));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($sql));

// calling twice should give same results
$sql = $segment->getSelectQuery($select, array($from));
$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($sql));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($sql));

$this->assertEquals(32, strlen($segment->getHash()));
}
Expand Down Expand Up @@ -150,7 +150,7 @@ public function test_getSelectQuery_whenNoJoin()
( log_visit.custom_var_k1 = ? AND log_visit.visitor_returning = ? )",
"bind" => array(1, 'Test', 0));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

public function test_getSelectQuery_whenJoinVisitOnAction()
Expand Down Expand Up @@ -178,7 +178,7 @@ public function test_getSelectQuery_whenJoinVisitOnAction()
( log_link_visit_action.custom_var_k1 = ? AND log_visit.visitor_returning = ? )",
"bind" => array(1, 'Test', 0));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

public function test_getSelectQuery_whenJoinActionOnVisit()
Expand Down Expand Up @@ -214,7 +214,7 @@ public function test_getSelectQuery_whenJoinActionOnVisit()
) AS log_inner",
"bind" => array(1, 'Test', 0));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

public function test_getSelectQuery_whenJoinConversionOnAction()
Expand Down Expand Up @@ -242,7 +242,7 @@ public function test_getSelectQuery_whenJoinConversionOnAction()
( log_link_visit_action.custom_var_k1 = ? AND log_conversion.idgoal = ? AND log_link_visit_action.custom_var_k2 = ? )",
"bind" => array(1, 'Test', 1, 'Test2'));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

public function test_getSelectQuery_whenJoinActionOnConversion()
Expand Down Expand Up @@ -270,7 +270,7 @@ public function test_getSelectQuery_whenJoinActionOnConversion()
( ( log_conversion.idgoal IS NULL OR log_conversion.idgoal <> ? ) AND log_link_visit_action.custom_var_k1 = ? AND log_conversion.idgoal = ? )",
"bind" => array(1, 2, 'Test', 1));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

public function test_getSelectQuery_whenJoinConversionOnVisit()
Expand Down Expand Up @@ -305,7 +305,7 @@ public function test_getSelectQuery_whenJoinConversionOnVisit()
) AS log_inner",
"bind" => array(1, 1));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

public function test_getSelectQuery_whenJoinConversionOnly()
Expand All @@ -332,7 +332,7 @@ public function test_getSelectQuery_whenJoinConversionOnly()
( log_conversion.idgoal = ? )",
"bind" => array(1, 1));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

public function test_getSelectQuery_whenJoinVisitOnConversion()
Expand Down Expand Up @@ -360,7 +360,7 @@ public function test_getSelectQuery_whenJoinVisitOnConversion()
( (log_conversion.idgoal = ? OR HOUR(log_visit.visit_last_action_time) = ? ))",
"bind" => array(1, 1, 12));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

/**
Expand Down Expand Up @@ -391,7 +391,7 @@ public function test_getSelectQuery_whenJoinVisitAndConversionOnAction()
HOUR(log_visit.visit_last_action_time) = ? AND log_conversion.idgoal = ? ",
"bind" => array(12, 1));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

/**
Expand Down Expand Up @@ -429,7 +429,7 @@ public function test_getSelectQuery_whenJoinConversionAndActionOnVisit()
) AS log_inner",
"bind" => array(1, 12, 'Test'));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}

/**
Expand Down Expand Up @@ -477,7 +477,7 @@ public function test_getSelectQuery_whenLimit_innerQueryShouldHaveLimit()
$expected = array(
"sql" => "
SELECT
sum(log_visit.visit_total_time) as sum_visit_length
sum(log_inner.visit_total_time) as sum_visit_length
FROM
(
SELECT
Expand All @@ -496,6 +496,6 @@ public function test_getSelectQuery_whenLimit_innerQueryShouldHaveLimit()
LIMIT 33",
"bind" => array(1, 'Test'));

$this->assertEquals($this->_filterWhitsSpaces($expected), $this->_filterWhitsSpaces($query));
$this->assertEquals($this->_filterWhiteSpaces($expected), $this->_filterWhiteSpaces($query));
}
}

0 comments on commit 966fb42

Please sign in to comment.