* Beefed up unit tests for this case and other "ignoreMissingSource" cases
such as when the source container or parent directory do not exist.
Change-Id: Iea6dae2424edfd0c4367e5cff606c09a4e8a865b
$paths = array();
foreach ( $ops as $op ) {
if ( isset( $op['src'] ) ) {
- $paths[] = $op['src'];
+ // For things like copy/move/delete with "ignoreMissingSource" and there
+ // is no source file, nothing should happen and there should be no errors.
+ if ( empty( $op['ignoreMissingSource'] )
+ || $this->fileExists( array( 'src' => $op['src'] ) ) )
+ {
+ $paths[] = $op['src'];
+ }
}
if ( isset( $op['srcs'] ) ) {
$paths = array_merge( $paths, $op['srcs'] );
$dest, // dest
);
+ $op2 = $op;
+ $op2['ignoreMissingSource'] = true;
+ $cases[] = array(
+ $op2, // operation
+ self::baseStorePath() . '/unittest-cont-bad/e/file.txt', // source
+ $dest, // dest
+ );
+
return $cases;
}
$dest, // dest
);
+ $op2 = $op;
+ $op2['ignoreMissingSource'] = true;
+ $cases[] = array(
+ $op2, // operation
+ self::baseStorePath() . '/unittest-cont-bad/e/file.txt', // source
+ $dest, // dest
+ );
+
return $cases;
}
true // succeeds
);
+ $op['ignoreMissingSource'] = true;
+ $op['src'] = self::baseStorePath() . '/unittest-cont-bad/e/file.txt';
+ $cases[] = array(
+ $op, // operation
+ false, // without source
+ true // succeeds
+ );
+
return $cases;
}