Add a test for Word and LexicalEntry relationships
This commit is contained in:
parent
b329bed0d4
commit
f24df2563a
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\LexicalEntry;
|
||||
use App\Word;
|
||||
use Tests\TestCase;
|
||||
|
||||
class LexicalEntryTest extends TestCase
|
||||
{
|
||||
public function testWordLexicalEntryRelationship()
|
||||
{
|
||||
$lexicalEntry = LexicalEntry::where('id', 'G2041')->with('words')->first();
|
||||
$this->assertNotEmpty($lexicalEntry, 'Must be able to find a valid LexicalEntry');
|
||||
|
||||
$lWord = $lexicalEntry->words[0];
|
||||
|
||||
$word = Word::find($lWord->id);
|
||||
$this->assertNotEmpty($word, 'Must be able to find a matching Word');
|
||||
|
||||
$this->assertEquals($lexicalEntry->words[0], $word);
|
||||
}}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\LexicalEntry;
|
||||
use App\Word;
|
||||
use Tests\TestCase;
|
||||
|
||||
class WordTest extends TestCase
|
||||
{
|
||||
public function testWordLexicalEntryRelationship()
|
||||
{
|
||||
$word = Word::with('lexicalEntry')->first();
|
||||
$this->assertNotEmpty($word, 'Must be able to find a valid word');
|
||||
|
||||
$lexicalEntry = LexicalEntry::find($word->strongs_number);
|
||||
$this->assertNotEmpty($lexicalEntry, 'Must be able to find a matching LexicalEntry');
|
||||
|
||||
$this->assertEquals($word->lexicalEntry, $lexicalEntry);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue