/**
  * Tests the changeOwner() method.
  *
  * @return void
  */
 public function testChangeOwner()
 {
     if (!function_exists('posix_getpwuid') || false === posix_getpwuid(1)) {
         $this->markTestSkipped('Either the posix_getpwuid() function is not available, or there is no user with UID of 1');
     }
     if (!function_exists('posix_getgrgid') || false === posix_getgrgid(1)) {
         $this->markTestSkipped('Either the posix_getgrgid() function is not available, or there is no group with GID of 1');
     }
     $file = 'test.txt';
     $fullPath = $this->getTestPath() . $file;
     touch($fullPath);
     $this->assertTrue(file_exists($fullPath), 'Precondition failed. Unable to create test file: ' . $fullPath);
     $this->assertEquals(0, fileowner($fullPath), 'Precondition failed. Invalid owner for new file.');
     clearstatcache();
     $this->fileHandler->changeOwner($fullPath, null, 1);
     $this->assertEquals(1, fileowner($fullPath), 'Failed to change owner of the test file');
     clearstatcache();
     $this->fileHandler->changeOwner($fullPath, 1, 1);
     $this->assertEquals(1, filegroup($fullPath), 'Failed to change group of the test file');
     $this->assertEquals(1, fileowner($fullPath), 'Invalid user set for file when changing both group and user');
     clearstatcache();
     $this->fileHandler->changeOwner($fullPath, 0);
     $this->assertEquals(0, filegroup($fullPath), 'Failed to change group of the test file');
     $this->assertEquals(1, fileowner($fullPath), 'Changing only the group should not change the owner of a file');
 }