Permalink
Browse files

Update expectation to account for umask()

Updating a number of simple assertEqual -> assertEquals.
Fixes #2045
  • Loading branch information...
1 parent f4b2e03 commit 115c656dcc53c9282c074d8ff9b1312169b105f0 @markstory markstory committed Oct 1, 2011
Showing with 17 additions and 17 deletions.
  1. +17 −17 lib/Cake/Test/Case/Utility/FileTest.php
@@ -65,55 +65,55 @@ public function testBasic() {
$result = $this->File->pwd();
$expecting = $file;
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->name;
$expecting = basename(__FILE__);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->info();
$expecting = array(
'dirname' => dirname(__FILE__), 'basename' => basename(__FILE__),
'extension' => 'php', 'filename' =>'FileTest'
);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->ext();
$expecting = 'php';
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->name();
$expecting = 'FileTest';
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->md5();
$expecting = md5_file($file);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->md5(true);
$expecting = md5_file($file);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->size();
$expecting = filesize($file);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->owner();
$expecting = fileowner($file);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->group();
$expecting = filegroup($file);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->Folder();
$this->assertIsA($result, 'Folder');
$this->skipIf(DIRECTORY_SEPARATOR === '\\', 'File permissions tests not supported on Windows.');
$result = $this->File->perms();
- $expecting = '0644';
- $this->assertEqual($result, $expecting);
+ $expecting = decoct(0644 & ~umask());
+ $this->assertEquals($expecting, $result);
}
/**
@@ -127,7 +127,7 @@ public function testRead() {
$result = $this->File->read();
$expecting = file_get_contents(__FILE__);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$this->assertTrue(!is_resource($this->File->handle));
$this->File->lock = true;
@@ -139,12 +139,12 @@ public function testRead() {
$data = $expecting;
$expecting = substr($data, 0, 3);
$result = $this->File->read(3);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$this->assertTrue(is_resource($this->File->handle));
$expecting = substr($data, 3, 3);
$result = $this->File->read(3);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
}
/**
@@ -172,7 +172,7 @@ public function testOffset() {
$expecting = substr($data, 5, 3);
$result = $this->File->read(3);
$this->assertTrue($success);
- $this->assertEqual($result, $expecting);
+ $this->assertEquals($expecting, $result);
$result = $this->File->offset();
$expecting = 5+3;
@@ -239,7 +239,7 @@ public function testCreate() {
public function testOpeningNonExistantFileCreatesIt() {
$someFile = new File(TMP . 'some_file.txt', false);
$this->assertTrue($someFile->open());
- $this->assertEqual($someFile->read(), '');
+ $this->assertEquals('', $someFile->read());
$someFile->close();
$someFile->delete();
}

0 comments on commit 115c656

Please sign in to comment.