Login   Register  
PHP Classes
elePHPant
Icontem

File: Test/CurrencyTest.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  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: 2013-12-20 13:08
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($expectedtrim($this -> object ->Eg($param)));
    }

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

    }

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

 }
    

}