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

Source for file Exception.php

Documentation is available at Exception.php

  1. <?php
  2. /**
  3.  * Services_Yahoo Exception Unit Tests
  4.  *
  5.  * Copyright 2005-2006 Martin Jansen
  6.  *
  7.  * Licensed under the Apache License, Version 2.0 (the "License");
  8.  * you may not use this file except in compliance with the License.
  9.  * You may obtain a copy of the License at
  10.  *
  11.  *     http://www.apache.org/licenses/LICENSE-2.0
  12.  *
  13.  * Unless required by applicable law or agreed to in writing, software
  14.  * distributed under the License is distributed on an "AS IS" BASIS,
  15.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16.  * See the License for the specific language governing permissions and
  17.  * limitations under the License.
  18.  *
  19.  * @category   Services
  20.  * @package    Services_Yahoo
  21.  * @author     Martin Jansen <mj@php.net>
  22.  * @copyright  2005-2006 Martin Jansen
  23.  * @license    http://www.apache.org/licenses/LICENSE-2.0  Apache License, Version 2.0
  24.  * @version    CVS: $Id: Exception.php,v 1.1 2006/10/04 16:30:11 mj Exp $
  25.  * @link       http://pear.php.net/package/Services_Yahoo
  26.  */
  27.  
  28. require_once "PHPUnit/Framework/TestCase.php";
  29. require_once "Services/Yahoo/Exception.php";
  30.  
  31. /**
  32.  * @category   Services
  33.  * @package    Services_Yahoo
  34.  * @author     Martin Jansen <mj@php.net>
  35.  * @copyright  2005-2006 Martin Jansen
  36.  * @license    http://www.apache.org/licenses/LICENSE-2.0  Apache License, Version 2.0
  37.  * @version    CVS: $Id: Exception.php,v 1.1 2006/10/04 16:30:11 mj Exp $
  38.  */
  39. class Services_Yahoo_Tests_Exception extends PHPUnit_Framework_TestCase {
  40.  
  41.     public function setUp({
  42.         $this->= new Services_Yahoo_Exception("exception text");
  43.     }
  44.  
  45.     public function testInheritance({
  46.         $this->assertType("Exception"$this->e);
  47.         $this->assertType("PEAR_Exception"$this->e);
  48.     }
  49.  
  50.     public function getErrors({
  51.         $this->assertEquals($this->e->getErrors()array());
  52.     }
  53.  
  54.     public function testAddError1({
  55.         $this->e->addError("message text");
  56.         $this->assertEquals($this->e->getErrors()array("message text"));
  57.     }
  58.  
  59.     public function testAddError2({
  60.         $this->e->addError("message text 1");
  61.         $this->e->addError("message text 2");
  62.         $this->assertEquals($this->e->getErrors()array("message text 1""message text 2"));
  63.     }
  64.  
  65.     public function testAddErrors({
  66.         $this->e->addErrors(array("message text 1""message text 2"));
  67.         $this->assertEquals($this->e->getErrors()array("message text 1""message text 2"));
  68.     }
  69.  
  70.     public function testHasErrors1({
  71.         $this->assertFalse($this->e->hasErrors());
  72.     }
  73.  
  74.     public function testHasErrors2({
  75.         $this->e->addError("message text");
  76.         $this->assertTrue($this->e->hasErrors());
  77.     }
  78.  
  79.     public function testHasErrors3({
  80.         $this->e->addErrors(array("message text 1""message text 2"));
  81.         $this->assertTrue($this->e->hasErrors());
  82.     }
  83. }

Documentation generated on Fri, 20 Apr 2007 14:30:05 -0400 by phpDocumentor 1.3.0. PEAR Logo Copyright © PHP Group 2004.