Setup a test for the LexicalEntryTrait

This commit is contained in:
Leonard Smith 2021-05-19 06:41:16 -05:00
parent de7961b99c
commit 8f477f1e32
1 changed files with 48 additions and 0 deletions

View File

@ -0,0 +1,48 @@
<?php
namespace Tests\Unit;
use Tests\TestCase;
use App\Handlers\LexiconEntryTrait;
/**
* LexicalEntryTraitTest.php
*
* @author: Leonard Smith <leonard@acornwebconsultants.com>
* Date: 5/19/21
* Time: 6:10 AM
*/
class LexicalEntryTraitTest extends TestCase
{
public function testThatParseEntryReturnsCorrectlyFormattedVariables()
{
$testEntry = <<<DOC
# ἀγανακτέω/aganakteō
This word describes a situation or how something is. It is a verb. However, it is not an action.
* This word means to be indignant. That is, a person is angry. When someone is indignant, it is because another person did something wrong to them or insulted them.
**Advice to translators**: This type of verb describes a state of being.
DOC;
$testLemma = "ἀγανακτέω/aganakteō";
$testCommentary = <<<DOC
This word describes a situation or how something is. It is a verb. However, it is not an action.
* This word means to be indignant. That is, a person is angry. When someone is indignant, it is because another person did something wrong to them or insulted them.
**Advice to translators**: This type of verb describes a state of being.
DOC;
$handler = new TestHandler();
list($lemma, $commentary) = $handler->parseEntry($testEntry);
$this->assertEquals($testLemma, $lemma);
$this->assertEquals($testCommentary, $commentary);
}
}
class TestHandler
{
use LexiconEntryTrait;
}