Skip to content

Commit

Permalink
Add initial test for sentence count update
Browse files Browse the repository at this point in the history
  • Loading branch information
jiru committed Nov 14, 2024
1 parent cd0d845 commit 3206771
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/TestCase/Model/Table/VocabularyTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

class VocabularyTableTest extends TestCase
{
use \App\Test\TestCase\SearchMockTrait;

public $fixtures = [
'app.vocabulary',
'app.users_vocabulary',
Expand Down Expand Up @@ -44,6 +46,16 @@ public function testAddItem_withNewVocabulary()
$this->assertEquals(2, $result->id);
}

public function testAddItem_updatesCurrentNumberOfSentences()
{
$this->enableMockedSearch([21, 11, 12], 4);
CurrentUser::store(['id' => 7]);

$result = $this->Vocabulary->addItem('eng', 'hashtag');

$this->assertEquals(4, $result->numSentences);
}

public function testIncrementNumSentences_succeeds()
{
$result = $this->Vocabulary->incrementNumSentences(1, 'This happened out of the blue.');
Expand Down

0 comments on commit 3206771

Please sign in to comment.