Completed
Push — scrutinizer ( 84e9d0...6a9613 )
by Fabio
22:48
created
tests/unit/Security/TUserManagerTest.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  discard block
 block discarded – undo
7 7
  */
8 8
 class TUserManagerTest extends PHPUnit_Framework_TestCase {
9 9
 
10
-	public static $app=null;
11
-	public static $config=null;
10
+	public static $app = null;
11
+	public static $config = null;
12 12
 
13 13
 
14 14
 	public function setUp() {
15 15
 
16
-		if(self::$app === null) {
17
-			self::$app = new TApplication(dirname(__FILE__).'/app');
16
+		if (self::$app === null) {
17
+			self::$app = new TApplication(dirname(__FILE__) . '/app');
18 18
 			prado::setPathofAlias('App', dirname(__FILE__));
19 19
 		}
20 20
 
21 21
 		if (self::$config === null) {
22 22
 			// Simulate a config file
23
-			self::$config=new TXmlDocument('1.0','utf8');
23
+			self::$config = new TXmlDocument('1.0', 'utf8');
24 24
 			self::$config->loadFromString('<users><user name="Joe" password="demo"/><user name="John" password="demo" /><user name="test" password="test" roles="Reader, User"/><role name="Administrator" users="John" /><role name="Writer" users="Joe, John" /></users>');
25 25
 		}
26 26
 	}
@@ -29,66 +29,66 @@  discard block
 block discarded – undo
29 29
 	}
30 30
 
31 31
 	public function testInit() {
32
-		$userManager=new TUserManager ();
33
-		$userManager->init (self::$config);
34
-		self::assertEquals(array('joe'=>'demo','john'=>'demo', 'test' => 'test'), $userManager->getUsers());
35
-		$userManager=null;
32
+		$userManager = new TUserManager();
33
+		$userManager->init(self::$config);
34
+		self::assertEquals(array('joe'=>'demo', 'john'=>'demo', 'test' => 'test'), $userManager->getUsers());
35
+		$userManager = null;
36 36
 		// Test with a file
37
-		if (is_writable (dirname(__FILE__))) {
38
-			self::$config->saveToFile(dirname(__FILE__).'/users.xml');
39
-			$userManager=new TUserManager();
37
+		if (is_writable(dirname(__FILE__))) {
38
+			self::$config->saveToFile(dirname(__FILE__) . '/users.xml');
39
+			$userManager = new TUserManager();
40 40
 			$userManager->setUserFile('App.users');
41
-			$userManager->init (new TXmlDocument()); // Empty config
42
-			self::assertEquals(array('joe'=>'demo','john'=>'demo', 'test' => 'test'), $userManager->getUsers());
43
-			unlink (dirname(__FILE__).'/users.xml');
41
+			$userManager->init(new TXmlDocument()); // Empty config
42
+			self::assertEquals(array('joe'=>'demo', 'john'=>'demo', 'test' => 'test'), $userManager->getUsers());
43
+			unlink(dirname(__FILE__) . '/users.xml');
44 44
 		}
45 45
 	}
46 46
 
47 47
 	public function testUsers() {
48
-		$userManager=new TUserManager ();
49
-		$userManager->init (self::$config);
50
-		self::assertEquals(array('joe'=>'demo','john'=>'demo', 'test' => 'test'), $userManager->getUsers());
48
+		$userManager = new TUserManager();
49
+		$userManager->init(self::$config);
50
+		self::assertEquals(array('joe'=>'demo', 'john'=>'demo', 'test' => 'test'), $userManager->getUsers());
51 51
 	}
52 52
 
53 53
 	public function testRoles() {
54
-		$userManager=new TUserManager ();
55
-		$userManager->init (self::$config);
56
-		self::assertEquals(array('joe'=>array ('Writer'), 'john'=>array ('Administrator','Writer'), 'test' => array ('Reader', 'User')), $userManager->getRoles());
54
+		$userManager = new TUserManager();
55
+		$userManager->init(self::$config);
56
+		self::assertEquals(array('joe'=>array('Writer'), 'john'=>array('Administrator', 'Writer'), 'test' => array('Reader', 'User')), $userManager->getRoles());
57 57
 	}
58 58
 
59 59
 	public function testUserFile() {
60
-		$userManager=new TUserManager ();
60
+		$userManager = new TUserManager();
61 61
 		try {
62 62
 			$userManager->setUserFile('invalidFile');
63
-			self::fail ('Exception TConfigurationException not thrown');
63
+			self::fail('Exception TConfigurationException not thrown');
64 64
 		} catch (TConfigurationException $e) {}
65
-		$userManager=null;
66
-		if (is_writable (dirname(__FILE__))) {
67
-			self::$config->saveToFile(dirname(__FILE__).'/users.xml');
68
-			$userManager=new TUserManager();
65
+		$userManager = null;
66
+		if (is_writable(dirname(__FILE__))) {
67
+			self::$config->saveToFile(dirname(__FILE__) . '/users.xml');
68
+			$userManager = new TUserManager();
69 69
 			$userManager->setUserFile('App.users');
70
-			$userManager->init (new TXmlDocument()); // Empty config
71
-			self::assertEquals(dirname(__FILE__).'/users.xml', $userManager->getUserFile());
72
-			unlink (dirname(__FILE__).'/users.xml');
73
-			$userManager=null;
70
+			$userManager->init(new TXmlDocument()); // Empty config
71
+			self::assertEquals(dirname(__FILE__) . '/users.xml', $userManager->getUserFile());
72
+			unlink(dirname(__FILE__) . '/users.xml');
73
+			$userManager = null;
74 74
 		}
75
-		$userManager=new TUserManager ();
76
-		$userManager->init (self::$config);
75
+		$userManager = new TUserManager();
76
+		$userManager->init(self::$config);
77 77
 		try {
78 78
 			$userManager->setUserFile('App.users');
79
-			self::fail ('Exception TInvalidOperationException not thrown');
79
+			self::fail('Exception TInvalidOperationException not thrown');
80 80
 		} catch (TInvalidOperationException $e) {}
81 81
 	}
82 82
 
83 83
 	public function testGuestName() {
84
-		$userManager=new TUserManager ();
84
+		$userManager = new TUserManager();
85 85
 		self::assertEquals('Guest', $userManager->getGuestName());
86 86
 		$userManager->setGuestName('Invite');
87 87
 		self::assertEquals('Invite', $userManager->getGuestName());
88 88
 	}
89 89
 
90 90
 	public function testPasswordMode() {
91
-		$userManager=new TUserManager ();
91
+		$userManager = new TUserManager();
92 92
 		$userManager->setPasswordMode('Clear');
93 93
 		self::assertEquals('Clear', $userManager->getPasswordMode());
94 94
 		$userManager->setPasswordMode('MD5');
@@ -97,37 +97,37 @@  discard block
 block discarded – undo
97 97
 		self::assertEquals('SHA1', $userManager->getPasswordMode());
98 98
 		try {
99 99
 			$userManager->setPasswordMode('Invalid');
100
-			self::fail ('Exception TInvalidDataValueException not thrown');
100
+			self::fail('Exception TInvalidDataValueException not thrown');
101 101
 		} catch (TInvalidDataValueException $e) {}
102 102
 
103 103
 	}
104 104
 
105 105
 	public function testValidateUser() {
106
-		$userManager=new TUserManager ();
107
-		$userManager->init (self::$config);
106
+		$userManager = new TUserManager();
107
+		$userManager->init(self::$config);
108 108
 		$userManager->setPasswordMode('Clear');
109 109
 		self::assertTrue($userManager->validateUser('Joe', 'demo'));
110 110
 		self::assertFalse($userManager->validateUser('John', 'bad'));
111 111
 	}
112 112
 
113 113
 	public function testUser() {
114
-		$userManager=new TUserManager ();
115
-		$userManager->init (self::$config);
116
-		$guest=$userManager->getUser(null);
114
+		$userManager = new TUserManager();
115
+		$userManager->init(self::$config);
116
+		$guest = $userManager->getUser(null);
117 117
 		self::assertInstanceOf('TUser', $guest);
118 118
 		self::assertTrue($guest->getIsGuest());
119
-		$user=$userManager->getUser('joe');
119
+		$user = $userManager->getUser('joe');
120 120
 		self::assertInstanceOf('TUser', $user);
121 121
 		self::assertEquals('joe', $user->getName());
122
-		self::assertEquals(array ('Writer'), $user->getRoles());
122
+		self::assertEquals(array('Writer'), $user->getRoles());
123 123
 		self::assertFalse($user->getIsGuest());
124 124
 		self::assertNull($userManager->getUser('badUser'));
125 125
 	}
126 126
 
127 127
 	public function testSwitchToGuest() {
128
-		$userManager=new TUserManager ();
129
-		$userManager->init (self::$config);
130
-		$user=$userManager->getUser('joe');
128
+		$userManager = new TUserManager();
129
+		$userManager->init(self::$config);
130
+		$user = $userManager->getUser('joe');
131 131
 		$userManager->switchToGuest($user);
132 132
 		self::assertTrue($user->getIsGuest());
133 133
 	}
Please login to merge, or discard this patch.
tests/unit/Security/TAuthManagerTest.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,16 +13,16 @@  discard block
 block discarded – undo
13 13
 	public static $usrMgr = null;
14 14
 
15 15
 	public function setUp() {
16
-		ini_set('session.use_cookies',0);
16
+		ini_set('session.use_cookies', 0);
17 17
 		ini_set('session.cache_limiter', 'none');
18
-		if(self::$app === null) {
19
-			self::$app = new TApplication(dirname(__FILE__).'/app');
18
+		if (self::$app === null) {
19
+			self::$app = new TApplication(dirname(__FILE__) . '/app');
20 20
 		}
21 21
 
22 22
 		// Make a fake user manager module
23 23
 		if (self::$usrMgr === null) {
24
-			self::$usrMgr=new TUserManager ();
25
-			$config=new TXmlDocument('1.0','utf8');
24
+			self::$usrMgr = new TUserManager();
25
+			$config = new TXmlDocument('1.0', 'utf8');
26 26
 			$config->loadFromString('<users><user name="Joe" password="demo"/><user name="John" password="demo" /><role name="Administrator" users="John" /><role name="Writer" users="Joe,John" /></users>');
27 27
 			self::$usrMgr->init($config);
28 28
 			self::$app->setModule('users', self::$usrMgr);
@@ -33,20 +33,20 @@  discard block
 block discarded – undo
33 33
 	}
34 34
 
35 35
 	public function testInit() {
36
-		$authManager=new TAuthManager ();
36
+		$authManager = new TAuthManager();
37 37
 		// Catch exception with null usermgr
38 38
 		try {
39 39
 			$authManager->init(null);
40
-			self::fail ('Expected TConfigurationException not thrown');
40
+			self::fail('Expected TConfigurationException not thrown');
41 41
 		} catch (TConfigurationException $e) {}
42 42
 
43 43
 		$authManager->setUserManager('users');
44
-		$authManager->init (null);
44
+		$authManager->init(null);
45 45
 		self::assertEquals(self::$usrMgr, $authManager->getUserManager());
46 46
 	}
47 47
 
48 48
 	public function testUserManager() {
49
-		$authManager=new TAuthManager ();
49
+		$authManager = new TAuthManager();
50 50
 		$authManager->setUserManager('users');
51 51
 		$authManager->init(null);
52 52
 		self::assertEquals(self::$usrMgr, $authManager->getUserManager());
@@ -54,16 +54,16 @@  discard block
 block discarded – undo
54 54
 		// test change
55 55
 		try {
56 56
 			$authManager->setUserManager('invalid');
57
-			self::fail ('Expected TInvalidOperationException not thrown');
57
+			self::fail('Expected TInvalidOperationException not thrown');
58 58
 		} catch (TInvalidOperationException $e) {}
59 59
 
60 60
 	}
61 61
 
62 62
 	public function testLoginPage() {
63
-		$authManager=new TAuthManager ();
63
+		$authManager = new TAuthManager();
64 64
 		$authManager->setUserManager('users');
65 65
 		$authManager->init(null);
66
-		$authManager->setLoginPage ('LoginPage');
66
+		$authManager->setLoginPage('LoginPage');
67 67
 		self::assertEquals('LoginPage', $authManager->getLoginPage());
68 68
 	}
69 69
 
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 		throw new PHPUnit_Framework_IncompleteTestError();
72 72
 		// Not yet finished, Session won't start because of headers :( :(
73 73
 
74
-		$authManager=new TAuthManager ();
74
+		$authManager = new TAuthManager();
75 75
 		$authManager->setUserManager('users');
76 76
 		$authManager->init(null);
77
-		$authManager->setLoginPage ('LoginPage');
78
-		self::$app->raiseEvent ('onAuthentication', self::$app, null);
77
+		$authManager->setLoginPage('LoginPage');
78
+		self::$app->raiseEvent('onAuthentication', self::$app, null);
79 79
 
80 80
 	}
81 81
 
Please login to merge, or discard this patch.
tests/unit/Security/TUserTest.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -7,19 +7,19 @@  discard block
 block discarded – undo
7 7
  * @package System.Security
8 8
  */
9 9
 class TUserTest extends PHPUnit_Framework_TestCase {
10
-	public static $app=null;
11
-	public static $mgr=null;
10
+	public static $app = null;
11
+	public static $mgr = null;
12 12
 
13 13
 	public function setUp() {
14
-		if(self::$app === null) {
15
-			self::$app = new TApplication(dirname(__FILE__).'/app');
14
+		if (self::$app === null) {
15
+			self::$app = new TApplication(dirname(__FILE__) . '/app');
16 16
 			prado::setPathofAlias('App', dirname(__FILE__));
17 17
 		}
18 18
 
19
-		if (self::$mgr===null) {
20
-			$config=new TXmlDocument('1.0','utf8');
19
+		if (self::$mgr === null) {
20
+			$config = new TXmlDocument('1.0', 'utf8');
21 21
 			$config->loadFromString('<users><user name="Joe" password="demo"/><user name="John" password="demo" /><role name="Administrator" users="John" /><role name="Writer" users="Joe,John" /></users>');
22
-			self::$mgr=new TUserManager();
22
+			self::$mgr = new TUserManager();
23 23
 			self::$mgr->init($config);
24 24
 		}
25 25
 	}
@@ -28,44 +28,44 @@  discard block
 block discarded – undo
28 28
 	}
29 29
 
30 30
 	public function testConstruct() {
31
-		$user = new TUser (self::$mgr);
31
+		$user = new TUser(self::$mgr);
32 32
 		self::assertEquals('Guest', $user->getName());
33 33
 		self::assertEquals(self::$mgr, $user->getManager());
34 34
 	}
35 35
 
36 36
 	public function testManager() {
37
-		$user = new TUser (self::$mgr);
37
+		$user = new TUser(self::$mgr);
38 38
 		self::assertEquals(self::$mgr, $user->getManager());
39 39
 	}
40 40
 
41 41
 	public function testName() {
42
-		$user = new TUser (self::$mgr);
42
+		$user = new TUser(self::$mgr);
43 43
 		$user->setName('joe');
44 44
 		self::assertEquals('joe', $user->getName());
45 45
 	}
46 46
 
47 47
 	public function testIsGuest() {
48
-		$user = new TUser (self::$mgr);
48
+		$user = new TUser(self::$mgr);
49 49
 		$user->setName('John');
50 50
 		$user->setIsGuest(false);
51 51
 		$user->setRoles('Administrator, Writer');
52 52
 		self::assertFalse($user->getIsGuest());
53 53
 		$user->setIsGuest(true);
54 54
 		self::assertTrue($user->getIsGuest());
55
-		self::assertEquals(array(),$user->getRoles());
55
+		self::assertEquals(array(), $user->getRoles());
56 56
 	}
57 57
 
58 58
 	public function testRoles() {
59
-		$user=new TUser(self::$mgr);
60
-		$user->setRoles(array('Administrator','Writer'));
61
-		self::assertEquals(array('Administrator','Writer'), $user->getRoles());
59
+		$user = new TUser(self::$mgr);
60
+		$user->setRoles(array('Administrator', 'Writer'));
61
+		self::assertEquals(array('Administrator', 'Writer'), $user->getRoles());
62 62
 		$user->setRoles('Reader,User');
63
-		self::assertEquals(array('Reader','User'), $user->getRoles());
63
+		self::assertEquals(array('Reader', 'User'), $user->getRoles());
64 64
 	}
65 65
 
66 66
 	public function testIsInRole() {
67
-		$user=new TUser(self::$mgr);
68
-		$user->setRoles(array('Administrator','Writer'));
67
+		$user = new TUser(self::$mgr);
68
+		$user->setRoles(array('Administrator', 'Writer'));
69 69
 		// Roles are case insensitive
70 70
 		self::assertTrue($user->IsInRole('writer'));
71 71
 		self::assertTrue($user->IsInRole('Writer'));
@@ -73,23 +73,23 @@  discard block
 block discarded – undo
73 73
 	}
74 74
 
75 75
 	public function testSaveToString() {
76
-		$user = new TUser (self::$mgr);
76
+		$user = new TUser(self::$mgr);
77 77
 		$user->setName('John');
78 78
 		$user->setIsGuest(false);
79 79
 		$user->setRoles('Administrator, Writer');
80 80
 		// State array should now be :
81
-		$assumedState=array ('Name' => 'John', 'IsGuest' => false, 'Roles' => array ('Administrator', 'Writer'));
81
+		$assumedState = array('Name' => 'John', 'IsGuest' => false, 'Roles' => array('Administrator', 'Writer'));
82 82
 		self::assertEquals(serialize($assumedState), $user->saveToString());
83 83
 	}
84 84
 
85 85
 	public function testLoadFromString() {
86
-		$user = new TUser (self::$mgr);
86
+		$user = new TUser(self::$mgr);
87 87
 		$user->setName('John');
88 88
 		$user->setIsGuest(false);
89 89
 		$user->setRoles('Administrator, Writer');
90
-		$save=$user->saveToString();
90
+		$save = $user->saveToString();
91 91
 
92
-		$user2 = new TUser (self::$mgr);
92
+		$user2 = new TUser(self::$mgr);
93 93
 		$user2->loadFromString($save);
94 94
 
95 95
 		self::assertEquals($user, $user2);
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	*/
103 103
 
104 104
 	public function testStateChanged() {
105
-		$user = new TUser (self::$mgr);
105
+		$user = new TUser(self::$mgr);
106 106
 		$user->setName('John');
107 107
 		self::assertTrue($user->getStateChanged());
108 108
 		$user->setStateChanged(false);
Please login to merge, or discard this patch.
tests/unit/Security/AllTests.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 
13 13
 class Security_AllTests {
14 14
   public static function main() {
15
-    PHPUnit_TextUI_TestRunner::run(self::suite());
15
+	PHPUnit_TextUI_TestRunner::run(self::suite());
16 16
   }
17 17
 
18 18
   public static function suite() {
19
-    $suite = new PHPUnit_Framework_TestSuite('System.Security');
19
+	$suite = new PHPUnit_Framework_TestSuite('System.Security');
20 20
 
21 21
 	$suite->addTestSuite('TAuthManagerTest');
22 22
 	$suite->addTestSuite('TAuthorizationRuleTest');
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	$suite->addTestSuite('TUserManagerTest');
25 25
 	$suite->addTestSuite('TUserTest');
26 26
 
27
-    return $suite;
27
+	return $suite;
28 28
   }
29 29
 }
30 30
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('PHPUnit_MAIN_METHOD')) {
3
+if (!defined('PHPUnit_MAIN_METHOD')) {
4 4
   define('PHPUnit_MAIN_METHOD', 'Security_AllTests::main');
5 5
 }
6 6
 
@@ -28,6 +28,6 @@  discard block
 block discarded – undo
28 28
   }
29 29
 }
30 30
 
31
-if(PHPUnit_MAIN_METHOD == 'Security_AllTests::main') {
31
+if (PHPUnit_MAIN_METHOD == 'Security_AllTests::main') {
32 32
   Security_AllTests::main();
33 33
 }
Please login to merge, or discard this patch.
tests/unit/I18N/core/DateTimeFormatInfoTest.php 2 patches
Indentation   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -11,196 +11,196 @@
 block discarded – undo
11 11
   protected $format;
12 12
 
13 13
   function setUp() {
14
-    $this->format = DateTimeFormatInfo::getInstance('en');
14
+	$this->format = DateTimeFormatInfo::getInstance('en');
15 15
   }
16 16
 
17 17
   function testAbbreviatedDayNames() {
18
-    $names = $this->format->AbbreviatedDayNames;
19
-    $this->assertTrue(is_array($names),'Must be an array!');
20
-    $this->assertEquals(count($names),7,'Must have 7 day names');
21
-
22
-    //assuming invariant culture.
23
-    $days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
24
-    $this->assertEquals($names, $days);
25
-
26
-    //try to set the data
27
-    $data = array('Hel', 'wor');
28
-    $this->format->AbbreviatedDayNames = $data;
29
-    $newNames = $this->format->AbbreviatedDayNames;
30
-    $this->assertTrue(is_array($newNames),'Must be an array!');
31
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
32
-    $this->assertEquals($newNames, $data);
18
+	$names = $this->format->AbbreviatedDayNames;
19
+	$this->assertTrue(is_array($names),'Must be an array!');
20
+	$this->assertEquals(count($names),7,'Must have 7 day names');
21
+
22
+	//assuming invariant culture.
23
+	$days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
24
+	$this->assertEquals($names, $days);
25
+
26
+	//try to set the data
27
+	$data = array('Hel', 'wor');
28
+	$this->format->AbbreviatedDayNames = $data;
29
+	$newNames = $this->format->AbbreviatedDayNames;
30
+	$this->assertTrue(is_array($newNames),'Must be an array!');
31
+	$this->assertEquals(count($newNames),2,'Must have 2 entries');
32
+	$this->assertEquals($newNames, $data);
33 33
   }
34 34
 
35 35
   function testNarrowDayNames() {
36
-    $names = $this->format->NarrowDayNames;
37
-    $this->assertTrue(is_array($names),'Must be an array!');
38
-    $this->assertEquals(count($names),7,'Must have 7 day names');
39
-
40
-    //assuming invariant culture.
41
-    $days = array("S", "M", "T", "W", "T", "F", "S");
42
-    $this->assertEquals($names, $days);
43
-
44
-    //try to set the data
45
-    $data = array('H', 'w');
46
-    $this->format->NarrowDayNames = $data;
47
-    $newNames = $this->format->NarrowDayNames;
48
-    $this->assertTrue(is_array($newNames),'Must be an array!');
49
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
50
-    $this->assertEquals($newNames, $data);
36
+	$names = $this->format->NarrowDayNames;
37
+	$this->assertTrue(is_array($names),'Must be an array!');
38
+	$this->assertEquals(count($names),7,'Must have 7 day names');
39
+
40
+	//assuming invariant culture.
41
+	$days = array("S", "M", "T", "W", "T", "F", "S");
42
+	$this->assertEquals($names, $days);
43
+
44
+	//try to set the data
45
+	$data = array('H', 'w');
46
+	$this->format->NarrowDayNames = $data;
47
+	$newNames = $this->format->NarrowDayNames;
48
+	$this->assertTrue(is_array($newNames),'Must be an array!');
49
+	$this->assertEquals(count($newNames),2,'Must have 2 entries');
50
+	$this->assertEquals($newNames, $data);
51 51
   }
52 52
 
53 53
   function testDayNames() {
54
-    $names = $this->format->DayNames;
55
-    $this->assertTrue(is_array($names),'Must be an array!');
56
-    $this->assertEquals(count($names),7,'Must have 7 day names');
57
-
58
-    //assuming invariant culture.
59
-    $days = array(  "Sunday","Monday", "Tuesday", "Wednesday",
60
-		    "Thursday", "Friday", "Saturday");
61
-    $this->assertEquals($names, $days);
62
-
63
-    //try to set the data
64
-    $data = array('Hello', 'world');
65
-    $this->format->DayNames = $data;
66
-    $newNames = $this->format->DayNames;
67
-    $this->assertTrue(is_array($newNames),'Must be an array!');
68
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
69
-    $this->assertEquals($newNames, $data);
54
+	$names = $this->format->DayNames;
55
+	$this->assertTrue(is_array($names),'Must be an array!');
56
+	$this->assertEquals(count($names),7,'Must have 7 day names');
57
+
58
+	//assuming invariant culture.
59
+	$days = array(  "Sunday","Monday", "Tuesday", "Wednesday",
60
+			"Thursday", "Friday", "Saturday");
61
+	$this->assertEquals($names, $days);
62
+
63
+	//try to set the data
64
+	$data = array('Hello', 'world');
65
+	$this->format->DayNames = $data;
66
+	$newNames = $this->format->DayNames;
67
+	$this->assertTrue(is_array($newNames),'Must be an array!');
68
+	$this->assertEquals(count($newNames),2,'Must have 2 entries');
69
+	$this->assertEquals($newNames, $data);
70 70
   }
71 71
 
72 72
   function testMonthNames() {
73
-    $names = $this->format->MonthNames;
74
-    $this->assertTrue(is_array($names),'Must be an array!');
75
-    $this->assertEquals(count($names),12,'Must have 12 month names');
76
-
77
-    //assuming invariant culture.
78
-    $days = array(  "January", "February", "March", "April",
79
-		    "May", "June", "July", "August", "September",
80
-		    "October", "November", "December");
81
-    $this->assertEquals($names, $days);
82
-
83
-    //try to set the data
84
-    $data = array('Hello', 'world');
85
-    $this->format->MonthNames = $data;
86
-    $newNames = $this->format->MonthNames;
87
-    $this->assertTrue(is_array($newNames),'Must be an array!');
88
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
89
-    $this->assertEquals($newNames, $data);
73
+	$names = $this->format->MonthNames;
74
+	$this->assertTrue(is_array($names),'Must be an array!');
75
+	$this->assertEquals(count($names),12,'Must have 12 month names');
76
+
77
+	//assuming invariant culture.
78
+	$days = array(  "January", "February", "March", "April",
79
+			"May", "June", "July", "August", "September",
80
+			"October", "November", "December");
81
+	$this->assertEquals($names, $days);
82
+
83
+	//try to set the data
84
+	$data = array('Hello', 'world');
85
+	$this->format->MonthNames = $data;
86
+	$newNames = $this->format->MonthNames;
87
+	$this->assertTrue(is_array($newNames),'Must be an array!');
88
+	$this->assertEquals(count($newNames),2,'Must have 2 entries');
89
+	$this->assertEquals($newNames, $data);
90 90
   }
91 91
 
92 92
   function testNarrowMonthNames() {
93
-    $names = $this->format->NarrowMonthNames;
94
-    $this->assertTrue(is_array($names),'Must be an array!');
95
-    $this->assertEquals(count($names),12,'Must have 12 month names');
96
-
97
-    //assuming invariant culture.
98
-    $days = array(  "J", "F", "M", "A", "M", "J", "J",
99
-                        "A", "S", "O", "N", "D");
100
-    $this->assertEquals($names, $days);
101
-
102
-    //try to set the data
103
-    $data = array('Hello', 'world');
104
-    $this->format->NarrowMonthNames = $data;
105
-    $newNames = $this->format->NarrowMonthNames;
106
-    $this->assertTrue(is_array($newNames),'Must be an array!');
107
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
108
-    $this->assertEquals($newNames, $data);
93
+	$names = $this->format->NarrowMonthNames;
94
+	$this->assertTrue(is_array($names),'Must be an array!');
95
+	$this->assertEquals(count($names),12,'Must have 12 month names');
96
+
97
+	//assuming invariant culture.
98
+	$days = array(  "J", "F", "M", "A", "M", "J", "J",
99
+						"A", "S", "O", "N", "D");
100
+	$this->assertEquals($names, $days);
101
+
102
+	//try to set the data
103
+	$data = array('Hello', 'world');
104
+	$this->format->NarrowMonthNames = $data;
105
+	$newNames = $this->format->NarrowMonthNames;
106
+	$this->assertTrue(is_array($newNames),'Must be an array!');
107
+	$this->assertEquals(count($newNames),2,'Must have 2 entries');
108
+	$this->assertEquals($newNames, $data);
109 109
   }
110 110
 
111 111
   function testAbbreviatedMonthNames() {
112
-    $names = $this->format->AbbreviatedMonthNames;
113
-    $this->assertTrue(is_array($names),'Must be an array!');
114
-    $this->assertEquals(count($names),12,'Must have 12 month names');
115
-
116
-    //assuming invariant culture.
117
-    $days = array(  "Jan", "Feb", "Mar", "Apr",
118
-		    "May", "Jun", "Jul", "Aug", "Sep",
119
-		    "Oct", "Nov", "Dec");
120
-    $this->assertEquals($names, $days);
121
-
122
-    //try to set the data
123
-    $data = array('Hello', 'world');
124
-    $this->format->AbbreviatedMonthNames = $data;
125
-    $newNames = $this->format->AbbreviatedMonthNames;
126
-    $this->assertTrue(is_array($newNames),'Must be an array!');
127
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
128
-    $this->assertEquals($newNames, $data);
112
+	$names = $this->format->AbbreviatedMonthNames;
113
+	$this->assertTrue(is_array($names),'Must be an array!');
114
+	$this->assertEquals(count($names),12,'Must have 12 month names');
115
+
116
+	//assuming invariant culture.
117
+	$days = array(  "Jan", "Feb", "Mar", "Apr",
118
+			"May", "Jun", "Jul", "Aug", "Sep",
119
+			"Oct", "Nov", "Dec");
120
+	$this->assertEquals($names, $days);
121
+
122
+	//try to set the data
123
+	$data = array('Hello', 'world');
124
+	$this->format->AbbreviatedMonthNames = $data;
125
+	$newNames = $this->format->AbbreviatedMonthNames;
126
+	$this->assertTrue(is_array($newNames),'Must be an array!');
127
+	$this->assertEquals(count($newNames),2,'Must have 2 entries');
128
+	$this->assertEquals($newNames, $data);
129 129
   }
130 130
 
131 131
   function testEra() {
132
-    //era for invariant culture is assumed to have
133
-    // 1 for AD and 0 for BC
134
-    $this->assertEquals('AD', $this->format->getEra(1));
135
-    $this->assertEquals('BC', $this->format->getEra(0));
132
+	//era for invariant culture is assumed to have
133
+	// 1 for AD and 0 for BC
134
+	$this->assertEquals('AD', $this->format->getEra(1));
135
+	$this->assertEquals('BC', $this->format->getEra(0));
136 136
   }
137 137
 
138 138
   function testAMPMMarkers() {
139
-    $am_pm = array('AM','PM');
140
-    $data = $this->format->AMPMMarkers;
141
-    $this->assertTrue(is_array($data));
142
-    $this->assertEquals($am_pm, $data);
143
-    $this->assertEquals('AM', $this->format->AMDesignator);
144
-    $this->assertEquals('PM', $this->format->PMDesignator);
145
-
146
-    //try to set the data
147
-    $data = array('Hello', 'world');
148
-    $this->format->AMPMMarkers = $data;
149
-    $newNames = $this->format->AMPMMarkers;
150
-    $this->assertTrue(is_array($newNames),'Must be an array!');
151
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
152
-    $this->assertEquals($newNames, $data);
153
-
154
-    $this->format->AMDesignator = 'TTTT';
155
-    $this->assertEquals('TTTT',$this->format->AMDesignator);
156
-
157
-    $this->format->PMDesignator = 'SSS';
158
-    $this->assertEquals('SSS',$this->format->PMDesignator);
139
+	$am_pm = array('AM','PM');
140
+	$data = $this->format->AMPMMarkers;
141
+	$this->assertTrue(is_array($data));
142
+	$this->assertEquals($am_pm, $data);
143
+	$this->assertEquals('AM', $this->format->AMDesignator);
144
+	$this->assertEquals('PM', $this->format->PMDesignator);
145
+
146
+	//try to set the data
147
+	$data = array('Hello', 'world');
148
+	$this->format->AMPMMarkers = $data;
149
+	$newNames = $this->format->AMPMMarkers;
150
+	$this->assertTrue(is_array($newNames),'Must be an array!');
151
+	$this->assertEquals(count($newNames),2,'Must have 2 entries');
152
+	$this->assertEquals($newNames, $data);
153
+
154
+	$this->format->AMDesignator = 'TTTT';
155
+	$this->assertEquals('TTTT',$this->format->AMDesignator);
156
+
157
+	$this->format->PMDesignator = 'SSS';
158
+	$this->assertEquals('SSS',$this->format->PMDesignator);
159 159
   }
160 160
 
161 161
   function testPatterns() {
162
-    //patterns for invariant
163
-    $patterns = array(
164
-		      'FullTimePattern' =>      'h:mm:ss a z',
165
-		      'LongTimePattern' =>      'h:mm:ss a z',
166
-		      'MediumTimePattern' =>    'h:mm:ss a',
167
-		      'ShortTimePattern' =>     'h:mm a',
168
-		      'FullDatePattern' =>      'EEEE, MMMM d, yyyy',
169
-		      'LongDatePattern' =>      'MMMM d, yyyy',
170
-		      'MediumDatePattern' =>    'MMM d, yyyy',
171
-		      'ShortDatePattern' =>     'M/d/yy',
172
-		      'DateTimeOrderPattern' => '{1} {0}'
173
-		      );
174
-
175
-    foreach($patterns as $property => $pattern) {
176
-      $this->assertEquals($pattern, $this->format->$property);
177
-    }
178
-
179
-    $hello = 'Hello';
180
-    $world = 'world';
181
-    $expectedResult = $hello.' '.$world;
182
-    $this->assertEquals($expectedResult,
183
-		       $this->format->formatDateTime($hello, $world));
162
+	//patterns for invariant
163
+	$patterns = array(
164
+			  'FullTimePattern' =>      'h:mm:ss a z',
165
+			  'LongTimePattern' =>      'h:mm:ss a z',
166
+			  'MediumTimePattern' =>    'h:mm:ss a',
167
+			  'ShortTimePattern' =>     'h:mm a',
168
+			  'FullDatePattern' =>      'EEEE, MMMM d, yyyy',
169
+			  'LongDatePattern' =>      'MMMM d, yyyy',
170
+			  'MediumDatePattern' =>    'MMM d, yyyy',
171
+			  'ShortDatePattern' =>     'M/d/yy',
172
+			  'DateTimeOrderPattern' => '{1} {0}'
173
+			  );
174
+
175
+	foreach($patterns as $property => $pattern) {
176
+	  $this->assertEquals($pattern, $this->format->$property);
177
+	}
178
+
179
+	$hello = 'Hello';
180
+	$world = 'world';
181
+	$expectedResult = $hello.' '.$world;
182
+	$this->assertEquals($expectedResult,
183
+			   $this->format->formatDateTime($hello, $world));
184 184
   }
185 185
 
186 186
   function testInvariantInfo() {
187
-    $format = DateTimeFormatInfo::getInstance();
187
+	$format = DateTimeFormatInfo::getInstance();
188 188
 
189
-    //the variant datetime format for medium date
190
-    //should be the follow
191
-    $pattern = 'MMM d, yyyy';
189
+	//the variant datetime format for medium date
190
+	//should be the follow
191
+	$pattern = 'MMM d, yyyy';
192 192
 
193
-    $this->assertEquals($pattern, $format->MediumDatePattern);
193
+	$this->assertEquals($pattern, $format->MediumDatePattern);
194 194
 
195
-    $invariant = $format->getInvariantInfo();
195
+	$invariant = $format->getInvariantInfo();
196 196
 
197
-    $this->assertSame($format, $invariant);
197
+	$this->assertSame($format, $invariant);
198 198
   }
199 199
 
200 200
   function testGetInstance() {
201
-    $format = DateTimeFormatInfo::getInstance('zh_CN');
201
+	$format = DateTimeFormatInfo::getInstance('zh_CN');
202 202
 
203
-    $pattern = 'yyyy-M-d';
204
-    $this->assertEquals($pattern, $format->MediumDatePattern);
203
+	$pattern = 'yyyy-M-d';
204
+	$this->assertEquals($pattern, $format->MediumDatePattern);
205 205
   }
206 206
 }
207 207
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 
17 17
   function testAbbreviatedDayNames() {
18 18
     $names = $this->format->AbbreviatedDayNames;
19
-    $this->assertTrue(is_array($names),'Must be an array!');
20
-    $this->assertEquals(count($names),7,'Must have 7 day names');
19
+    $this->assertTrue(is_array($names), 'Must be an array!');
20
+    $this->assertEquals(count($names), 7, 'Must have 7 day names');
21 21
 
22 22
     //assuming invariant culture.
23 23
     $days = array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat");
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
     $data = array('Hel', 'wor');
28 28
     $this->format->AbbreviatedDayNames = $data;
29 29
     $newNames = $this->format->AbbreviatedDayNames;
30
-    $this->assertTrue(is_array($newNames),'Must be an array!');
31
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
30
+    $this->assertTrue(is_array($newNames), 'Must be an array!');
31
+    $this->assertEquals(count($newNames), 2, 'Must have 2 entries');
32 32
     $this->assertEquals($newNames, $data);
33 33
   }
34 34
 
35 35
   function testNarrowDayNames() {
36 36
     $names = $this->format->NarrowDayNames;
37
-    $this->assertTrue(is_array($names),'Must be an array!');
38
-    $this->assertEquals(count($names),7,'Must have 7 day names');
37
+    $this->assertTrue(is_array($names), 'Must be an array!');
38
+    $this->assertEquals(count($names), 7, 'Must have 7 day names');
39 39
 
40 40
     //assuming invariant culture.
41 41
     $days = array("S", "M", "T", "W", "T", "F", "S");
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
     $data = array('H', 'w');
46 46
     $this->format->NarrowDayNames = $data;
47 47
     $newNames = $this->format->NarrowDayNames;
48
-    $this->assertTrue(is_array($newNames),'Must be an array!');
49
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
48
+    $this->assertTrue(is_array($newNames), 'Must be an array!');
49
+    $this->assertEquals(count($newNames), 2, 'Must have 2 entries');
50 50
     $this->assertEquals($newNames, $data);
51 51
   }
52 52
 
53 53
   function testDayNames() {
54 54
     $names = $this->format->DayNames;
55
-    $this->assertTrue(is_array($names),'Must be an array!');
56
-    $this->assertEquals(count($names),7,'Must have 7 day names');
55
+    $this->assertTrue(is_array($names), 'Must be an array!');
56
+    $this->assertEquals(count($names), 7, 'Must have 7 day names');
57 57
 
58 58
     //assuming invariant culture.
59
-    $days = array(  "Sunday","Monday", "Tuesday", "Wednesday",
59
+    $days = array("Sunday", "Monday", "Tuesday", "Wednesday",
60 60
 		    "Thursday", "Friday", "Saturday");
61 61
     $this->assertEquals($names, $days);
62 62
 
@@ -64,18 +64,18 @@  discard block
 block discarded – undo
64 64
     $data = array('Hello', 'world');
65 65
     $this->format->DayNames = $data;
66 66
     $newNames = $this->format->DayNames;
67
-    $this->assertTrue(is_array($newNames),'Must be an array!');
68
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
67
+    $this->assertTrue(is_array($newNames), 'Must be an array!');
68
+    $this->assertEquals(count($newNames), 2, 'Must have 2 entries');
69 69
     $this->assertEquals($newNames, $data);
70 70
   }
71 71
 
72 72
   function testMonthNames() {
73 73
     $names = $this->format->MonthNames;
74
-    $this->assertTrue(is_array($names),'Must be an array!');
75
-    $this->assertEquals(count($names),12,'Must have 12 month names');
74
+    $this->assertTrue(is_array($names), 'Must be an array!');
75
+    $this->assertEquals(count($names), 12, 'Must have 12 month names');
76 76
 
77 77
     //assuming invariant culture.
78
-    $days = array(  "January", "February", "March", "April",
78
+    $days = array("January", "February", "March", "April",
79 79
 		    "May", "June", "July", "August", "September",
80 80
 		    "October", "November", "December");
81 81
     $this->assertEquals($names, $days);
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
     $data = array('Hello', 'world');
85 85
     $this->format->MonthNames = $data;
86 86
     $newNames = $this->format->MonthNames;
87
-    $this->assertTrue(is_array($newNames),'Must be an array!');
88
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
87
+    $this->assertTrue(is_array($newNames), 'Must be an array!');
88
+    $this->assertEquals(count($newNames), 2, 'Must have 2 entries');
89 89
     $this->assertEquals($newNames, $data);
90 90
   }
91 91
 
92 92
   function testNarrowMonthNames() {
93 93
     $names = $this->format->NarrowMonthNames;
94
-    $this->assertTrue(is_array($names),'Must be an array!');
95
-    $this->assertEquals(count($names),12,'Must have 12 month names');
94
+    $this->assertTrue(is_array($names), 'Must be an array!');
95
+    $this->assertEquals(count($names), 12, 'Must have 12 month names');
96 96
 
97 97
     //assuming invariant culture.
98
-    $days = array(  "J", "F", "M", "A", "M", "J", "J",
98
+    $days = array("J", "F", "M", "A", "M", "J", "J",
99 99
                         "A", "S", "O", "N", "D");
100 100
     $this->assertEquals($names, $days);
101 101
 
@@ -103,18 +103,18 @@  discard block
 block discarded – undo
103 103
     $data = array('Hello', 'world');
104 104
     $this->format->NarrowMonthNames = $data;
105 105
     $newNames = $this->format->NarrowMonthNames;
106
-    $this->assertTrue(is_array($newNames),'Must be an array!');
107
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
106
+    $this->assertTrue(is_array($newNames), 'Must be an array!');
107
+    $this->assertEquals(count($newNames), 2, 'Must have 2 entries');
108 108
     $this->assertEquals($newNames, $data);
109 109
   }
110 110
 
111 111
   function testAbbreviatedMonthNames() {
112 112
     $names = $this->format->AbbreviatedMonthNames;
113
-    $this->assertTrue(is_array($names),'Must be an array!');
114
-    $this->assertEquals(count($names),12,'Must have 12 month names');
113
+    $this->assertTrue(is_array($names), 'Must be an array!');
114
+    $this->assertEquals(count($names), 12, 'Must have 12 month names');
115 115
 
116 116
     //assuming invariant culture.
117
-    $days = array(  "Jan", "Feb", "Mar", "Apr",
117
+    $days = array("Jan", "Feb", "Mar", "Apr",
118 118
 		    "May", "Jun", "Jul", "Aug", "Sep",
119 119
 		    "Oct", "Nov", "Dec");
120 120
     $this->assertEquals($names, $days);
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
     $data = array('Hello', 'world');
124 124
     $this->format->AbbreviatedMonthNames = $data;
125 125
     $newNames = $this->format->AbbreviatedMonthNames;
126
-    $this->assertTrue(is_array($newNames),'Must be an array!');
127
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
126
+    $this->assertTrue(is_array($newNames), 'Must be an array!');
127
+    $this->assertEquals(count($newNames), 2, 'Must have 2 entries');
128 128
     $this->assertEquals($newNames, $data);
129 129
   }
130 130
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
   }
137 137
 
138 138
   function testAMPMMarkers() {
139
-    $am_pm = array('AM','PM');
139
+    $am_pm = array('AM', 'PM');
140 140
     $data = $this->format->AMPMMarkers;
141 141
     $this->assertTrue(is_array($data));
142 142
     $this->assertEquals($am_pm, $data);
@@ -147,15 +147,15 @@  discard block
 block discarded – undo
147 147
     $data = array('Hello', 'world');
148 148
     $this->format->AMPMMarkers = $data;
149 149
     $newNames = $this->format->AMPMMarkers;
150
-    $this->assertTrue(is_array($newNames),'Must be an array!');
151
-    $this->assertEquals(count($newNames),2,'Must have 2 entries');
150
+    $this->assertTrue(is_array($newNames), 'Must be an array!');
151
+    $this->assertEquals(count($newNames), 2, 'Must have 2 entries');
152 152
     $this->assertEquals($newNames, $data);
153 153
 
154 154
     $this->format->AMDesignator = 'TTTT';
155
-    $this->assertEquals('TTTT',$this->format->AMDesignator);
155
+    $this->assertEquals('TTTT', $this->format->AMDesignator);
156 156
 
157 157
     $this->format->PMDesignator = 'SSS';
158
-    $this->assertEquals('SSS',$this->format->PMDesignator);
158
+    $this->assertEquals('SSS', $this->format->PMDesignator);
159 159
   }
160 160
 
161 161
   function testPatterns() {
@@ -172,13 +172,13 @@  discard block
 block discarded – undo
172 172
 		      'DateTimeOrderPattern' => '{1} {0}'
173 173
 		      );
174 174
 
175
-    foreach($patterns as $property => $pattern) {
175
+    foreach ($patterns as $property => $pattern) {
176 176
       $this->assertEquals($pattern, $this->format->$property);
177 177
     }
178 178
 
179 179
     $hello = 'Hello';
180 180
     $world = 'world';
181
-    $expectedResult = $hello.' '.$world;
181
+    $expectedResult = $hello . ' ' . $world;
182 182
     $this->assertEquals($expectedResult,
183 183
 		       $this->format->formatDateTime($hello, $world));
184 184
   }
Please login to merge, or discard this patch.
tests/unit/I18N/core/NumberFormatTest.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -9,161 +9,161 @@
 block discarded – undo
9 9
  */
10 10
 class NumberFormatTest extends PHPUnit_Framework_TestCase {
11 11
   function testDefaultFormats() {
12
-    $formatter = new NumberFormat();
13
-    $number = '123456789.125156';
14
-    $wanted = '123,456,789.125156';
12
+	$formatter = new NumberFormat();
13
+	$number = '123456789.125156';
14
+	$wanted = '123,456,789.125156';
15 15
 
16
-    $this->assertEquals($wanted, $formatter->format($number));
16
+	$this->assertEquals($wanted, $formatter->format($number));
17 17
 
18
-    //currency
19
-    $wanted = 'US$123,456,789.13';
20
-    $this->assertEquals($wanted, $formatter->format($number,'c'));
18
+	//currency
19
+	$wanted = 'US$123,456,789.13';
20
+	$this->assertEquals($wanted, $formatter->format($number,'c'));
21 21
   }
22 22
 
23 23
   function testLocalizedCurrencyFormats() {
24
-    $fr = new NumberFormat('fr');
25
-    $de = new NumberFormat('de');
26
-    $ja = new NumberFormat('ja_JP');
27
-    $it = new NumberFormat('it_IT');
24
+	$fr = new NumberFormat('fr');
25
+	$de = new NumberFormat('de');
26
+	$ja = new NumberFormat('ja_JP');
27
+	$it = new NumberFormat('it_IT');
28 28
 
29
-    $number = '123456789.125156';
29
+	$number = '123456789.125156';
30 30
 
31
-    //french
32
-    $wanted = '123 456 789,13 F';
33
-    $this->assertEquals($wanted, $fr->format($number,'c','FRF'));
31
+	//french
32
+	$wanted = '123 456 789,13 F';
33
+	$this->assertEquals($wanted, $fr->format($number,'c','FRF'));
34 34
 
35
-    //german
36
-    $wanted = 'DES 123.456.789,13';
37
-    $this->assertEquals($wanted, $de->format($number,'c','DES'));
35
+	//german
36
+	$wanted = 'DES 123.456.789,13';
37
+	$this->assertEquals($wanted, $de->format($number,'c','DES'));
38 38
 
39
-    //japanese
40
-    $wanted = '¥123,456,789';
41
-    $this->assertEquals($wanted, $ja->format($number,'c','JPY'));
39
+	//japanese
40
+	$wanted = '¥123,456,789';
41
+	$this->assertEquals($wanted, $ja->format($number,'c','JPY'));
42 42
 
43
-    //custom/unkown currency
44
-    $wanted = 'DLL123,456,789';
45
-    $this->assertEquals($wanted, $ja->format($number,'c','DLL'));
43
+	//custom/unkown currency
44
+	$wanted = 'DLL123,456,789';
45
+	$this->assertEquals($wanted, $ja->format($number,'c','DLL'));
46 46
 
47
-    //italian
48
-    $wanted = '€ 123.456.789,13';
49
-    $this->assertEquals($wanted, $it->format($number,'c','EUR'));
47
+	//italian
48
+	$wanted = '€ 123.456.789,13';
49
+	$this->assertEquals($wanted, $it->format($number,'c','EUR'));
50 50
   }
51 51
 
52 52
   function testCustomFormat() {
53
-    $formatter = new NumberFormat();
54
-    $number = '123456789.125156';
55
-
56
-    //primay and secondary grouping test
57
-    $pattern = '#,###,##.###';
58
-    $wanted = '1,234,567,89.125156';
59
-    $this->assertEquals($wanted, $formatter->format($number, $pattern));
60
-
61
-    //4 digits grouping test
62
-    $pattern = '#,####.###';
63
-    $wanted = '1,2345,6789.125156';
64
-    $this->assertEquals($wanted, $formatter->format($number, $pattern));
65
-
66
-    //custom percentage
67
-    $pattern = '#,###.00%';
68
-    $wanted = '123,456,789.13%';
69
-    $this->assertEquals($wanted, $formatter->format($number, $pattern));
53
+	$formatter = new NumberFormat();
54
+	$number = '123456789.125156';
55
+
56
+	//primay and secondary grouping test
57
+	$pattern = '#,###,##.###';
58
+	$wanted = '1,234,567,89.125156';
59
+	$this->assertEquals($wanted, $formatter->format($number, $pattern));
60
+
61
+	//4 digits grouping test
62
+	$pattern = '#,####.###';
63
+	$wanted = '1,2345,6789.125156';
64
+	$this->assertEquals($wanted, $formatter->format($number, $pattern));
65
+
66
+	//custom percentage
67
+	$pattern = '#,###.00%';
68
+	$wanted = '123,456,789.13%';
69
+	$this->assertEquals($wanted, $formatter->format($number, $pattern));
70 70
   }
71 71
 
72 72
   function testPercentageFormat() {
73
-    $formatter = new NumberFormat();
74
-    $number = '0.125156';
75
-    $wanted = '12%';
76
-    $this->assertEquals($wanted, $formatter->format($number, 'p'));
73
+	$formatter = new NumberFormat();
74
+	$number = '0.125156';
75
+	$wanted = '12%';
76
+	$this->assertEquals($wanted, $formatter->format($number, 'p'));
77 77
   }
78 78
 
79 79
   function testQuotes() {
80
-    $formatter = new NumberFormat();
81
-    $number = '123456789.125156';
80
+	$formatter = new NumberFormat();
81
+	$number = '123456789.125156';
82 82
 
83
-    $pattern = "# o'clock";
84
-    $wanted = "123456789 o'clock";
85
-    $this->assertEquals($wanted, $formatter->format($number, $pattern));
83
+	$pattern = "# o'clock";
84
+	$wanted = "123456789 o'clock";
85
+	$this->assertEquals($wanted, $formatter->format($number, $pattern));
86 86
 
87 87
   }
88 88
 
89 89
   function testPadding() {
90
-    $formatter = new NumberFormat();
91
-    $number = '5';
90
+	$formatter = new NumberFormat();
91
+	$number = '5';
92 92
 
93
-    $pattern = '0000';
94
-    $wanted = '0005';
93
+	$pattern = '0000';
94
+	$wanted = '0005';
95 95
 
96
-    $this->assertEquals($wanted, $formatter->format($number, $pattern));
96
+	$this->assertEquals($wanted, $formatter->format($number, $pattern));
97 97
   }
98 98
 
99 99
   function testFormatWithANegativeValue() {
100
-    $formatter = new NumberFormat();
101
-    $number = "-1.2";
100
+	$formatter = new NumberFormat();
101
+	$number = "-1.2";
102 102
 
103
-    $wanted = "-1.2";
104
-    $this->assertEquals($wanted, $formatter->format($number));
103
+	$wanted = "-1.2";
104
+	$this->assertEquals($wanted, $formatter->format($number));
105 105
   }
106 106
 
107 107
   public function testFormatWithAScientificPattern() {
108
-    $formatter = new NumberFormat();
109
-    $number = "10";
110
-    $expected = "10E";
111
-    $this->assertEquals('10E', $formatter->format($number, 'e'));
108
+	$formatter = new NumberFormat();
109
+	$number = "10";
110
+	$expected = "10E";
111
+	$this->assertEquals('10E', $formatter->format($number, 'e'));
112 112
   }
113 113
 
114 114
   function testRounding()
115 115
   {
116
-      $formatter = new NumberFormat();
116
+	  $formatter = new NumberFormat();
117 117
 
118
-      $number = 349.999;
119
-      $pattern = '#.00';
120
-      $expected = '350.00';
118
+	  $number = 349.999;
119
+	  $pattern = '#.00';
120
+	  $expected = '350.00';
121 121
 
122
-      $this->assertEquals($expected, $formatter->format($number, $pattern));
122
+	  $this->assertEquals($expected, $formatter->format($number, $pattern));
123 123
   }
124 124
 
125 125
   function testRounding2()
126 126
   {
127
-      $formatter = new NumberFormat();
127
+	  $formatter = new NumberFormat();
128 128
 
129
-      $number = 349.99;
130
-      $pattern = '#.00';
131
-      $expected = '349.99';
129
+	  $number = 349.99;
130
+	  $pattern = '#.00';
131
+	  $expected = '349.99';
132 132
 
133
-      $this->assertEquals($expected, $formatter->format($number, $pattern));
133
+	  $this->assertEquals($expected, $formatter->format($number, $pattern));
134 134
   }
135 135
 
136 136
   function testLocalizedCurrencyFormats2() {
137 137
 
138
-    $it = new NumberFormat('it_IT');
138
+	$it = new NumberFormat('it_IT');
139 139
 
140
-    $number = 12.41;
141
-    $wanted = '12,41';
142
-    $this->assertEquals($wanted, $it->format($number,'d'));
140
+	$number = 12.41;
141
+	$wanted = '12,41';
142
+	$this->assertEquals($wanted, $it->format($number,'d'));
143 143
 
144
-    $number = 10.23;
145
-    $wanted = '10,23';
146
-    $this->assertEquals($wanted, $it->format($number,'d'));
144
+	$number = 10.23;
145
+	$wanted = '10,23';
146
+	$this->assertEquals($wanted, $it->format($number,'d'));
147 147
 
148
-    $number = 10010.23;
149
-    $wanted = '10.010,23';
150
-    $this->assertEquals($wanted, $it->format($number,'d'));
148
+	$number = 10010.23;
149
+	$wanted = '10.010,23';
150
+	$this->assertEquals($wanted, $it->format($number,'d'));
151 151
 
152
-    $old= setlocale(LC_ALL,"0");
153
-    setlocale(LC_ALL,"it_IT");
152
+	$old= setlocale(LC_ALL,"0");
153
+	setlocale(LC_ALL,"it_IT");
154 154
 
155
-    $number = 12.41;
156
-    $wanted = '12,41';
157
-    $this->assertEquals($wanted, $it->format($number,'d'));
155
+	$number = 12.41;
156
+	$wanted = '12,41';
157
+	$this->assertEquals($wanted, $it->format($number,'d'));
158 158
 
159
-    $number = 10.23;
160
-    $wanted = '10,23';
161
-    $this->assertEquals($wanted, $it->format($number,'d'));
159
+	$number = 10.23;
160
+	$wanted = '10,23';
161
+	$this->assertEquals($wanted, $it->format($number,'d'));
162 162
 
163
-    $number = 10010.23;
164
-    $wanted = '10.010,23';
165
-    $this->assertEquals($wanted, $it->format($number,'d'));
163
+	$number = 10010.23;
164
+	$wanted = '10.010,23';
165
+	$this->assertEquals($wanted, $it->format($number,'d'));
166 166
 
167
-    setlocale(LC_ALL,$old);
167
+	setlocale(LC_ALL,$old);
168 168
   }
169 169
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
     //currency
19 19
     $wanted = 'US$123,456,789.13';
20
-    $this->assertEquals($wanted, $formatter->format($number,'c'));
20
+    $this->assertEquals($wanted, $formatter->format($number, 'c'));
21 21
   }
22 22
 
23 23
   function testLocalizedCurrencyFormats() {
@@ -30,23 +30,23 @@  discard block
 block discarded – undo
30 30
 
31 31
     //french
32 32
     $wanted = '123 456 789,13 F';
33
-    $this->assertEquals($wanted, $fr->format($number,'c','FRF'));
33
+    $this->assertEquals($wanted, $fr->format($number, 'c', 'FRF'));
34 34
 
35 35
     //german
36 36
     $wanted = 'DES 123.456.789,13';
37
-    $this->assertEquals($wanted, $de->format($number,'c','DES'));
37
+    $this->assertEquals($wanted, $de->format($number, 'c', 'DES'));
38 38
 
39 39
     //japanese
40 40
     $wanted = '¥123,456,789';
41
-    $this->assertEquals($wanted, $ja->format($number,'c','JPY'));
41
+    $this->assertEquals($wanted, $ja->format($number, 'c', 'JPY'));
42 42
 
43 43
     //custom/unkown currency
44 44
     $wanted = 'DLL123,456,789';
45
-    $this->assertEquals($wanted, $ja->format($number,'c','DLL'));
45
+    $this->assertEquals($wanted, $ja->format($number, 'c', 'DLL'));
46 46
 
47 47
     //italian
48 48
     $wanted = '€ 123.456.789,13';
49
-    $this->assertEquals($wanted, $it->format($number,'c','EUR'));
49
+    $this->assertEquals($wanted, $it->format($number, 'c', 'EUR'));
50 50
   }
51 51
 
52 52
   function testCustomFormat() {
@@ -139,31 +139,31 @@  discard block
 block discarded – undo
139 139
 
140 140
     $number = 12.41;
141 141
     $wanted = '12,41';
142
-    $this->assertEquals($wanted, $it->format($number,'d'));
142
+    $this->assertEquals($wanted, $it->format($number, 'd'));
143 143
 
144 144
     $number = 10.23;
145 145
     $wanted = '10,23';
146
-    $this->assertEquals($wanted, $it->format($number,'d'));
146
+    $this->assertEquals($wanted, $it->format($number, 'd'));
147 147
 
148 148
     $number = 10010.23;
149 149
     $wanted = '10.010,23';
150
-    $this->assertEquals($wanted, $it->format($number,'d'));
150
+    $this->assertEquals($wanted, $it->format($number, 'd'));
151 151
 
152
-    $old= setlocale(LC_ALL,"0");
153
-    setlocale(LC_ALL,"it_IT");
152
+    $old = setlocale(LC_ALL, "0");
153
+    setlocale(LC_ALL, "it_IT");
154 154
 
155 155
     $number = 12.41;
156 156
     $wanted = '12,41';
157
-    $this->assertEquals($wanted, $it->format($number,'d'));
157
+    $this->assertEquals($wanted, $it->format($number, 'd'));
158 158
 
159 159
     $number = 10.23;
160 160
     $wanted = '10,23';
161
-    $this->assertEquals($wanted, $it->format($number,'d'));
161
+    $this->assertEquals($wanted, $it->format($number, 'd'));
162 162
 
163 163
     $number = 10010.23;
164 164
     $wanted = '10.010,23';
165
-    $this->assertEquals($wanted, $it->format($number,'d'));
165
+    $this->assertEquals($wanted, $it->format($number, 'd'));
166 166
 
167
-    setlocale(LC_ALL,$old);
167
+    setlocale(LC_ALL, $old);
168 168
   }
169 169
 }
Please login to merge, or discard this patch.
tests/unit/I18N/core/CultureInfoTest.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -10,76 +10,76 @@
 block discarded – undo
10 10
   protected $culture;
11 11
 
12 12
   function setUp() {
13
-    $this->culture = CultureInfo::getInvariantCulture();
13
+	$this->culture = CultureInfo::getInvariantCulture();
14 14
   }
15 15
 
16 16
   function testCultureName() {
17
-    $name = 'en';
17
+	$name = 'en';
18 18
 
19
-    $this->assertEquals($name, $this->culture->Name);
19
+	$this->assertEquals($name, $this->culture->Name);
20 20
 
21
-    //the default/invariant culture should be neutral
22
-    $this->assertTrue($this->culture->IsNeutralCulture);
21
+	//the default/invariant culture should be neutral
22
+	$this->assertTrue($this->culture->IsNeutralCulture);
23 23
   }
24 24
 
25 25
   function testCultureList() {
26
-    $allCultures = CultureInfo::getCultures();
27
-    $neutralCultures = CultureInfo::getCultures(CultureInfo::NEUTRAL);
28
-    $specificCultures = CultureInfo::getCultures(CultureInfo::SPECIFIC);
29
-
30
-    //there should be 246 cultures all together.
31
-    $this->assertEquals(count($allCultures),246);
32
-    $this->assertEquals(count($neutralCultures),76);
33
-    $this->assertEquals(count($specificCultures),170);
26
+	$allCultures = CultureInfo::getCultures();
27
+	$neutralCultures = CultureInfo::getCultures(CultureInfo::NEUTRAL);
28
+	$specificCultures = CultureInfo::getCultures(CultureInfo::SPECIFIC);
29
+
30
+	//there should be 246 cultures all together.
31
+	$this->assertEquals(count($allCultures),246);
32
+	$this->assertEquals(count($neutralCultures),76);
33
+	$this->assertEquals(count($specificCultures),170);
34 34
   }
35 35
 
36 36
   function testParentCultures() {
37
-    $zh_CN = new CultureInfo('zh_CN');
38
-    $parent = $zh_CN->Parent;
39
-    $grandparent = $parent->Parent;
40
-
41
-    $this->assertEquals($zh_CN->Name, 'zh_CN');
42
-    $this->assertEquals($parent->Name, 'zh');
43
-    $this->assertEquals($grandparent->Name, 'en');
44
-    $this->assertEquals($grandparent->Parent->Name, 'en');
37
+	$zh_CN = new CultureInfo('zh_CN');
38
+	$parent = $zh_CN->Parent;
39
+	$grandparent = $parent->Parent;
40
+
41
+	$this->assertEquals($zh_CN->Name, 'zh_CN');
42
+	$this->assertEquals($parent->Name, 'zh');
43
+	$this->assertEquals($grandparent->Name, 'en');
44
+	$this->assertEquals($grandparent->Parent->Name, 'en');
45 45
   }
46 46
 
47 47
   function testCountryNames() {
48
-    $culture = new CultureInfo('fr_FR');
49
-    $this->assertEquals($culture->Countries['AE'], 'Émirats arabes unis');
48
+	$culture = new CultureInfo('fr_FR');
49
+	$this->assertEquals($culture->Countries['AE'], 'Émirats arabes unis');
50 50
   }
51 51
 
52 52
   function testCurrencies() {
53
-    $culture = new CultureInfo('en_AU');
54
-    $au = array('$', 'Australian Dollar');
55
-    $this->assertEquals($au, $culture->Currencies['AUD']);
53
+	$culture = new CultureInfo('en_AU');
54
+	$au = array('$', 'Australian Dollar');
55
+	$this->assertEquals($au, $culture->Currencies['AUD']);
56 56
   }
57 57
 
58 58
   function testLanguages() {
59
-    $culture = new CultureInfo('fr_BE');
60
-    $this->assertEquals($culture->Languages['fr'], 'français');
59
+	$culture = new CultureInfo('fr_BE');
60
+	$this->assertEquals($culture->Languages['fr'], 'français');
61 61
   }
62 62
 
63 63
   function testScripts() {
64
-    $culture = new CultureInfo('fr');
65
-    $this->assertEquals($culture->Scripts['Armn'], 'arménien');
64
+	$culture = new CultureInfo('fr');
65
+	$this->assertEquals($culture->Scripts['Armn'], 'arménien');
66 66
   }
67 67
 
68 68
   function testTimeZones() {
69
-    $culture = new CultureInfo('fi');
70
-    $zone = array(
69
+	$culture = new CultureInfo('fi');
70
+	$zone = array(
71 71
 		  "America/Los_Angeles",
72 72
 		  "Tyynenmeren normaaliaika",
73 73
 		  "PST",
74 74
 		  "Tyynenmeren kesäaika",
75 75
 		  "PDT",
76 76
 		  "Los Angeles");
77
-    $this->assertEquals($culture->TimeZones[1],$zone);
77
+	$this->assertEquals($culture->TimeZones[1],$zone);
78 78
   }
79 79
 
80 80
   function test_missing_english_names_returns_culture_code()
81 81
   {
82
-    $culture = new CultureInfo('iw');
83
-    $this->assertEquals($culture->getEnglishName(), 'iw');
82
+	$culture = new CultureInfo('iw');
83
+	$this->assertEquals($culture->getEnglishName(), 'iw');
84 84
   }
85 85
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
     $specificCultures = CultureInfo::getCultures(CultureInfo::SPECIFIC);
29 29
 
30 30
     //there should be 246 cultures all together.
31
-    $this->assertEquals(count($allCultures),246);
32
-    $this->assertEquals(count($neutralCultures),76);
33
-    $this->assertEquals(count($specificCultures),170);
31
+    $this->assertEquals(count($allCultures), 246);
32
+    $this->assertEquals(count($neutralCultures), 76);
33
+    $this->assertEquals(count($specificCultures), 170);
34 34
   }
35 35
 
36 36
   function testParentCultures() {
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		  "Tyynenmeren kesäaika",
75 75
 		  "PDT",
76 76
 		  "Los Angeles");
77
-    $this->assertEquals($culture->TimeZones[1],$zone);
77
+    $this->assertEquals($culture->TimeZones[1], $zone);
78 78
   }
79 79
 
80 80
   function test_missing_english_names_returns_culture_code()
Please login to merge, or discard this patch.
tests/unit/I18N/core/NumberFormatInfoTest.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -10,77 +10,77 @@
 block discarded – undo
10 10
 class NumberFormatInfoTest extends PHPUnit_Framework_TestCase {
11 11
 
12 12
   function testCurrencyPatterns() {
13
-    $numberInfo = NumberFormatInfo::getCurrencyInstance();
14
-
15
-    //there should be 2 decimal places.
16
-    $this->assertEquals($numberInfo->DecimalDigits,2);
17
-    $this->assertEquals($numberInfo->DecimalSeparator,'.');
18
-    $this->assertEquals($numberInfo->GroupSeparator,',');
19
-
20
-    //there should be only 1 grouping of size 3
21
-    $groupsize = array(3,false);
22
-    $this->assertEquals($numberInfo->GroupSizes, $groupsize);
23
-
24
-    //the default negative pattern prefix and postfix
25
-    $negPattern = array('-¤','');
26
-    $this->assertEquals($numberInfo->NegativePattern, $negPattern);
27
-
28
-    //the default positive pattern prefix and postfix
29
-    $negPattern = array('¤','');
30
-    $this->assertEquals($numberInfo->PositivePattern, $negPattern);
31
-
32
-    //the default currency symbol
33
-    $this->assertEquals($numberInfo->CurrencySymbol, 'US$');
34
-    $this->assertEquals($numberInfo->getCurrencySymbol('JPY'), '¥');
35
-    $this->assertEquals($numberInfo->NegativeInfinitySymbol, '-∞');
36
-    $this->assertEquals($numberInfo->PositiveInfinitySymbol, '+∞');
37
-    $this->assertEquals($numberInfo->NegativeSign, '-');
38
-    $this->assertEquals($numberInfo->PositiveSign, '+');
39
-    $this->assertEquals($numberInfo->NaNSymbol, '�');
40
-    $this->assertEquals($numberInfo->PercentSymbol, '%');
41
-    $this->assertEquals($numberInfo->PerMilleSymbol, '‰');
13
+	$numberInfo = NumberFormatInfo::getCurrencyInstance();
14
+
15
+	//there should be 2 decimal places.
16
+	$this->assertEquals($numberInfo->DecimalDigits,2);
17
+	$this->assertEquals($numberInfo->DecimalSeparator,'.');
18
+	$this->assertEquals($numberInfo->GroupSeparator,',');
19
+
20
+	//there should be only 1 grouping of size 3
21
+	$groupsize = array(3,false);
22
+	$this->assertEquals($numberInfo->GroupSizes, $groupsize);
23
+
24
+	//the default negative pattern prefix and postfix
25
+	$negPattern = array('-¤','');
26
+	$this->assertEquals($numberInfo->NegativePattern, $negPattern);
27
+
28
+	//the default positive pattern prefix and postfix
29
+	$negPattern = array('¤','');
30
+	$this->assertEquals($numberInfo->PositivePattern, $negPattern);
31
+
32
+	//the default currency symbol
33
+	$this->assertEquals($numberInfo->CurrencySymbol, 'US$');
34
+	$this->assertEquals($numberInfo->getCurrencySymbol('JPY'), '¥');
35
+	$this->assertEquals($numberInfo->NegativeInfinitySymbol, '-∞');
36
+	$this->assertEquals($numberInfo->PositiveInfinitySymbol, '+∞');
37
+	$this->assertEquals($numberInfo->NegativeSign, '-');
38
+	$this->assertEquals($numberInfo->PositiveSign, '+');
39
+	$this->assertEquals($numberInfo->NaNSymbol, '�');
40
+	$this->assertEquals($numberInfo->PercentSymbol, '%');
41
+	$this->assertEquals($numberInfo->PerMilleSymbol, '‰');
42 42
   }
43 43
 
44 44
   function testPatternsSet() {
45
-    $numberInfo = NumberFormatInfo::getInstance();
45
+	$numberInfo = NumberFormatInfo::getInstance();
46 46
 
47
-    $numberInfo->DecimalDigits = 0;
48
-    $this->assertEquals($numberInfo->DecimalDigits,0);
47
+	$numberInfo->DecimalDigits = 0;
48
+	$this->assertEquals($numberInfo->DecimalDigits,0);
49 49
 
50
-    $numberInfo->DecimalSeparator = ',';
51
-    $this->assertEquals($numberInfo->DecimalSeparator,',');
50
+	$numberInfo->DecimalSeparator = ',';
51
+	$this->assertEquals($numberInfo->DecimalSeparator,',');
52 52
 
53
-    $numberInfo->GroupSeparator = ' ';
54
-    $this->assertEquals($numberInfo->GroupSeparator,' ');
53
+	$numberInfo->GroupSeparator = ' ';
54
+	$this->assertEquals($numberInfo->GroupSeparator,' ');
55 55
 
56
-    $numberInfo->GroupSizes = array(2,3);
57
-    $groupsize = array(2,3);
58
-    $this->assertEquals($numberInfo->GroupSizes, $groupsize);
56
+	$numberInfo->GroupSizes = array(2,3);
57
+	$groupsize = array(2,3);
58
+	$this->assertEquals($numberInfo->GroupSizes, $groupsize);
59 59
 
60
-    $numberInfo->NegativePattern = array('-$$','.');
61
-    $negPattern = array('-$$','.');
62
-    $this->assertEquals($numberInfo->NegativePattern, $negPattern);
60
+	$numberInfo->NegativePattern = array('-$$','.');
61
+	$negPattern = array('-$$','.');
62
+	$this->assertEquals($numberInfo->NegativePattern, $negPattern);
63 63
 
64
-    $numberInfo->PositivePattern = array('YY','.');
65
-    $negPattern = array('YY','.');
66
-    $this->assertEquals($numberInfo->PositivePattern, $negPattern);
64
+	$numberInfo->PositivePattern = array('YY','.');
65
+	$negPattern = array('YY','.');
66
+	$this->assertEquals($numberInfo->PositivePattern, $negPattern);
67 67
 
68
-    //the default CurrencySymbol symbol
69
-    $numberInfo->CurrencySymbol = '$$$';
70
-    $this->assertEquals($numberInfo->CurrencySymbol, '$$$');
68
+	//the default CurrencySymbol symbol
69
+	$numberInfo->CurrencySymbol = '$$$';
70
+	$this->assertEquals($numberInfo->CurrencySymbol, '$$$');
71 71
   }
72 72
 
73 73
   function testLocalizedPatterns() {
74
-    $fr = NumberFormatInfo::getInstance('fr');
75
-    $de = NumberFormatInfo::getInstance('de');
76
-    $en = NumberFormatInfo::getInstance('en_US');
74
+	$fr = NumberFormatInfo::getInstance('fr');
75
+	$de = NumberFormatInfo::getInstance('de');
76
+	$en = NumberFormatInfo::getInstance('en_US');
77 77
 
78
-    $this->assertEquals($fr->DecimalSeparator, ',');
79
-    $this->assertEquals($de->DecimalSeparator, ',');
80
-    $this->assertEquals($en->DecimalSeparator, '.');
78
+	$this->assertEquals($fr->DecimalSeparator, ',');
79
+	$this->assertEquals($de->DecimalSeparator, ',');
80
+	$this->assertEquals($en->DecimalSeparator, '.');
81 81
 
82
-    $this->assertEquals($fr->GroupSeparator, ' ');
83
-    $this->assertEquals($de->GroupSeparator, '.');
84
-    $this->assertEquals($en->GroupSeparator, ',');
82
+	$this->assertEquals($fr->GroupSeparator, ' ');
83
+	$this->assertEquals($de->GroupSeparator, '.');
84
+	$this->assertEquals($en->GroupSeparator, ',');
85 85
   }
86 86
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -13,20 +13,20 @@  discard block
 block discarded – undo
13 13
     $numberInfo = NumberFormatInfo::getCurrencyInstance();
14 14
 
15 15
     //there should be 2 decimal places.
16
-    $this->assertEquals($numberInfo->DecimalDigits,2);
17
-    $this->assertEquals($numberInfo->DecimalSeparator,'.');
18
-    $this->assertEquals($numberInfo->GroupSeparator,',');
16
+    $this->assertEquals($numberInfo->DecimalDigits, 2);
17
+    $this->assertEquals($numberInfo->DecimalSeparator, '.');
18
+    $this->assertEquals($numberInfo->GroupSeparator, ',');
19 19
 
20 20
     //there should be only 1 grouping of size 3
21
-    $groupsize = array(3,false);
21
+    $groupsize = array(3, false);
22 22
     $this->assertEquals($numberInfo->GroupSizes, $groupsize);
23 23
 
24 24
     //the default negative pattern prefix and postfix
25
-    $negPattern = array('-¤','');
25
+    $negPattern = array('-¤', '');
26 26
     $this->assertEquals($numberInfo->NegativePattern, $negPattern);
27 27
 
28 28
     //the default positive pattern prefix and postfix
29
-    $negPattern = array('¤','');
29
+    $negPattern = array('¤', '');
30 30
     $this->assertEquals($numberInfo->PositivePattern, $negPattern);
31 31
 
32 32
     //the default currency symbol
@@ -45,24 +45,24 @@  discard block
 block discarded – undo
45 45
     $numberInfo = NumberFormatInfo::getInstance();
46 46
 
47 47
     $numberInfo->DecimalDigits = 0;
48
-    $this->assertEquals($numberInfo->DecimalDigits,0);
48
+    $this->assertEquals($numberInfo->DecimalDigits, 0);
49 49
 
50 50
     $numberInfo->DecimalSeparator = ',';
51
-    $this->assertEquals($numberInfo->DecimalSeparator,',');
51
+    $this->assertEquals($numberInfo->DecimalSeparator, ',');
52 52
 
53 53
     $numberInfo->GroupSeparator = ' ';
54
-    $this->assertEquals($numberInfo->GroupSeparator,' ');
54
+    $this->assertEquals($numberInfo->GroupSeparator, ' ');
55 55
 
56
-    $numberInfo->GroupSizes = array(2,3);
57
-    $groupsize = array(2,3);
56
+    $numberInfo->GroupSizes = array(2, 3);
57
+    $groupsize = array(2, 3);
58 58
     $this->assertEquals($numberInfo->GroupSizes, $groupsize);
59 59
 
60
-    $numberInfo->NegativePattern = array('-$$','.');
61
-    $negPattern = array('-$$','.');
60
+    $numberInfo->NegativePattern = array('-$$', '.');
61
+    $negPattern = array('-$$', '.');
62 62
     $this->assertEquals($numberInfo->NegativePattern, $negPattern);
63 63
 
64
-    $numberInfo->PositivePattern = array('YY','.');
65
-    $negPattern = array('YY','.');
64
+    $numberInfo->PositivePattern = array('YY', '.');
65
+    $negPattern = array('YY', '.');
66 66
     $this->assertEquals($numberInfo->PositivePattern, $negPattern);
67 67
 
68 68
     //the default CurrencySymbol symbol
Please login to merge, or discard this patch.
tests/unit/I18N/core/DateFormatTest.php 2 patches
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -9,85 +9,85 @@
 block discarded – undo
9 9
 class DateFormatTest extends PHPUnit_Framework_TestCase {
10 10
 
11 11
   public function testStandardPatterns() {
12
-    $dateFormatter = new DateFormat();
13
-
14
-    $time = @mktime(9, 9, 9, 9, 1, 2004);
15
-    $zone = @date('T', $time);
16
-    //var_dump(date('c',$time));
17
-    //for ShortDatePattern  "M/d/yy"
18
-    $this->assertEquals('9/1/04', $dateFormatter->format($time, 'd'));
19
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'d'))));
20
-
21
-    //for LongDatePattern  "MMMM d, yyyy"
22
-    $wants = 'September 1, 2004';
23
-    $this->assertEquals($wants, $dateFormatter->format($time, 'D'));
24
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'D'))));
25
-
26
-    //for Full date and time  "MMMM d, yyyy h:mm a"
27
-    $wants = 'September 1, 2004 9:09 AM';
28
-    $this->assertEquals($wants, $dateFormatter->format($time, 'f'));
29
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'f'))));
30
-
31
-    //for FullDateTimePattern  "MMMM d, yyyy h:mm:ss a z"
32
-    $wants = 'September 1, 2004 9:09:09 AM '.$zone;
33
-    $this->assertEquals($wants, $dateFormatter->format($time, 'F'));
34
-
35
-    //for General "M/d/yy h:mm a"
36
-    $wants = '9/1/04 9:09 AM';
37
-    $this->assertEquals($wants, $dateFormatter->format($time, 'g'));
38
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'g'))));
39
-
40
-    //for General "M/d/yy h:mm:ss a z"
41
-    $wants = '9/1/04 9:09:09 AM '.$zone;
42
-    $this->assertEquals($wants, $dateFormatter->format($time, 'G'));
43
-
44
-    //for MonthDayPattern  "MMMM dd" (invariant)
45
-    $wants = 'September 01';
46
-    $this->assertEquals($wants, $dateFormatter->format($time, 'm'));
47
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'m'))));
48
-
49
-    //for RFC1123Pattern  "EEE, dd MMM yyyy HH:mm:ss" (invariant)
50
-    $wants = 'Wed, 01 Sep 2004 09:09:09';
51
-    $this->assertEquals($wants, $dateFormatter->format($time, 'r'));
52
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'r'))));
53
-
54
-    //for SortableDateTimePattern "yyyy-MM-ddTHH:mm:ss" (invariant)
55
-    $wants = '2004-09-01T09:09:09';
56
-    $this->assertEquals($wants, $dateFormatter->format($time, 's'));
57
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'s'))));
58
-
59
-    //for ShortTimePattern  "H:mm a"
60
-    $wants = '9:09 AM';
61
-    $this->assertEquals($wants, $dateFormatter->format($time, 't'));
62
-    //(date('c',strtotime($dateFormatter->format($time,'t'))));
63
-
64
-    //for LongTimePattern  "H:mm:ss a z"
65
-    $wants = '9:09:09 AM '.$zone;
66
-    $this->assertEquals($wants, $dateFormatter->format($time, 'T'));
67
-
68
-    //for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
69
-    //(invariant)
70
-    $wants = '2004-09-01 09:09:09 '.$zone;
71
-    $this->assertEquals($wants, $dateFormatter->format($time, 'u'));
72
-
73
-    //for Full date and time  "EEEE dd MMMM yyyy HH:mm:ss" (invariant)
74
-    $wants = 'Wednesday 01 September 2004 09:09:09';
75
-    $this->assertEquals($wants, $dateFormatter->format($time, 'U'));
76
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'U'))));
77
-
78
-    //for YearMonthPattern  "yyyy MMMM" (invariant)
79
-    $wants = '2004 September';
80
-    $this->assertEquals($wants, $dateFormatter->format($time, 'y'));
81
-    //var_dump(date('c',strtotime($dateFormatter->format($time,'y'))));
12
+	$dateFormatter = new DateFormat();
13
+
14
+	$time = @mktime(9, 9, 9, 9, 1, 2004);
15
+	$zone = @date('T', $time);
16
+	//var_dump(date('c',$time));
17
+	//for ShortDatePattern  "M/d/yy"
18
+	$this->assertEquals('9/1/04', $dateFormatter->format($time, 'd'));
19
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'d'))));
20
+
21
+	//for LongDatePattern  "MMMM d, yyyy"
22
+	$wants = 'September 1, 2004';
23
+	$this->assertEquals($wants, $dateFormatter->format($time, 'D'));
24
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'D'))));
25
+
26
+	//for Full date and time  "MMMM d, yyyy h:mm a"
27
+	$wants = 'September 1, 2004 9:09 AM';
28
+	$this->assertEquals($wants, $dateFormatter->format($time, 'f'));
29
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'f'))));
30
+
31
+	//for FullDateTimePattern  "MMMM d, yyyy h:mm:ss a z"
32
+	$wants = 'September 1, 2004 9:09:09 AM '.$zone;
33
+	$this->assertEquals($wants, $dateFormatter->format($time, 'F'));
34
+
35
+	//for General "M/d/yy h:mm a"
36
+	$wants = '9/1/04 9:09 AM';
37
+	$this->assertEquals($wants, $dateFormatter->format($time, 'g'));
38
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'g'))));
39
+
40
+	//for General "M/d/yy h:mm:ss a z"
41
+	$wants = '9/1/04 9:09:09 AM '.$zone;
42
+	$this->assertEquals($wants, $dateFormatter->format($time, 'G'));
43
+
44
+	//for MonthDayPattern  "MMMM dd" (invariant)
45
+	$wants = 'September 01';
46
+	$this->assertEquals($wants, $dateFormatter->format($time, 'm'));
47
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'m'))));
48
+
49
+	//for RFC1123Pattern  "EEE, dd MMM yyyy HH:mm:ss" (invariant)
50
+	$wants = 'Wed, 01 Sep 2004 09:09:09';
51
+	$this->assertEquals($wants, $dateFormatter->format($time, 'r'));
52
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'r'))));
53
+
54
+	//for SortableDateTimePattern "yyyy-MM-ddTHH:mm:ss" (invariant)
55
+	$wants = '2004-09-01T09:09:09';
56
+	$this->assertEquals($wants, $dateFormatter->format($time, 's'));
57
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'s'))));
58
+
59
+	//for ShortTimePattern  "H:mm a"
60
+	$wants = '9:09 AM';
61
+	$this->assertEquals($wants, $dateFormatter->format($time, 't'));
62
+	//(date('c',strtotime($dateFormatter->format($time,'t'))));
63
+
64
+	//for LongTimePattern  "H:mm:ss a z"
65
+	$wants = '9:09:09 AM '.$zone;
66
+	$this->assertEquals($wants, $dateFormatter->format($time, 'T'));
67
+
68
+	//for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
69
+	//(invariant)
70
+	$wants = '2004-09-01 09:09:09 '.$zone;
71
+	$this->assertEquals($wants, $dateFormatter->format($time, 'u'));
72
+
73
+	//for Full date and time  "EEEE dd MMMM yyyy HH:mm:ss" (invariant)
74
+	$wants = 'Wednesday 01 September 2004 09:09:09';
75
+	$this->assertEquals($wants, $dateFormatter->format($time, 'U'));
76
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'U'))));
77
+
78
+	//for YearMonthPattern  "yyyy MMMM" (invariant)
79
+	$wants = '2004 September';
80
+	$this->assertEquals($wants, $dateFormatter->format($time, 'y'));
81
+	//var_dump(date('c',strtotime($dateFormatter->format($time,'y'))));
82 82
   }
