compare_objects_basic1.phpt 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. --TEST--
  2. Test standard 'compare' object handler
  3. --FILE--
  4. <?php
  5. echo "Simple test for standard compare object handler\n";
  6. class class1{}
  7. class class2{}
  8. class class3{
  9. public $aaa;
  10. private $bbb;
  11. protected $ccc;
  12. }
  13. class class4 extends class3{
  14. }
  15. class class5 extends class3{
  16. public $ddd;
  17. private $eee;
  18. }
  19. // Define a bunch of objects all of which will use standard compare object handler
  20. $obj1 = new class1();
  21. $obj2 = new class2();
  22. $obj3 = new class3();
  23. $obj4 = new class4();
  24. $obj5 = new class5();
  25. echo "\n-- The following compare should return TRUE --\n";
  26. var_dump($obj1 == $obj1);
  27. echo "\n-- All the following compares should return FALSE --\n";
  28. var_dump($obj1 == $obj2);
  29. var_dump($obj1 == $obj3);
  30. var_dump($obj1 == $obj4);
  31. var_dump($obj1 == $obj5);
  32. var_dump($obj4 == $obj3);
  33. var_dump($obj5 == $obj3);
  34. ?>
  35. --EXPECT--
  36. Simple test for standard compare object handler
  37. -- The following compare should return TRUE --
  38. bool(true)
  39. -- All the following compares should return FALSE --
  40. bool(false)
  41. bool(false)
  42. bool(false)
  43. bool(false)
  44. bool(false)
  45. bool(false)