Overview

Packages

  • Jyxo_Beholder
  • Jyxo_Charset
  • Jyxo_Color
  • Jyxo_Css
  • Jyxo_ErrorHandling
  • Jyxo_FirePhp
  • Jyxo_Gettext
    • Parser
  • Jyxo_Html
  • Jyxo_Input
    • Chain
    • Filter
    • Validator
  • Jyxo_Mail
    • Email
    • Parser
    • Sender
  • Jyxo_Rpc
    • Json
    • Xml
  • Jyxo_Shell
  • Jyxo_SpamFilter
  • Jyxo_Spl
  • Jyxo_String
  • Jyxo_Svn
  • Jyxo_Time
  • Jyxo_Timer
  • Jyxo_Webdav
  • Jyxo_XmlReader
  • PHP

Classes

  • Jyxo_Beholder_Executor
  • Jyxo_Beholder_Result
  • Jyxo_Beholder_TestCase
  • Jyxo_Beholder_TestCase_FileSystem
  • Jyxo_Beholder_TestCase_HttpResponse
  • Jyxo_Beholder_TestCase_Imap
  • Jyxo_Beholder_TestCase_JsonRpc
  • Jyxo_Beholder_TestCase_Memcached
  • Jyxo_Beholder_TestCase_Mysql
  • Jyxo_Beholder_TestCase_Pgsql
  • Jyxo_Beholder_TestCase_PhpExtension
  • Jyxo_Beholder_TestCase_PhpVersion
  • Jyxo_Beholder_TestCase_PhpZend
  • Jyxo_Beholder_TestCase_Smtp
  • Jyxo_Beholder_TestCase_Webdav
  • Jyxo_Beholder_TestCase_XmlRpc
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  1: <?php
  2: 
  3: /**
  4:  * Jyxo PHP Library
  5:  *
  6:  * LICENSE
  7:  *
  8:  * This source file is subject to the new BSD license that is bundled
  9:  * with this package in the file license.txt.
 10:  * It is also available through the world-wide-web at this URL:
 11:  * https://github.com/jyxo/php/blob/master/license.txt
 12:  */
 13: 
 14: /**
 15:  * Tests Zend Framework availability and optionally its version.
 16:  *
 17:  * @category Jyxo
 18:  * @package Jyxo_Beholder
 19:  * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
 20:  * @license https://github.com/jyxo/php/blob/master/license.txt
 21:  * @author Jaroslav HanslĂ­k
 22:  */
 23: class Jyxo_Beholder_TestCase_PhpZend extends Jyxo_Beholder_TestCase
 24: {
 25:     /**
 26:      * Required version.
 27:      *
 28:      * @var string
 29:      */
 30:     private $version;
 31: 
 32:     /**
 33:      * Comparison operator: <, >, =, <=, >=.
 34:      *
 35:      * @var string
 36:      */
 37:     private $comparison;
 38: 
 39:     /**
 40:      * Constructor.
 41:      *
 42:      * @param string $description Test description
 43:      * @param string $version Required version
 44:      * @param string $comparison Comparison operator
 45:      */
 46:     public function __construct($description, $version = '', $comparison = '=')
 47:     {
 48:         parent::__construct($description);
 49: 
 50:         $this->version = (string) $version;
 51:         $this->comparison = (string) $comparison;
 52:     }
 53: 
 54:     /**
 55:      * Performs the test.
 56:      *
 57:      * @return Jyxo_Beholder_Result
 58:      */
 59:     public function run()
 60:     {
 61:         // Zend Framework availability
 62:         if (!class_exists('Zend_Version')) {
 63:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::FAILURE, 'Zend framework missing');
 64:         }
 65: 
 66:         $result = Jyxo_Beholder_Result::SUCCESS;
 67: 
 68:         // Version comparison if requested
 69: 
 70:         if (!empty($this->version)) {
 71: 
 72:             $comparison = Zend_Version::compareVersion($this->version);
 73: 
 74:             switch ($this->comparison) {
 75:                 case '<':
 76:                     $result = ($comparison > 0) ? Jyxo_Beholder_Result::SUCCESS : Jyxo_Beholder_Result::FAILURE;
 77:                     break;
 78: 
 79:                 case '<=':
 80:                     $result = ($comparison >= 0) ? Jyxo_Beholder_Result::SUCCESS : Jyxo_Beholder_Result::FAILURE;
 81:                     break;
 82: 
 83:                 case '>=':
 84:                     $result = ($comparison <= 0) ? Jyxo_Beholder_Result::SUCCESS : Jyxo_Beholder_Result::FAILURE;
 85:                     break;
 86: 
 87:                 case '>':
 88:                     $result = ($comparison < 0) ? Jyxo_Beholder_Result::SUCCESS : Jyxo_Beholder_Result::FAILURE;
 89:                     break;
 90: 
 91:                 default:
 92:                     $this->comparison = '=';
 93:                     $result = ($comparison === 0) ? Jyxo_Beholder_Result::SUCCESS : Jyxo_Beholder_Result::FAILURE;
 94:                     break;
 95:             }
 96: 
 97:             return new Jyxo_Beholder_Result($result, sprintf('Version %s, expected %s %s', Zend_Version::VERSION, $this->comparison, $this->version));
 98: 
 99:         }
100: 
101:         // OK
102:         return new Jyxo_Beholder_Result($result, sprintf('Version %s', Zend_Version::VERSION));
103:     }
104: }
105: 
Jyxo PHP Library API documentation generated by ApiGen 2.3.0