83 83
 
84 84
   public function testCustomPatterns() {
85
-    $dateFormatter = new DateFormat();
85
+	$dateFormatter = new DateFormat();
86 86
 
87
-    $time = @mktime(9, 9, 9, 9, 1, 2004);
87
+	$time = @mktime(9, 9, 9, 9, 1, 2004);
88 88
 
89
-    $pattern = "'Hello' EEEE, 'it should be' MMM yyyy HH:mm:ss!!!";
90
-    $wants = 'Hello Wednesday, it should be Sep 2004 09:09:09!!!';
91
-    $this->assertEquals($wants, $dateFormatter->format($time, $pattern));
89
+	$pattern = "'Hello' EEEE, 'it should be' MMM yyyy HH:mm:ss!!!";
90
+	$wants = 'Hello Wednesday, it should be Sep 2004 09:09:09!!!';
91
+	$this->assertEquals($wants, $dateFormatter->format($time, $pattern));
92 92
   }
93 93
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
     //var_dump(date('c',strtotime($dateFormatter->format($time,'f'))));
30 30
 
31 31
     //for FullDateTimePattern  "MMMM d, yyyy h:mm:ss a z"
32
-    $wants = 'September 1, 2004 9:09:09 AM '.$zone;
32
+    $wants = 'September 1, 2004 9:09:09 AM ' . $zone;
33 33
     $this->assertEquals($wants, $dateFormatter->format($time, 'F'));
