68 private function storeit( $originalName, $srcPath, $flags ) {
69 $hashPath = $this->repo->getHashPath( $originalName );
70 $dstRel =
"$hashPath{$this->date}!$originalName";
71 $dstUrlRel = $hashPath . $this->date .
'!' . rawurlencode( $originalName );
73 $result = $this->repo->store( $srcPath,
'temp', $dstRel, $flags );
74 $result->value = $this->repo->getVirtualUrl(
'temp' ) .
'/' . $dstUrlRel;
75 $this->createdFiles[] = $result->value;
88 private function storecohort( $fn, $infn, $otherfn, $fromrepo ) {
89 $f = $this->
storeit( $fn, $infn, 0 );
90 $this->assertTrue( $f->isOK(),
'failed to store a new file' );
91 $this->assertEquals( $f->failCount, 0,
"counts wrong {$f->successCount} {$f->failCount}" );
92 $this->assertEquals( $f->successCount, 1,
"counts wrong {$f->successCount} {$f->failCount}" );
99 $this->assertTrue( $f->isOK(),
'We should be allowed to overwrite' );
100 $this->assertEquals( $f->failCount, 0,
"counts wrong {$f->successCount} {$f->failCount}" );
101 $this->assertEquals( $f->successCount, 1,
"counts wrong {$f->successCount} {$f->failCount}" );
103 $f = $this->
storeit( $fn, $infn, 0 );
104 $this->assertFalse( $f->isOK(),
'We should not be allowed to overwrite' );
105 $this->assertEquals( $f->failCount, 1,
"counts wrong {$f->successCount} {$f->failCount}" );
106 $this->assertEquals( $f->successCount, 0,
"counts wrong {$f->successCount} {$f->failCount}" );
109 $this->assertTrue( $f->isOK(),
'We should be able to overwrite the same content' );
110 $this->assertEquals( $f->failCount, 0,
"counts wrong {$f->successCount} {$f->failCount}" );
111 $this->assertEquals( $f->successCount, 1,
"counts wrong {$f->successCount} {$f->failCount}" );
115 $otherfn = $f->value;
118 $this->assertFalse( $f->isOK(),
'We should not be allowed to overwrite different content' );
119 $this->assertEquals( $f->failCount, 1,
"counts wrong {$f->successCount} {$f->failCount}" );
120 $this->assertEquals( $f->successCount, 0,
"counts wrong {$f->successCount} {$f->failCount}" );