-
Notifications
You must be signed in to change notification settings - Fork 420
Expand file tree
/
Copy pathMatchAgainstTest.php
More file actions
56 lines (49 loc) · 2.24 KB
/
Copy pathMatchAgainstTest.php
File metadata and controls
56 lines (49 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace DoctrineExtensions\Tests\Query\Mysql;
use DoctrineExtensions\Tests\Query\MysqlTestCase;
class MatchAgainstTest extends MysqlTestCase
{
public function testMatchAgainst()
{
$this->assertDqlProducesSql(
"SELECT MATCH(blank.id) AGAINST ('3') from DoctrineExtensions\Tests\Entities\Blank AS blank",
"SELECT MATCH (b0_.id) AGAINST ('3') AS sclr_0 FROM Blank b0_"
);
}
public function testMatchAgainstInWhereClause(): void
{
$this->assertDqlProducesSql(
"SELECT blank FROM DoctrineExtensions\Tests\Entities\Blank AS blank WHERE MATCH(blank.id) AGAINST ('3')",
"SELECT b0_.id AS id_0 FROM Blank b0_ WHERE MATCH (b0_.id) AGAINST ('3')"
);
}
public function testMatchAgainstMultipleFields()
{
$this->assertDqlProducesSql(
"SELECT MATCH(post.longitude, post.latitude) AGAINST ('3') from DoctrineExtensions\Tests\Entities\BlogPost AS post",
"SELECT MATCH (b0_.longitude, b0_.latitude) AGAINST ('3') AS sclr_0 FROM BlogPost b0_"
);
}
public function testMatchAgainstInBooleanMode()
{
$this->assertDqlProducesSql(
"SELECT MATCH(blank.id) AGAINST ('+3 -4' BOOLEAN) from DoctrineExtensions\Tests\Entities\Blank AS blank",
"SELECT MATCH (b0_.id) AGAINST ('+3 -4' IN BOOLEAN MODE) AS sclr_0 FROM Blank b0_"
);
$this->assertDqlProducesSql(
"SELECT MATCH(blank.id) AGAINST ('+3 -4' IN BOOLEAN MODE) from DoctrineExtensions\Tests\Entities\Blank AS blank",
"SELECT MATCH (b0_.id) AGAINST ('+3 -4' IN BOOLEAN MODE) AS sclr_0 FROM Blank b0_"
);
}
public function testMatchAgainstWithQueryExpansion()
{
$this->assertDqlProducesSql(
"SELECT MATCH(blank.id) AGAINST ('3' EXPAND) from DoctrineExtensions\Tests\Entities\Blank AS blank",
"SELECT MATCH (b0_.id) AGAINST ('3' WITH QUERY EXPANSION) AS sclr_0 FROM Blank b0_"
);
$this->assertDqlProducesSql(
"SELECT MATCH(blank.id) AGAINST ('3' WITH QUERY EXPANSION) from DoctrineExtensions\Tests\Entities\Blank AS blank",
"SELECT MATCH (b0_.id) AGAINST ('3' WITH QUERY EXPANSION) AS sclr_0 FROM Blank b0_"
);
}
}