Browse Source

Fix up version checks for skipIfs.

mscherer 9 years ago
parent
commit
c562e5df76

+ 1 - 1
Test/Case/Lib/Utility/NumberLibTest.php

@@ -259,7 +259,7 @@ class NumberLibTest extends MyCakeTestCase {
 	 * @return void
 	 */
 	public function testCurrencySpacer() {
-		if ((float)Configure::version() < 2.4) {
+		if (version_compare(Configure::version(), '2.4') < 0) {
 			$format = NumberLib::getFormat('GBP');
 			$format['wholeSymbol'] = '£';
 			NumberLib::addFormat('GBP', $format);

+ 3 - 3
Test/Case/Model/Behavior/PasswordableBehaviorTest.php

@@ -475,7 +475,7 @@ class PasswordableBehaviorTest extends CakeTestCase {
 		$options = ['validate' => true, 'fieldList' => ['id', 'name']];
 		$is = $this->User->save(null, $options);
 
-		if ((float)Configure::version() >= 2.5) {
+		if (version_compare(Configure::version(), '2.5') >= 0) {
 			// Validation errors triggered - as expected
 			$this->assertFalse($is);
 			$this->assertSame(['pwd', 'pwd_repeat', 'pwd_current'], array_keys($this->User->validationErrors));
@@ -499,7 +499,7 @@ class PasswordableBehaviorTest extends CakeTestCase {
 	 * @return void
 	 */
 	public function testPasswordHasher() {
-		$this->skipIf((float)Configure::version() < 2.4, 'Needs 2.4 and above');
+		$this->skipIf(version_compare(Configure::version(), '2.4') < 0, 'Needs 2.4 and above');
 
 		$this->User->Behaviors->load('Tools.Passwordable', [
 			'formField' => 'pwd',
@@ -868,4 +868,4 @@ class AuthTestComponent extends AuthComponent {
 
 class ComplexPasswordHasher extends SimplePasswordHasher {
 
-}
+}

+ 1 - 1
Test/Case/Model/Behavior/SluggedBehaviorTest.php

@@ -709,7 +709,7 @@ class SluggedBehaviorTest extends CakeTestCase {
 	 * @return void
 	 */
 	public function testCustomChars() {
-		$this->skipIf((float)Configure::version() < 2.5, 'See https://github.com/cakephp/cakephp/pull/3379');
+		$this->skipIf(version_compare(Configure::version(), '2.5') < 0, 'See https://github.com/cakephp/cakephp/pull/3379');
 
 		$this->Model->Behaviors->unload('Slugged');
 		$this->Model->Behaviors->load('Tools.Slugged', ['mode' => 'ascii']);