Permalink
Browse files

Finished conversion of Zend_Measure to Zend/Measure (unit tests are c…

…onverted).
  • Loading branch information...
1 parent 51cd5dd commit f980751b09f1b8f104875265c94f0bb669f8d840 Alexander Veremyev committed with weierophinney Apr 2, 2010
View
@@ -23,7 +23,7 @@ First pass
[X] Zend_Date
[X] Zend_Translate
[X] Zend_TimeSync
- [ ] Zend_Measure
+ [X] Zend_Measure
[X] Zend_Currency
Second pass:

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -21,12 +21,10 @@
*/
/**
- * Zend_Measure_Current
- */
-
-/**
- * PHPUnit test case
+ * @namespace
*/
+namespace ZendTest\Measure;
+use Zend\Measure;
/**
* @category Zend
@@ -36,16 +34,16 @@
* @license http://framework.zend.com/license/new-bsd New BSD License
* @group Zend_Measure
*/
-class Zend_Measure_CurrentTest extends PHPUnit_Framework_TestCase
+class CurrentTest extends \PHPUnit_Framework_TestCase
{
/**
* test for Current initialisation
* expected instance
*/
public function testCurrentInit()
{
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD,'de');
- $this->assertTrue($value instanceof Zend_Measure_Current,'Zend_Measure_Current Object not returned');
+ $value = new Measure\Current('100',Measure\Current::STANDARD,'de');
+ $this->assertTrue($value instanceof Measure\Current,'Zend\Measure\Current Object not returned');
}
@@ -56,9 +54,9 @@ public function testCurrentInit()
public function testCurrentUnknownType()
{
try {
- $value = new Zend_Measure_Current('100','Current::UNKNOWN','de');
+ $value = new Measure\Current('100','Current::UNKNOWN','de');
$this->fail('Exception expected because of unknown type');
- } catch (Zend_Measure_Exception $e) {
+ } catch (Measure\Exception $e) {
// success
}
}
@@ -71,9 +69,9 @@ public function testCurrentUnknownType()
public function testCurrentUnknownValue()
{
try {
- $value = new Zend_Measure_Current('novalue',Zend_Measure_Current::STANDARD,'de');
+ $value = new Measure\Current('novalue',Measure\Current::STANDARD,'de');
$this->fail('Exception expected because of empty value');
- } catch (Zend_Measure_Exception $e) {
+ } catch (Measure\Exception $e) {
// success
}
}
@@ -86,9 +84,9 @@ public function testCurrentUnknownValue()
public function testCurrentUnknownLocale()
{
try {
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD,'nolocale');
+ $value = new Measure\Current('100',Measure\Current::STANDARD,'nolocale');
$this->fail('Exception expected because of unknown locale');
- } catch (Zend_Measure_Exception $e) {
+ } catch (Measure\Exception $e) {
// success
}
}
@@ -100,8 +98,8 @@ public function testCurrentUnknownLocale()
*/
public function testCurrentNoLocale()
{
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD);
- $this->assertEquals(100, $value->getValue(),'Zend_Measure_Current value expected');
+ $value = new Measure\Current('100',Measure\Current::STANDARD);
+ $this->assertEquals(100, $value->getValue(),'Zend\Measure\Current value expected');
}
@@ -111,8 +109,8 @@ public function testCurrentNoLocale()
*/
public function testCurrentValuePositive()
{
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(100, $value->getValue(), 'Zend_Measure_Current value expected to be a positive integer');
+ $value = new Measure\Current('100',Measure\Current::STANDARD,'de');
+ $this->assertEquals(100, $value->getValue(), 'Zend\Measure\Current value expected to be a positive integer');
}
@@ -122,8 +120,8 @@ public function testCurrentValuePositive()
*/
public function testCurrentValueNegative()
{
- $value = new Zend_Measure_Current('-100',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-100, $value->getValue(), 'Zend_Measure_Current value expected to be a negative integer');
+ $value = new Measure\Current('-100',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-100, $value->getValue(), 'Zend\Measure\Current value expected to be a negative integer');
}
@@ -133,8 +131,8 @@ public function testCurrentValueNegative()
*/
public function testCurrentValueDecimal()
{
- $value = new Zend_Measure_Current('-100,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-100.200, $value->getValue(), 'Zend_Measure_Current value expected to be a decimal value');
+ $value = new Measure\Current('-100,200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-100.200, $value->getValue(), 'Zend\Measure\Current value expected to be a decimal value');
}
@@ -144,8 +142,8 @@ public function testCurrentValueDecimal()
*/
public function testCurrentValueDecimalSeperated()
{
- $value = new Zend_Measure_Current('-100.100,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-100100.200, $value->getValue(),'Zend_Measure_Current Object not returned');
+ $value = new Measure\Current('-100.100,200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-100100.200, $value->getValue(),'Zend\Measure\Current Object not returned');
}
@@ -155,8 +153,8 @@ public function testCurrentValueDecimalSeperated()
*/
public function testCurrentValueString()
{
- $value = new Zend_Measure_Current('-100.100,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-100100.200, $value->getValue(),'Zend_Measure_Current Object not returned');
+ $value = new Measure\Current('-100.100,200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-100100.200, $value->getValue(),'Zend\Measure\Current Object not returned');
}
@@ -166,9 +164,9 @@ public function testCurrentValueString()
*/
public function testCurrentEquality()
{
- $value = new Zend_Measure_Current('-100.100,200',Zend_Measure_Current::STANDARD,'de');
- $newvalue = new Zend_Measure_Current('-100.100,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertTrue($value->equals($newvalue),'Zend_Measure_Current Object should be equal');
+ $value = new Measure\Current('-100.100,200',Measure\Current::STANDARD,'de');
+ $newvalue = new Measure\Current('-100.100,200',Measure\Current::STANDARD,'de');
+ $this->assertTrue($value->equals($newvalue),'Zend\Measure\Current Object should be equal');
}
@@ -178,9 +176,9 @@ public function testCurrentEquality()
*/
public function testCurrentNoEquality()
{
- $value = new Zend_Measure_Current('-100.100,200',Zend_Measure_Current::STANDARD,'de');
- $newvalue = new Zend_Measure_Current('-100,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertFalse($value->equals($newvalue),'Zend_Measure_Current Object should be not equal');
+ $value = new Measure\Current('-100.100,200',Measure\Current::STANDARD,'de');
+ $newvalue = new Measure\Current('-100,200',Measure\Current::STANDARD,'de');
+ $this->assertFalse($value->equals($newvalue),'Zend\Measure\Current Object should be not equal');
}
@@ -190,9 +188,9 @@ public function testCurrentNoEquality()
*/
public function testCurrentSetPositive()
{
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD,'de');
- $value->setValue('200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(200, $value->getValue(), 'Zend_Measure_Current value expected to be a positive integer');
+ $value = new Measure\Current('100',Measure\Current::STANDARD,'de');
+ $value->setValue('200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(200, $value->getValue(), 'Zend\Measure\Current value expected to be a positive integer');
}
@@ -202,9 +200,9 @@ public function testCurrentSetPositive()
*/
public function testCurrentSetNegative()
{
- $value = new Zend_Measure_Current('-100',Zend_Measure_Current::STANDARD,'de');
- $value->setValue('-200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-200, $value->getValue(), 'Zend_Measure_Current value expected to be a negative integer');
+ $value = new Measure\Current('-100',Measure\Current::STANDARD,'de');
+ $value->setValue('-200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-200, $value->getValue(), 'Zend\Measure\Current value expected to be a negative integer');
}
@@ -214,9 +212,9 @@ public function testCurrentSetNegative()
*/
public function testCurrentSetDecimal()
{
- $value = new Zend_Measure_Current('-100,200',Zend_Measure_Current::STANDARD,'de');
- $value->setValue('-200,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-200.200, $value->getValue(), 'Zend_Measure_Current value expected to be a decimal value');
+ $value = new Measure\Current('-100,200',Measure\Current::STANDARD,'de');
+ $value->setValue('-200,200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-200.200, $value->getValue(), 'Zend\Measure\Current value expected to be a decimal value');
}
@@ -226,9 +224,9 @@ public function testCurrentSetDecimal()
*/
public function testCurrentSetDecimalSeperated()
{
- $value = new Zend_Measure_Current('-100.100,200',Zend_Measure_Current::STANDARD,'de');
- $value->setValue('-200.200,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-200200.200, $value->getValue(),'Zend_Measure_Current Object not returned');
+ $value = new Measure\Current('-100.100,200',Measure\Current::STANDARD,'de');
+ $value->setValue('-200.200,200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-200200.200, $value->getValue(),'Zend\Measure\Current Object not returned');
}
@@ -238,9 +236,9 @@ public function testCurrentSetDecimalSeperated()
*/
public function testCurrentSetString()
{
- $value = new Zend_Measure_Current('-100.100,200',Zend_Measure_Current::STANDARD,'de');
- $value->setValue('-200.200,200',Zend_Measure_Current::STANDARD,'de');
- $this->assertEquals(-200200.200, $value->getValue(),'Zend_Measure_Current Object not returned');
+ $value = new Measure\Current('-100.100,200',Measure\Current::STANDARD,'de');
+ $value->setValue('-200.200,200',Measure\Current::STANDARD,'de');
+ $this->assertEquals(-200200.200, $value->getValue(),'Zend\Measure\Current Object not returned');
}
@@ -251,10 +249,10 @@ public function testCurrentSetString()
public function testCurrentSetUnknownType()
{
try {
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD,'de');
+ $value = new Measure\Current('100',Measure\Current::STANDARD,'de');
$value->setValue('-200.200,200','Current::UNKNOWN','de');
$this->fail('Exception expected because of unknown type');
- } catch (Zend_Measure_Exception $e) {
+ } catch (Measure\Exception $e) {
// success
}
}
@@ -267,10 +265,10 @@ public function testCurrentSetUnknownType()
public function testCurrentSetUnknownValue()
{
try {
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD,'de');
- $value->setValue('novalue',Zend_Measure_Current::STANDARD,'de');
+ $value = new Measure\Current('100',Measure\Current::STANDARD,'de');
+ $value->setValue('novalue',Measure\Current::STANDARD,'de');
$this->fail('Exception expected because of empty value');
- } catch (Zend_Measure_Exception $e) {
+ } catch (Measure\Exception $e) {
// success
}
}
@@ -283,10 +281,10 @@ public function testCurrentSetUnknownValue()
public function testCurrentSetUnknownLocale()
{
try {
- $value = new Zend_Measure_Current('100',Zend_Measure_Current::STANDARD,'de');
- $value->setValue('200',Zend_Measure_Current::STANDARD,'nolocale');
+ $value = new Measure\Current('100',Measure\Current::STANDARD,'de');
+ $value->setValue('200',Measure\Current::STANDARD,'nolocale');
$this->fail('Exception expected because of unknown locale');
- } catch (Zend_Measure_Exception $e) {
+ } catch (Measure\Exception $e) {
// success
}
}
@@ -298,9 +296,9 @@ public function testCurrentSetUnknownLocale()
*/
public function testCurrentSetWithNoLocale()
{
- $value = new Zend_Measure_Current('100', Zend_Measure_Current::STANDARD, 'de');
- $value->setValue('200', Zend_Measure_Current::STANDARD);
- $this->assertEquals(200, $value->getValue(), 'Zend_Measure_Current value expected to be a positive integer');
+ $value = new Measure\Current('100', Measure\Current::STANDARD, 'de');
+ $value->setValue('200', Measure\Current::STANDARD);
+ $this->assertEquals(200, $value->getValue(), 'Zend\Measure\Current value expected to be a positive integer');
}
@@ -310,9 +308,9 @@ public function testCurrentSetWithNoLocale()
*/
public function testCurrentSetType()
{
- $value = new Zend_Measure_Current('-100',Zend_Measure_Current::STANDARD,'de');
- $value->setType(Zend_Measure_Current::NANOAMPERE);
- $this->assertEquals(Zend_Measure_Current::NANOAMPERE, $value->getType(), 'Zend_Measure_Current type expected');
+ $value = new Measure\Current('-100',Measure\Current::STANDARD,'de');
+ $value->setType(Measure\Current::NANOAMPERE);
+ $this->assertEquals(Measure\Current::NANOAMPERE, $value->getType(), 'Zend\Measure\Current type expected');
}
@@ -323,10 +321,10 @@ public function testCurrentSetType()
public function testCurrentSetTypeFailed()
{
try {
- $value = new Zend_Measure_Current('-100',Zend_Measure_Current::STANDARD,'de');
+ $value = new Measure\Current('-100',Measure\Current::STANDARD,'de');
$value->setType('Current::UNKNOWN');
$this->fail('Exception expected because of unknown type');
- } catch (Zend_Measure_Exception $e) {
+ } catch (Measure\Exception $e) {
// success
}
}
@@ -338,7 +336,7 @@ public function testCurrentSetTypeFailed()
*/
public function testCurrentToString()
{
- $value = new Zend_Measure_Current('-100',Zend_Measure_Current::STANDARD,'de');
+ $value = new Measure\Current('-100',Measure\Current::STANDARD,'de');
$this->assertEquals('-100 A', $value->toString(), 'Value -100 A expected');
}
@@ -349,7 +347,7 @@ public function testCurrentToString()
*/
public function testCurrent_ToString()
{
- $value = new Zend_Measure_Current('-100',Zend_Measure_Current::STANDARD,'de');
+ $value = new Measure\Current('-100',Measure\Current::STANDARD,'de');
$this->assertEquals('-100 A', $value->__toString(), 'Value -100 A expected');
}
@@ -360,7 +358,7 @@ public function testCurrent_ToString()
*/
public function testCurrentConversionList()
{
- $value = new Zend_Measure_Current('-100',Zend_Measure_Current::STANDARD,'de');
+ $value = new Measure\Current('-100',Measure\Current::STANDARD,'de');
$unit = $value->getConversionList();
$this->assertTrue(is_array($unit), 'Array expected');
}
Oops, something went wrong.

0 comments on commit f980751

Please sign in to comment.