Skip to content
This repository
Browse code

Update expectation to account for umask()

Updating a number of simple assertEqual -> assertEquals.
Fixes #2045
  • Loading branch information...
commit 115c656dcc53c9282c074d8ff9b1312169b105f0 1 parent f4b2e03
Mark Story authored September 30, 2011

Showing 1 changed file with 17 additions and 17 deletions. Show diff stats Hide diff stats

  1. 34  lib/Cake/Test/Case/Utility/FileTest.php
34  lib/Cake/Test/Case/Utility/FileTest.php
@@ -65,46 +65,46 @@ public function testBasic() {
65 65
 
66 66
 		$result = $this->File->pwd();
67 67
 		$expecting = $file;
68  
-		$this->assertEqual($result, $expecting);
  68
+		$this->assertEquals($expecting, $result);
69 69
 
70 70
 		$result = $this->File->name;
71 71
 		$expecting = basename(__FILE__);
72  
-		$this->assertEqual($result, $expecting);
  72
+		$this->assertEquals($expecting, $result);
73 73
 
74 74
 		$result = $this->File->info();
75 75
 		$expecting = array(
76 76
 			'dirname' => dirname(__FILE__), 'basename' => basename(__FILE__),
77 77
 			'extension' => 'php', 'filename' =>'FileTest'
78 78
 		);
79  
-		$this->assertEqual($result, $expecting);
  79
+		$this->assertEquals($expecting, $result);
80 80
 
81 81
 		$result = $this->File->ext();
82 82
 		$expecting = 'php';
83  
-		$this->assertEqual($result, $expecting);
  83
+		$this->assertEquals($expecting, $result);
84 84
 
85 85
 		$result = $this->File->name();
86 86
 		$expecting = 'FileTest';
87  
-		$this->assertEqual($result, $expecting);
  87
+		$this->assertEquals($expecting, $result);
88 88
 
89 89
 		$result = $this->File->md5();
90 90
 		$expecting = md5_file($file);
91  
-		$this->assertEqual($result, $expecting);
  91
+		$this->assertEquals($expecting, $result);
92 92
 
93 93
 		$result = $this->File->md5(true);
94 94
 		$expecting = md5_file($file);
95  
-		$this->assertEqual($result, $expecting);
  95
+		$this->assertEquals($expecting, $result);
96 96
 
97 97
 		$result = $this->File->size();
98 98
 		$expecting = filesize($file);
99  
-		$this->assertEqual($result, $expecting);
  99
+		$this->assertEquals($expecting, $result);
100 100
 
101 101
 		$result = $this->File->owner();
102 102
 		$expecting = fileowner($file);
103  
-		$this->assertEqual($result, $expecting);
  103
+		$this->assertEquals($expecting, $result);
104 104
 
105 105
 		$result = $this->File->group();
106 106
 		$expecting = filegroup($file);
107  
-		$this->assertEqual($result, $expecting);
  107
+		$this->assertEquals($expecting, $result);
108 108
 
109 109
 		$result = $this->File->Folder();
110 110
 		$this->assertIsA($result, 'Folder');
@@ -112,8 +112,8 @@ public function testBasic() {
112 112
 		$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.');
113 113
 
114 114
 		$result = $this->File->perms();
115  
-		$expecting = '0644';
116  
-		$this->assertEqual($result, $expecting);
  115
+		$expecting = decoct(0644 & ~umask());
  116
+		$this->assertEquals($expecting, $result);
117 117
 	}
118 118
 
119 119
 /**
@@ -127,7 +127,7 @@ public function testRead() {
127 127
 
128 128
 		$result = $this->File->read();
129 129
 		$expecting = file_get_contents(__FILE__);
130  
-		$this->assertEqual($result, $expecting);
  130
+		$this->assertEquals($expecting, $result);
131 131
 		$this->assertTrue(!is_resource($this->File->handle));
132 132
 
133 133
 		$this->File->lock = true;
@@ -139,12 +139,12 @@ public function testRead() {
139 139
 		$data = $expecting;
140 140
 		$expecting = substr($data, 0, 3);
141 141
 		$result = $this->File->read(3);
142  
-		$this->assertEqual($result, $expecting);
  142
+		$this->assertEquals($expecting, $result);
143 143
 		$this->assertTrue(is_resource($this->File->handle));
144 144
 
145 145
 		$expecting = substr($data, 3, 3);
146 146
 		$result = $this->File->read(3);
147  
-		$this->assertEqual($result, $expecting);
  147
+		$this->assertEquals($expecting, $result);
148 148
 	}
149 149
 
150 150
 /**
@@ -172,7 +172,7 @@ public function testOffset() {
172 172
 		$expecting = substr($data, 5, 3);
173 173
 		$result = $this->File->read(3);
174 174
 		$this->assertTrue($success);
175  
-		$this->assertEqual($result, $expecting);
  175
+		$this->assertEquals($expecting, $result);
176 176
 
177 177
 		$result = $this->File->offset();
178 178
 		$expecting = 5+3;
@@ -239,7 +239,7 @@ public function testCreate() {
239 239
 	public function testOpeningNonExistantFileCreatesIt() {
240 240
 		$someFile = new File(TMP . 'some_file.txt', false);
241 241
 		$this->assertTrue($someFile->open());
242  
-		$this->assertEqual($someFile->read(), '');
  242
+		$this->assertEquals('', $someFile->read());
243 243
 		$someFile->close();
244 244
 		$someFile->delete();
245 245
 	}

0 notes on commit 115c656

Please sign in to comment.
Something went wrong with that request. Please try again.