app.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Bernhard Posselt <nukeawhale@gmail.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. class Test_App extends PHPUnit_Framework_TestCase {
  9. public function testIsAppVersionCompatibleSingleOCNumber(){
  10. $oc = array(4);
  11. $app = '4.0';
  12. $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
  13. }
  14. public function testIsAppVersionCompatibleMultipleOCNumber(){
  15. $oc = array(4, 3, 1);
  16. $app = '4.3';
  17. $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
  18. }
  19. public function testIsAppVersionCompatibleSingleNumber(){
  20. $oc = array(4);
  21. $app = '4';
  22. $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
  23. }
  24. public function testIsAppVersionCompatibleSingleAppNumber(){
  25. $oc = array(4, 3);
  26. $app = '4';
  27. $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
  28. }
  29. public function testIsAppVersionCompatibleComplex(){
  30. $oc = array(5, 0, 0);
  31. $app = '4.5.1';
  32. $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
  33. }
  34. public function testIsAppVersionCompatibleShouldFail(){
  35. $oc = array(4, 3, 1);
  36. $app = '4.3.2';
  37. $this->assertFalse(OC_App::isAppVersionCompatible($oc, $app));
  38. }
  39. public function testIsAppVersionCompatibleShouldFailTwoVersionNumbers(){
  40. $oc = array(4, 3, 1);
  41. $app = '4.4';
  42. $this->assertFalse(OC_App::isAppVersionCompatible($oc, $app));
  43. }
  44. public function testIsAppVersionCompatibleShouldWorkForPreAlpha(){
  45. $oc = array(5, 0, 3);
  46. $app = '4.93';
  47. $this->assertTrue(OC_App::isAppVersionCompatible($oc, $app));
  48. }
  49. public function testIsAppVersionCompatibleShouldFailOneVersionNumbers(){
  50. $oc = array(4, 3, 1);
  51. $app = '5';
  52. $this->assertFalse(OC_App::isAppVersionCompatible($oc, $app));
  53. }
  54. }