Skip to content

Commit

Permalink
Add unit test and documentation about this new method
Browse files Browse the repository at this point in the history
  • Loading branch information
defro committed Nov 7, 2018
1 parent af100ae commit 9c5a18f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Expand Up @@ -60,6 +60,10 @@ echo $iso->nativeByCode3('eng'); // English
echo $iso->nativeByCode3('ind'); // Bahasa Indonesia
echo $iso->nativeByCode3('jav'); // basa Jawa

// Get language array from ISO-639-2b code
echo $iso->getLanguageByIsoCode2b('eng'); // ['en', 'eng', 'eng', 'eng', 'English', 'English']
echo $iso->getLanguageByIsoCode2b('ind'); // ['id', 'ind', 'ind', 'ind', 'Indonesian', 'Bahasa Indonesia']
echo $iso->getLanguageByIsoCode2b('jav'); // ['jv', 'jav', 'jav', 'jav', 'Javanese', 'basa Jawa']
```

## To Do
Expand Down
13 changes: 13 additions & 0 deletions tests/ISO639Test.php
Expand Up @@ -236,4 +236,17 @@ public function testISO6393Language()
$this->assertSame('msa', $this->iso->code3ByLanguage('Malay'));
$this->assertSame('sun', $this->iso->code3ByLanguage('Sundanese'));
}

public function testGetLanguageByIsoCode2B()
{
$result = ['en', 'eng', 'eng', 'eng', 'English', 'English'];
$this->assertSame($result, $this->iso->getLanguageByIsoCode2b('eng'));
$result = ['fr', 'fra', 'fre', 'fra', 'French', 'français, langue française'];
$this->assertSame($result, $this->iso->getLanguageByIsoCode2b('fre'));
$result = ['id', 'ind', 'ind', 'ind', 'Indonesian', 'Bahasa Indonesia'];
$this->assertSame($result, $this->iso->getLanguageByIsoCode2b('ind'));

$this->assertNull($this->iso->getLanguageByIsoCode2b('null'));
}

}

0 comments on commit 9c5a18f

Please sign in to comment.