Skip to content

Commit 0cbfcbf

Browse files
committed
Some more very basic tests.
1 parent 02350af commit 0cbfcbf

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

src/ElasticquentInterface.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ public function getIndexedDocument();
115115
*/
116116
function getBasicEsParams($getIdIfPossible = true);
117117

118+
/**
119+
* Is Elasticsearch Document
120+
*
121+
* Is the data in this module sourced
122+
* from an Elasticsearch document source?
123+
*
124+
* @return bool
125+
*/
126+
public function isDocument();
127+
128+
/**
129+
* Get Document Score
130+
*
131+
* @return null|float
132+
*/
133+
public function documentScore();
134+
118135
/**
119136
* Put Mapping
120137
*

src/ElasticquentTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function isDocument()
160160
}
161161

162162
/**
163-
* Get Score
163+
* Get Document Score
164164
*
165165
* @return null|float
166166
*/

tests/ElasticquentTraitTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public function testMappingSetup()
5757

5858
/**
5959
* Test Index Document Data
60-
*
61-
* @return void
6260
*/
6361
public function testIndexDocumentData()
6462
{
@@ -74,6 +72,17 @@ public function testIndexDocumentData()
7472
array('foo' => 'bar'), $custom->getIndexDocumentData());
7573
}
7674

75+
/**
76+
* Test Document Null States
77+
*/
78+
public function testDocumentNullStates()
79+
{
80+
$model = $this->testingModel();
81+
82+
$this->assertFalse($model->isDocument());
83+
$this->assertNull($model->documentScore());
84+
}
85+
7786
}
7887

7988
class TestModel extends Eloquent implements \Elasticquent\ElasticquentInterface {

0 commit comments

Comments
 (0)