Code Search for Developers
 
 
  

compatibility_test.php from Brim at Krugle


Show compatibility_test.php syntax highlighted

<?php
    // $Id: compatibility_test.php 1175 2006-03-16 09:53:09Z barrel $
    require_once(dirname(__FILE__) . '/../compatibility.php');
    
    class ComparisonClass {
    }
    
    class ComparisonSubclass extends ComparisonClass {
    }
    
    if (version_compare(phpversion(), '5') >= 0) {
        eval('interface ComparisonInterface { }');
        eval('class ComparisonClassWithInterface implements ComparisonInterface { }');
    }
    
    class TestOfCompatibility extends UnitTestCase {
        
        function testIsA() {
            $this->assertTrue(SimpleTestCompatibility::isA(
                    new ComparisonClass(),
                    'ComparisonClass'));
            $this->assertFalse(SimpleTestCompatibility::isA(
                    new ComparisonClass(),
                    'ComparisonSubclass'));
            $this->assertTrue(SimpleTestCompatibility::isA(
                    new ComparisonSubclass(),
                    'ComparisonClass'));
        }
        
        function testIdentityOfObjects() {
            $object1 = new ComparisonClass();
            $object2 = new ComparisonClass();
            $this->assertIdentical($object1, $object2);
        }
        
        function testReferences () {
            $thing = "Hello";
            $thing_reference = &$thing;
            $thing_copy = $thing;
            $this->assertTrue(SimpleTestCompatibility::isReference(
                    $thing,
                    $thing));
            $this->assertTrue(SimpleTestCompatibility::isReference(
                    $thing,
                    $thing_reference));
            $this->assertFalse(SimpleTestCompatibility::isReference(
                    $thing,
                    $thing_copy));
        }
        
        function testObjectReferences () {
            $object = &new ComparisonClass();
            $object_reference = &$object;
            $object_copy = new ComparisonClass();
            $object_assignment = $object;
            $this->assertTrue(SimpleTestCompatibility::isReference(
                    $object,
                    $object));
            $this->assertTrue(SimpleTestCompatibility::isReference(
                    $object,
                    $object_reference));
            $this->assertFalse(SimpleTestCompatibility::isReference(
                    $object,
                    $object_copy));
            if (version_compare(phpversion(), '5', '>=')) {
                $this->assertTrue(SimpleTestCompatibility::isReference(
                        $object,
                        $object_assignment));
            } else {
                $this->assertFalse(SimpleTestCompatibility::isReference(
                        $object,
                        $object_assignment));
            }
        }
        
        function testInteraceComparison() {
            if (version_compare(phpversion(), '5', '<')) {
                return;
            }
            
            $object = new ComparisonClassWithInterface();
            $this->assertFalse(SimpleTestCompatibility::isA(
                    new ComparisonClass(),
                    'ComparisonInterface'));
            $this->assertTrue(SimpleTestCompatibility::isA(
                    new ComparisonClassWithInterface(),
                    'ComparisonInterface'));
        }
    }
?>



See more files for this project here

Brim

BRIM is a MVC framework, written in PHP and based on items with a hierarchical relationship. The list of plugins make BRIM a Information Manager with plugins like bookmarks, a calendar, contacts tasks, notes, RSS etc. The application is multilingual.

Project homepage: http://sourceforge.net/projects/brim
Programming language(s): JavaScript,PHP,SQL
License: other

  acceptance_test.php
  adapter_test.php
  all_tests.php
  authentication_test.php
  browser_test.php
  collector_test.php
  compatibility_test.php
  cookies_test.php
  detached_test.php
  dumper_test.php
  encoding_test.php
  errors_test.php
  expectation_test.php
  form_test.php
  frames_test.php
  http_test.php
  index.php
  interfaces_test.php
  live_test.php
  mock_objects_test.php
  options_test.php
  page_test.php
  parse_error_test.php
  parser_test.php
  real_sites_test.php
  reflection_php4_test.php
  remote_test.php
  shell_test.php
  shell_tester_test.php
  simple_mock_test.php
  simpletest_test.php
  socket_test.php
  tag_test.php
  test_groups.php
  test_with_parse_error.php
  unit_tester_test.php
  unit_tests.php
  url_test.php
  user_agent_test.php
  visual_test.php
  web_tester_test.php
  xml_test.php