<?php
/**
+ * @group medium
+ * ^---- causes phpunit to use a higher timeout threshold
+ *
* @group FileRepo
* @group FileBackend
*/
$props2 = $this->backend->getFileProps( array( 'src' => $dest ) );
$this->assertEquals( $props1, $props2,
"Source and destination have the same props ($backendName)." );
+
+ $this->assertBackendPathsConsistent( array( $dest ) );
}
public function provider_testStore() {
$props2 = $this->backend->getFileProps( array( 'src' => $dest ) );
$this->assertEquals( $props1, $props2,
"Source and destination have the same props ($backendName)." );
+
+ $this->assertBackendPathsConsistent( array( $source, $dest ) );
}
public function provider_testCopy() {
"Source file does not exist accourding to props ($backendName)." );
$this->assertEquals( true, $props2['fileExists'],
"Destination file exists accourding to props ($backendName)." );
+
+ $this->assertBackendPathsConsistent( array( $source, $dest ) );
}
public function provider_testMove() {
$props1 = $this->backend->getFileProps( array( 'src' => $source ) );
$this->assertFalse( $props1['fileExists'],
"Source file $source does not exist according to props ($backendName)." );
+
+ $this->assertBackendPathsConsistent( array( $source ) );
}
public function provider_testDelete() {
$this->backend->getFileSize( array( 'src' => $dest ) ),
"Destination file $dest has original size according to props ($backendName)." );
}
+
+ $this->assertBackendPathsConsistent( array( $dest ) );
}
/**
$this->tearDownFiles();
$this->doTestDoOperations();
$this->tearDownFiles();
-
- $this->backend = $this->singleBackend;
- $this->tearDownFiles();
- $this->doTestDoOperations2();
- $this->tearDownFiles();
-
- $this->backend = $this->multiBackend;
- $this->tearDownFiles();
- $this->doTestDoOperations2();
- $this->tearDownFiles();
-
- $this->backend = $this->singleBackend;
- $this->tearDownFiles();
- $this->doTestDoOperationsFailing();
- $this->tearDownFiles();
-
- $this->backend = $this->multiBackend;
- $this->tearDownFiles();
- $this->doTestDoOperationsFailing();
- $this->tearDownFiles();
}
private function doTestDoOperations() {
"Correct file SHA-1 of $fileC" );
}
+ public function testDoOperationsPipeline() {
+ $this->backend = $this->singleBackend;
+ $this->tearDownFiles();
+ $this->doTestDoOperationsPipeline();
+ $this->tearDownFiles();
+
+ $this->backend = $this->multiBackend;
+ $this->tearDownFiles();
+ $this->doTestDoOperationsPipeline();
+ $this->tearDownFiles();
+ }
+
// concurrency orientated
- private function doTestDoOperations2() {
+ private function doTestDoOperationsPipeline() {
$base = $this->baseStorePath();
$fileAContents = '3tqtmoeatmn4wg4qe-mg3qt3 tq';
"Correct file SHA-1 of $fileC" );
}
+ public function testDoOperationsFailing() {
+ $this->backend = $this->singleBackend;
+ $this->tearDownFiles();
+ $this->doTestDoOperationsFailing();
+ $this->tearDownFiles();
+
+ $this->backend = $this->multiBackend;
+ $this->tearDownFiles();
+ $this->doTestDoOperationsFailing();
+ $this->tearDownFiles();
+ }
+
private function doTestDoOperationsFailing() {
$base = $this->baseStorePath();
$this->backend->clean( array( 'dir' => "$base/$container", 'recursive' => 1 ) );
}
+ function assertBackendPathsConsistent( array $paths ) {
+ if ( $this->backend instanceof FileBackendMultiWrite ) {
+ $status = $this->backend->consistencyCheck( $paths );
+ $this->assertGoodStatus( $status, "Files synced: " . implode( ',', $paths ) );
+ }
+ }
+
function assertGoodStatus( $status, $msg ) {
$this->assertEquals( print_r( array(), 1 ), print_r( $status->errors, 1 ), $msg );
}