NaturalSortByMultiFieldTest

The Contact Form DB NaturalSortByMultiFieldTest class.

Defined (1)

The class is defined in the following location(s).

/phpunit/NaturalSortByMultiFieldTest.php  
  1. class NaturalSortByMultiFieldTest extends PHPUnit_Framework_TestCase { 
  2.  
  3. public function testSort4Deep() { 
  4.  
  5. $sort = new NaturalSortByMultiField('country', 'city', 'start', 'name'); 
  6.  
  7. $this->assertEquals(-1,  
  8. $sort->sort( 
  9. array('country' => 'Germany',  
  10. 'city' => 'Berlin',  
  11. 'start' => '11:00',  
  12. 'name' => 'school 1'),  
  13. array('country' => 'Germany',  
  14. 'city' => 'Berlin',  
  15. 'start' => '11:00',  
  16. 'name' => 'school 2'))); 
  17. $this->assertEquals(1,  
  18. $sort->sort( 
  19. array('country' => 'Germany',  
  20. 'city' => 'Berlin',  
  21. 'start' => '11:00',  
  22. 'name' => 'school 5'),  
  23. array('country' => 'Germany',  
  24. 'city' => 'Berlin',  
  25. 'start' => '11:00',  
  26. 'name' => 'school 2'))); 
  27.  
  28. $this->assertEquals(0,  
  29. $sort->sort( 
  30. array('country' => 'Germany',  
  31. 'city' => 'Berlin',  
  32. 'start' => '11:00',  
  33. 'name' => 'school 5'),  
  34. array('country' => 'Germany',  
  35. 'city' => 'Berlin',  
  36. 'start' => '11:00',  
  37. 'name' => 'school 5'))); 
  38.  
  39. $this->assertEquals(-1,  
  40. $sort->sort( 
  41. array('country' => 'Germany',  
  42. 'city' => 'Berlin',  
  43. 'start' => '11:00',  
  44. 'name' => 'school 09'),  
  45. array('country' => 'Germany',  
  46. 'city' => 'Berlin',  
  47. 'start' => '11:00',  
  48. 'name' => 'school 5'))); 
  49.  
  50. $this->assertEquals(1,  
  51. $sort->sort( 
  52. array('country' => 'Germany',  
  53. 'city' => 'Munich',  
  54. 'start' => '11:00',  
  55. 'name' => 'school 1'),  
  56. array('country' => 'Germany',  
  57. 'city' => 'Berlin',  
  58. 'start' => '11:00',  
  59. 'name' => 'school 2'))); 
  60.