summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2013-09-19 22:16:07 +0200
committerFabio Bas <ctrlaltca@gmail.com>2013-09-19 22:16:07 +0200
commit00f34a0260927de7ab05ff7a777a3a9b7cc5004f (patch)
treea8c29e5204601e7de07ec773f2597dee23b58ecf
parentd9fc469530dd70be8dfdf337a525437774629ede (diff)
Ported old I18N tests from simpleunit to phpunit
-rw-r--r--tests/simple_unit/I18N/CultureInfoTest.php13
-rwxr-xr-x[-rw-r--r--]tests/simple_unit/runtime/.gitignore0
-rw-r--r--tests/unit/I18N/core/ChoiceFormatTest.php (renamed from tests/simple_unit/I18N/ChoiceFormatTest.php)33
-rw-r--r--tests/unit/I18N/core/CultureInfoTest.php6
4 files changed, 24 insertions, 28 deletions
diff --git a/tests/simple_unit/I18N/CultureInfoTest.php b/tests/simple_unit/I18N/CultureInfoTest.php
deleted file mode 100644
index 7df7deeb..00000000
--- a/tests/simple_unit/I18N/CultureInfoTest.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-Prado::using('System.I18N.core.*');
-class CultureInfoTest extends UnitTestCase
-{
- function test_missing_english_names_returns_culture_code()
- {
- $culture = new CultureInfo('iw');
- $this->assertEqual($culture->getEnglishName(), 'iw');
- }
-}
-
-?> \ No newline at end of file
diff --git a/tests/simple_unit/runtime/.gitignore b/tests/simple_unit/runtime/.gitignore
index d6b7ef32..d6b7ef32 100644..100755
--- a/tests/simple_unit/runtime/.gitignore
+++ b/tests/simple_unit/runtime/.gitignore
diff --git a/tests/simple_unit/I18N/ChoiceFormatTest.php b/tests/unit/I18N/core/ChoiceFormatTest.php
index 809d46b4..ef397e05 100644
--- a/tests/simple_unit/I18N/ChoiceFormatTest.php
+++ b/tests/unit/I18N/core/ChoiceFormatTest.php
@@ -2,7 +2,10 @@
Prado::using('System.I18N.core.ChoiceFormat');
-class ChoiceFormatTest extends UnitTestCase
+/**
+ * @package System.I18N.core
+ */
+class ChoiceFormatTest extends PHPUnit_Framework_TestCase
{
function testChoices()
{
@@ -10,20 +13,20 @@ class ChoiceFormatTest extends UnitTestCase
$string = '[0] are no files |[1] is one file |(1,Inf] are {number} files';
$want = 'are no files';
- $this->assertEqual($want, $choice->format($string, 0));
+ $this->assertEquals($want, $choice->format($string, 0));
$want = 'is one file';
- $this->assertEqual($want, $choice->format($string, 1));
+ $this->assertEquals($want, $choice->format($string, 1));
$want = 'are {number} files';
- $this->assertEqual($want, $choice->format($string, 5));
+ $this->assertEquals($want, $choice->format($string, 5));
$this->assertFalse($choice->format($string, -1));
$string = '{1,2} one two |{3,4} three four |[2,5] two to five inclusive';
- $this->assertEqual($choice->format($string,1),'one two');
- $this->assertEqual($choice->format($string,2.1),'two to five inclusive');
- $this->assertEqual($choice->format($string,3),'three four');
+ $this->assertEquals($choice->format($string,1),'one two');
+ $this->assertEquals($choice->format($string,2.1),'two to five inclusive');
+ $this->assertEquals($choice->format($string,3),'three four');
}
function test_set_notation()
@@ -32,13 +35,13 @@ class ChoiceFormatTest extends UnitTestCase
$string = '{n: n%2 == 0} are even numbers |{n: n >= 5} are not even and greater than or equal to 5';
$want = 'are even numbers';
- $this->assertEqual($want, $choice->format($string, 0));
- $this->assertEqual($want, $choice->format($string, 2));
- $this->assertEqual($want, $choice->format($string, 4));
- $this->assertNotEqual($want, $choice->format($string, 1));
+ $this->assertEquals($want, $choice->format($string, 0));
+ $this->assertEquals($want, $choice->format($string, 2));
+ $this->assertEquals($want, $choice->format($string, 4));
+ $this->assertNotEquals($want, $choice->format($string, 1));
$want = 'are not even and greater than or equal to 5';
- $this->assertEqual($want, $choice->format($string, 5));
+ $this->assertEquals($want, $choice->format($string, 5));
}
function test_polish()
@@ -53,7 +56,7 @@ class ChoiceFormatTest extends UnitTestCase
foreach($wants as $want => $numbers)
{
foreach($numbers as $n)
- $this->assertEqual($want, $choice->format($string, $n));
+ $this->assertEquals($want, $choice->format($string, $n));
}
}
@@ -72,7 +75,7 @@ class ChoiceFormatTest extends UnitTestCase
foreach($wants as $want => $numbers)
{
foreach($numbers as $n)
- $this->assertEqual($want, $choice->format($string, $n));
+ $this->assertEquals($want, $choice->format($string, $n));
}
}
@@ -90,7 +93,7 @@ class ChoiceFormatTest extends UnitTestCase
foreach($wants as $want => $numbers)
{
foreach($numbers as $n)
- $this->assertEqual($want, $choice->format($string, $n));
+ $this->assertEquals($want, $choice->format($string, $n));
}
}
}
diff --git a/tests/unit/I18N/core/CultureInfoTest.php b/tests/unit/I18N/core/CultureInfoTest.php
index 0a96639f..6c1eda06 100644
--- a/tests/unit/I18N/core/CultureInfoTest.php
+++ b/tests/unit/I18N/core/CultureInfoTest.php
@@ -76,6 +76,12 @@ class CultureInfoTest extends PHPUnit_Framework_TestCase {
"Los Angeles");
$this->assertEquals($culture->TimeZones[1],$zone);
}
+
+ function test_missing_english_names_returns_culture_code()
+ {
+ $culture = new CultureInfo('iw');
+ $this->assertEquals($culture->getEnglishName(), 'iw');
+ }
}
?> \ No newline at end of file