Skip to content

Commit

Permalink
more data tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Remo committed Aug 31, 2014
1 parent 91ff8ca commit 63f0ed6
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Number/UnitTest.php
Expand Up @@ -90,6 +90,7 @@ public function providerUnformat()
array(1234, 1234, 'en'),
);
}

/**
* @dataProvider providerUnformat
*/
Expand All @@ -100,4 +101,33 @@ public function testUnformat($result, $value, $locale)
Number::unformat($value, $locale)
);
}

public function testGetAvailableLocales()
{
$locales = \Punic\Data::getAvailableLocales();

// this list isn't static, we assume that something between 280 and 320 locales is okay
$this->assertLessThan(320, count($locales));
$this->assertGreaterThan(280, count($locales));
}

public function providerGuessFullLocale()
{
return array(
array('en-Latn-US', array('en')),
array('it-Latn-IT', array('it')),
array('de-Latn-DE', array('de')),
array('az-Cyrl-AZ', array('az', 'Cyrl')),
);
}

/**
* @dataProvider providerGuessFullLocale
*/
public function testGuessFullLocale($result, $parameters)
{
$locale = call_user_func_array(array('\Punic\Data', 'guessFullLocale'), $parameters);

$this->assertSame($result, $locale);
}
}

0 comments on commit 63f0ed6

Please sign in to comment.