PHP Classes

File: Test/CurrencyTest.php

Recommend this page to a friend!
  Classes of Osama Salama   Convert number to text   Test/CurrencyTest.php   Download  
File: Test/CurrencyTest.php
Role: Unit test script
Content type: text/plain
Description: Test class
Class: Convert number to text
Format money amounts for Egypt and Saudi Arabia
Author: By
Last change:
Date: 10 years ago
Size: 1,647 bytes
 

Contents

Class file image Download
<?php

require '../Class.Currency.php';
class
CurrencyTest extends PHPUnit_Framework_TestCase {
   
/**
     * @var Currency
     */
   
protected $object;

   
/**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     */
   
protected function setUp() {
       
$this -> object = new Currency;
    }

   
/**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     */
   
protected function tearDown() {
        unset(
$this -> object);
    }

   
/**
     * @dataProvider EGprovider
     */
   
public function testEg($param, $expected) {

       
$this -> assertEquals($expected, trim($this -> object ->Eg($param)));
    }

    public function
EGprovider() {
       
$val1 = "ثلاثة آلاف و خمسة مائة جنيها فقط لاغير";
       
$val2 = "خمسة مائة وتسعون جنيها و ستون قرشا فقط لاغير ";
        return array( array(
3500, trim($val1)), array(590.60, trim($val2)), );

    }

   
/**
     * @dataProvider SAprovider
     */
   
public function testSa($param, $expected) {
      
$this->assertEquals($expected, trim($this->object ->Sa($param)));
    
    }
      
   
  public function
SAprovider() {
   
$val1 = " ثلاثة آلاف و خمسة مائة ريال فقط لاغير ";
  
$val2 = " خمسة مائة وتسعون ريال و ستون هللة فقط لاغير";
   return array( array(
3500, trim($val1)), array(590.60, trim($val2)), );

 }
   

}