-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php namespace DocLister\Tests\DL\Filters; | ||
|
||
use DocLister\Tests\DL\DLAbstract; | ||
|
||
class Issue333Test extends DLAbstract | ||
{ | ||
/** | ||
* @see: https://github.com/AgelxNash/DocLister/issues/333 | ||
*/ | ||
public function testA() | ||
{ | ||
$method = $this->getMethod($this->DL, 'getFilters'); | ||
$filters = $method->invoke($this->DL, 'testA:is:no'); | ||
|
||
$this->assertEquals(false, $filters); | ||
} | ||
|
||
|
||
public function testB() | ||
{ | ||
$out = array( | ||
'join' => 'LEFT JOIN site_tmplvar_contentvalues as `dltv_testA_1` ON `dltv_testA_1`.`contentid`=`c`.`id` AND `dltv_testA_1`.`tmplvarid`=1', | ||
'where' => "(`dltv_testA_1`.`value` = 'no ')" | ||
); | ||
|
||
$method = $this->getMethod($this->DL, 'getFilters'); | ||
$filters = $method->invoke($this->DL, 'AND( tv:testA:is:no )'); | ||
|
||
$this->assertEquals($out, $filters); | ||
} | ||
|
||
public function testC() | ||
{ | ||
$out = array( | ||
'join' => 'LEFT JOIN site_tmplvar_contentvalues as `dltv_testA_1` ON `dltv_testA_1`.`contentid`=`c`.`id` AND `dltv_testA_1`.`tmplvarid`=1', | ||
'where' => "(`dltv_testA_1`.`value` = 'no')" | ||
); | ||
|
||
$method = $this->getMethod($this->DL, 'getFilters'); | ||
$filters = $method->invoke($this->DL, 'AND( tv:testA:is:no; )'); | ||
|
||
$this->assertEquals($out, $filters); | ||
} | ||
|
||
public function testD() | ||
{ | ||
$out = array( | ||
'join' => 'LEFT JOIN site_tmplvar_contentvalues as `dltv_testA_2` ON `dltv_testA_2`.`contentid`=`c`.`id` AND `dltv_testA_2`.`tmplvarid`=1 LEFT JOIN site_tmplvars as `d_dltv_testA_2` on `d_dltv_testA_2`.`id` = 1 LEFT JOIN site_tmplvar_contentvalues as `dltv_testB_1` ON `dltv_testB_1`.`contentid`=`c`.`id` AND `dltv_testB_1`.`tmplvarid`=2', | ||
'where' => "(IFNULL(`dltv_testA_2`.`value`, `d_dltv_testA_2`.`default_text`) = 'no ' AND `dltv_testB_1`.`value` = 'yes')" | ||
); | ||
|
||
$method = $this->getMethod($this->DL, 'getFilters'); | ||
$filters = $method->invoke($this->DL, 'AND( tvd:testA:is:no ; tv:testB:is:yes; )'); | ||
|
||
$this->assertEquals($out, $filters); | ||
} | ||
} |