Testing_FIT
[ class tree: Testing_FIT ] [ index: Testing_FIT ] [ all elements ]

Source for file ArithmeticColumnFixture.php

Documentation is available at ArithmeticColumnFixture.php

  1. <?php
  2.  
  3. # Copyright (c) 2002-2005 Cunningham & Cunningham, Inc.
  4. # Released under the terms of the GNU General Public License version 2 or later.
  5. #
  6. # PHP5 translation by Luis A. Floreani <luis.floreani@gmail.com>
  7.  
  8. require_once 'Testing/FIT/Fixture/Column.php';
  9.  
  10. {
  11.     protected $_typeDictionary = array(
  12.         'x' => 'integer',
  13.         'y' => 'integer',
  14.         'plus()' => 'integer',
  15.         'minus()' => 'integer',
  16.         'times()' => 'integer',
  17.         'divide()' => 'integer',
  18.         'floating()' => 'double'
  19.     );
  20.     
  21.     public $x = 0;
  22.     public $y = 0; // not 0 to avoid that getReturnType (for floating() and divide()) throws an Exception
  23.     
  24.     public function plus({
  25.         return intval($this->x + $this->y);
  26.     }
  27.  
  28.     public function minus({
  29.         return intval($this->x - $this->y);
  30.     }
  31.  
  32.     public function times({
  33.         return intval($this->x * $this->y);
  34.     }
  35.  
  36.     public function divide({
  37.         if ($this->y == 0)
  38.             throw new Exception"ArithmeticException: / by zero" );
  39.         return intval($this->x / $this->y);
  40.     }
  41.  
  42.     public function floating({
  43.         if ($this->y == 0)
  44.             throw new Exception"ArithmeticException: / by zero" );
  45.         return floatval($this->x / $this->y);
  46.     }
  47. }
  48. ?>

Documentation generated on Mon, 11 Mar 2019 15:05:05 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.