mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 10:11:38 +09:00
Add unit test + 통합검색 키워드 글자 수 제한 변경
This commit is contained in:
parent
96fde908ba
commit
3ff91018cc
3 changed files with 40 additions and 2 deletions
|
|
@ -115,9 +115,9 @@ class integration_searchView extends integration_search
|
|||
// Set a variable for search keyword
|
||||
$is_keyword = Context::get('is_keyword');
|
||||
$is_keyword = escape(trim(utf8_normalize_spaces($is_keyword)));
|
||||
if (mb_strlen($is_keyword, 'UTF-8') > 40)
|
||||
if (mb_strlen($is_keyword, 'UTF-8') > 250)
|
||||
{
|
||||
$is_keyword = mb_substr($is_keyword, 0, 40);
|
||||
$is_keyword = mb_substr($is_keyword, 0, 250);
|
||||
}
|
||||
|
||||
// Set page variables
|
||||
|
|
|
|||
24
tests/_data/dbquery/selectTest3.xml
Normal file
24
tests/_data/dbquery/selectTest3.xml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<query id="selectTest3" action="select">
|
||||
<tables>
|
||||
<table name="documents" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<group pipe="and">
|
||||
<condition operation="more" column="list_order" var="division" pipe="and" />
|
||||
<condition operation="below" column="list_order" var="last_division" pipe="and" />
|
||||
</group>
|
||||
<group pipe="and">
|
||||
<condition operation="search" column="title" var="s_title" />
|
||||
<condition operation="search" column="content" var="s_content" pipe="or" />
|
||||
</group>
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="list_order" order="order_type" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
|
|
@ -70,6 +70,20 @@ class DBQueryParserTest extends \Codeception\TestCase\Test
|
|||
$this->assertEquals([20, '20201021'], $params);
|
||||
}
|
||||
|
||||
public function testSelectWithSearch()
|
||||
{
|
||||
$query = Rhymix\Framework\Parsers\DBQueryParser::loadXML(\RX_BASEDIR . 'tests/_data/dbquery/selectTest3.xml');
|
||||
$args = array('division' => 1234, 'last_division' => 4567, 's_title' => '"I love you" -"I hate you"', 's_content' => '"I love you" -"I hate you"', 'page' => 3);
|
||||
$sql = $query->getQueryString('rx_', $args);
|
||||
$params = $query->getQueryParams();
|
||||
|
||||
$this->assertEquals('SELECT DISTINCT * FROM `rx_documents` AS `documents` ' .
|
||||
'WHERE (`list_order` >= ? AND `list_order` < ?) AND ' .
|
||||
'((`title` LIKE ? AND `title` NOT LIKE ?) OR (`content` LIKE ? AND `content` NOT LIKE ?)) AND ' .
|
||||
'ORDER BY `list_order` ASC LIMIT 40, 20', $sql);
|
||||
$this->assertEquals(['1234', '4567', 'I love you', 'I hate you', 'I love you', 'I hate you'], $params);
|
||||
}
|
||||
|
||||
public function testJoin1()
|
||||
{
|
||||
$query = Rhymix\Framework\Parsers\DBQueryParser::loadXML(\RX_BASEDIR . 'tests/_data/dbquery/selectJoinTest1.xml');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue