diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 70368a4a37b620ba16d2cfaa9826a599fc0c496e..0e4ca0113bb97da55d6a65bc703b21b857d0b3bd 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -696,7 +696,7 @@ function dol_format_address($object)
 		$ret .= ($ret ? "\n" : '' ).$object->town;
 		if ($object->state && in_array($object->country_code,$countriesusingstate))
 		{
-			$ret.=", ".$object->departement;
+			$ret.=", ".$object->state;
 		}
 		if ($object->zip) $ret .= ', '.$object->zip;
 	}
@@ -705,7 +705,7 @@ function dol_format_address($object)
 		$ret .= ($ret ? "\n" : '' ).$object->town;
 		if ($object->state && in_array($object->country_code,$countriesusingstate))
 		{
-			$ret.=", ".$object->departement;
+			$ret.=", ".$object->state;
 		}
 		if ($object->zip) $ret .= ($ret ? "\n" : '' ).$object->zip;
 	}
diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php
index 8b2d9284824bc53e05b7c831b55c311bc51c9636..d978b2cc59dfba7dca6a493f3cd5e9d3c6d24ddd 100644
--- a/htdocs/societe/class/societe.class.php
+++ b/htdocs/societe/class/societe.class.php
@@ -2537,8 +2537,12 @@ class Societe extends CommonObject
         $this->name = 'THIRDPARTY SPECIMEN '.dol_print_date($now,'dayhourlog');
         $this->nom = $this->name;   // For backward compatibility
         $this->specimen=1;
+        $this->address='21 jump street';
         $this->zip='99999';
         $this->town='MyTown';
+        $this->state_id=1;
+        $this->state_code='AA';
+        $this->state='MyState';
         $this->country_id=1;
         $this->country_code='FR';
 
diff --git a/test/phpunit/FunctionsTest.php b/test/phpunit/FunctionsTest.php
index 67aee8988a7dc005ec53d7e8d754d30265b9e705..9dc7ff30580aaaacd8d854379d7c1321d3558bdf 100755
--- a/test/phpunit/FunctionsTest.php
+++ b/test/phpunit/FunctionsTest.php
@@ -388,6 +388,35 @@ class FunctionsTest extends PHPUnit_Framework_TestCase
     }
 
 
+    /**
+     * testDolFormatAddress
+     *
+     * @return	void
+     */
+    public function testDolFormatAddress()
+    {
+    	global $conf,$user,$langs,$db;
+		$conf=$this->savconf;
+		$user=$this->savuser;
+		$langs=$this->savlangs;
+		$db=$this->savdb;
+
+		$object=new Societe($db);
+		$object->initAsSpecimen();
+
+		$object->country_code='FR';
+    	$address=dol_format_address($object);
+    	$this->assertEquals("21 jump street\n99999 MyTown",$address);
+
+		$object->country_code='GB';
+    	$address=dol_format_address($object);
+    	$this->assertEquals("21 jump street\nMyTown, MyState\n99999",$address);
+
+		$object->country_code='US';
+    	$address=dol_format_address($object);
+    	$this->assertEquals("21 jump street\nMyTown, MyState, 99999",$address);
+    }
+
     /**
      * testImgPicto
      *