Laurent Destailleur 1 gadu atpakaļ
vecāks
revīzija
557fe235d1

+ 1 - 1
htdocs/core/class/commonobject.class.php

@@ -6156,7 +6156,7 @@ abstract class CommonObject
 
 							//var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]);
 						}
-						if ($extrafields->attributes[$this->table_element]['type'][$key] == 'password') {
+						if (!empty($extrafields->attributes[$this->table_element]['type'][$key]) && $extrafields->attributes[$this->table_element]['type'][$key] == 'password') {
 							if (preg_match('/^dolcrypt:/', $value)) {
 								$this->array_options["options_".$key] = dolDecrypt($value);
 							}

+ 2 - 2
test/phpunit/LangTest.php

@@ -196,11 +196,11 @@ class LangTest extends PHPUnit\Framework\TestCase
 
 			$result=$tmplangs->transnoentitiesnoconv("SeparatorDecimal");
 			print __METHOD__." SeparatorDecimal=".$result."\n";
-			$this->assertContains($result, array('.',',','/',' ','','None'), 'Error on decimal separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
+			$this->assertTrue(in_array($result, array('.',',','/',' ','','None')), 'Error on decimal separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
 
 			$result=$tmplangs->transnoentitiesnoconv("SeparatorThousand");
 			print __METHOD__." SeparatorThousand=".$result."\n";
-			$this->assertContains($result, array('.',',','/',' ','','\'','None','Space'), 'Error on thousand separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
+			$this->assertTrue(in_array($result, array('.',',','/',' ','','\'','None','Space')), 'Error on thousand separator for lang code '.$code);	// Note that ، that is coma for RTL languages is not supported
 
 			// Test java string contains only d,M,y,/,-,. and not m,...
 			$result=$tmplangs->transnoentitiesnoconv("FormatDateShortJava");

+ 4 - 4
test/phpunit/SocieteTest.php

@@ -462,7 +462,7 @@ class SocieteTest extends PHPUnit\Framework\TestCase
 		$localobjectadd->town='New town';
 		$result=$localobjectadd->getFullAddress(1);
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
-		$this->assertContains("New address\nNew zip New town\nFrance", $result);
+		$this->assertStringContainsString("New address\nNew zip New town\nFrance", $result);
 
 		// Belgium
 		unset($localobjectadd->country_code);
@@ -473,7 +473,7 @@ class SocieteTest extends PHPUnit\Framework\TestCase
 		$localobjectadd->town='New town';
 		$result=$localobjectadd->getFullAddress(1);
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
-		$this->assertContains("New address\nNew zip New town\nBelgium", $result);
+		$this->assertStringContainsString("New address\nNew zip New town\nBelgium", $result);
 
 		// Switzerland
 		unset($localobjectadd->country_code);
@@ -484,7 +484,7 @@ class SocieteTest extends PHPUnit\Framework\TestCase
 		$localobjectadd->town='New town';
 		$result=$localobjectadd->getFullAddress(1);
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
-		$this->assertContains("New address\nNew zip New town\nSwitzerland", $result);
+		$this->assertStringContainsString("New address\nNew zip New town\nSwitzerland", $result);
 
 		// USA
 		unset($localobjectadd->country_code);
@@ -496,7 +496,7 @@ class SocieteTest extends PHPUnit\Framework\TestCase
 		$localobjectadd->state='New state';
 		$result=$localobjectadd->getFullAddress(1);
 		print __METHOD__." id=".$localobjectadd->id." result=".$result."\n";
-		$this->assertContains("New address\nNew town, New state, New zip\nUnited States", $result);
+		$this->assertStringContainsString("New address\nNew town, New state, New zip\nUnited States", $result);
 
 		return $localobjectadd->id;
 	}

+ 9 - 9
test/phpunit/functional/InstallTest.php

@@ -104,7 +104,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 	public function testInstallRedirect()
 	{
 		$this->url('/');
-		$this->assertContains('/install/index.php', $this->url());
+		$this->assertStringContainsString('/install/index.php', $this->url());
 	}
 
 	/**
@@ -114,7 +114,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 	 */
 	public function testInstallPageTitle()
 	{
-		$this->assertContains('Dolibarr', $this->title());
+		$this->assertStringContainsString('Dolibarr', $this->title());
 	}
 
 	/**
@@ -126,7 +126,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 	{
 		// FIXME: the button itself should have an ID
 		$this->byId('nextbutton')->byTag('input')->click();
-		$this->assertContains('/install/check.php', $this->url());
+		$this->assertStringContainsString('/install/check.php', $this->url());
 	}
 
 	/**
@@ -145,7 +145,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 		$show_hide_choices->click();
 		$this->assertFalse($unavailable_choices->displayed());
 		$this->byClassName('button')->click();
-		$this->assertContains('/install/fileconf.php', $this->url());
+		$this->assertStringContainsString('/install/fileconf.php', $this->url());
 	}
 
 	/**
@@ -205,7 +205,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 	public function testFormSubmit()
 	{
 		$this->byName('forminstall')->submit();
-		$this->assertContains('/install/step1.php', $this->url());
+		$this->assertStringContainsString('/install/step1.php', $this->url());
 	}
 
 	/**
@@ -221,7 +221,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 		$this->byId('nextbutton')->byTag('input')->click();
 		$time = $start->diff(new DateTimeImmutable());
 		echo "\nPopulating the database took " . $time->format("%s seconds.\n");
-		$this->assertContains('/install/step2.php', $this->url());
+		$this->assertStringContainsString('/install/step2.php', $this->url());
 	}
 
 	/**
@@ -232,7 +232,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 	public function testStep2()
 	{
 		$this->byName('forminstall')->submit();
-		$this->assertContains('/install/step4.php', $this->url());
+		$this->assertStringContainsString('/install/step4.php', $this->url());
 	}
 
 	// There is no step 3
@@ -252,7 +252,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 		$this->byName('pass_verif')->value(self::$dol_admin_pass);
 		// FIXME: the button itself should have an ID
 		$this->byId('nextbutton')->byTag('input')->click();
-		$this->assertContains('/install/step5.php', $this->url());
+		$this->assertStringContainsString('/install/step5.php', $this->url());
 	}
 
 	/**
@@ -264,7 +264,7 @@ class InstallTest extends PHPUnit_Extensions_Selenium2TestCase
 	{
 		// FIXME: this button should have an ID
 		$this->byTag('a')->click();
-		$this->assertContains('/admin/index.php', $this->url());
+		$this->assertStringContainsString('/admin/index.php', $this->url());
 	}
 
 	/**

+ 6 - 6
test/phpunit/functional/TakePosFunctionalTest.php

@@ -192,7 +192,7 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
 		}
 		// Page reloaded, we need a new Xpath
 		$module_status_image = $this->byXPath($module_status_image_path);
-		$this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
+		$this->assertStringContainsString('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
 	}
 
 	/**
@@ -206,7 +206,7 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
 	{
 		$this->url('/custom/takepos/admin/setup.php');
 		$this->authenticate();
-		$this->assertContains('takepos/admin/setup.php', $this->url(), 'Configuration page');
+		$this->assertStringContainsString('takepos/admin/setup.php', $this->url(), 'Configuration page');
 	}
 
 	/**
@@ -220,7 +220,7 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
 	{
 		$this->url('/custom/takepos/admin/about.php');
 		$this->authenticate();
-		$this->assertContains('takepos/admin/about.php', $this->url(), 'About page');
+		$this->assertStringContainsString('takepos/admin/about.php', $this->url(), 'About page');
 	}
 
 	/**
@@ -252,7 +252,7 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
 	{
 		$this->url('/admin/boxes.php');
 		$this->authenticate();
-		$this->assertContains('takeposwidget1', $this->source(), "Box enabled");
+		$this->assertStringContainsString('takeposwidget1', $this->source(), "Box enabled");
 	}
 
 	/**
@@ -266,7 +266,7 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
 	{
 		$this->url('/admin/triggers.php');
 		$this->authenticate();
-		$this->assertContains(
+		$this->assertStringContainsString(
 			'interface_99_modTakePos_TakePosTriggers.class.php',
 			$this->byTag('body')->text(),
 			"Trigger declared"
@@ -284,7 +284,7 @@ class TakePosFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
 	{
 		$this->url('/admin/triggers.php');
 		$this->authenticate();
-		$this->assertContains(
+		$this->assertStringContainsString(
 			'tick.png',
 			$this->byXPath('//td[text()="interface_99_modTakePos_MyTrigger.class.php"]/following::img')->attribute('src'),
 			"Trigger enabled"