34 34
 
35 35
     //for General "M/d/yy h:mm a"
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     //var_dump(date('c',strtotime($dateFormatter->format($time,'g'))));
39 39
 
40 40
     //for General "M/d/yy h:mm:ss a z"
41
-    $wants = '9/1/04 9:09:09 AM '.$zone;
41
+    $wants = '9/1/04 9:09:09 AM ' . $zone;
42 42
     $this->assertEquals($wants, $dateFormatter->format($time, 'G'));
43 43
 
44 44
     //for MonthDayPattern  "MMMM dd" (invariant)
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
     //(date('c',strtotime($dateFormatter->format($time,'t'))));
63 63
 
64 64
     //for LongTimePattern  "H:mm:ss a z"
65
-    $wants = '9:09:09 AM '.$zone;
65
+    $wants = '9:09:09 AM ' . $zone;
66 66
     $this->assertEquals($wants, $dateFormatter->format($time, 'T'));
67 67
 
68 68
     //for UniversalSortableDateTimePattern "yyyy-MM-dd HH:mm:ss z"
69 69
     //(invariant)
70
-    $wants = '2004-09-01 09:09:09 '.$zone;
70
+    $wants = '2004-09-01 09:09:09 ' . $zone;
71 71
     $this->assertEquals($wants, $dateFormatter->format($time, 'u'));
72 72
 
73 73
     //for Full date and time  "EEEE dd MMMM yyyy HH:mm:ss" (invariant)
Please login to merge, or discard this patch.