blob: 25afa724ec870374c58558b3a1a471e1faca639c (
plain)
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
|
<?php
namespace Elastica\Test\Filter;
use Elastica\Filter\Exists;
use Elastica\Test\Base as BaseTest;
class ExistsTest extends BaseTest
{
/**
* @group unit
*/
public function testToArray()
{
$field = 'test';
$filter = new Exists($field);
$expectedArray = array('exists' => array('field' => $field));
$this->assertEquals($expectedArray, $filter->toArray());
}
/**
* @group unit
*/
public function testSetField()
{
$field = 'test';
$filter = new Exists($field);
$this->assertEquals($field, $filter->getParam('field'));
$newField = 'hello world';
$this->assertInstanceOf('Elastica\Filter\Exists', $filter->setField($newField));
$this->assertEquals($newField, $filter->getParam('field'));
}
}
|