Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add verb() function to Russian language
- Loading branch information
Showing
2 changed files
with
62 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
namespace morphos\test\Russian; | ||
require __DIR__.'/../../vendor/autoload.php'; | ||
|
||
use morphos\Gender; | ||
use morphos\NumeralCreation; | ||
use morphos\Russian\Cases; | ||
use morphos\Russian\CardinalNumeral; | ||
|
||
class FunctionsTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @dataProvider verbsProvider() | ||
*/ | ||
public function testVerb($verb, $gender, $correctVerb) | ||
{ | ||
$this->assertEquals($correctVerb, \morphos\Russian\verb($verb, $gender)); | ||
} | ||
|
||
public function verbsProvider() | ||
{ | ||
return | ||
[ | ||
['попал', Gender::MALE, 'попал'], | ||
['попал', Gender::FEMALE, 'попала'], | ||
['попался', Gender::MALE, 'попался'], | ||
['попался', Gender::FEMALE, 'попалась'], | ||
]; | ||
} | ||
|
||
public function testDetectGender() | ||
{ | ||
$this->assertEquals(Gender::MALE, \morphos\Russian\detectGender('Иванов Петр')); | ||
$this->assertEquals(Gender::FEMALE, \morphos\Russian\detectGender('Мирова Анастасия')); | ||
} | ||
|
||
public function testPluralize() | ||
{ | ||
$this->assertEquals('сообщений', \morphos\Russian\pluralize('сообщение', 10)); | ||
} | ||
} |