Ejemplo n.º 1
0
 public function testDumpVersionOutput()
 {
     $tool = new phpillowTool(null, array('version' => false));
     $tool->setOutputStreams($stdout = fopen('string://', 'w'), $stderr = fopen('string://', 'w'));
     $this->assertEquals(0, $tool->dump());
     fseek($stdout, 0);
     fseek($stderr, 0);
     $this->assertTrue((bool) preg_match('(^PHPillow backup tool - version: .*$)', stream_get_contents($stdout)));
     $this->assertEquals('', stream_get_contents($stderr));
 }
 public function testDumpDocumentWithAttachment()
 {
     $doc = new phpillowUserDocument();
     $doc->login = '******';
     $doc->attachFile($file = dirname(__FILE__) . '/../phpillow/data/image_png.png');
     $doc->save();
     $tool = new phpillowTool('http://localhost:5984/test', array('verbose' => false));
     $tool->setOutputStreams($stdout = fopen('string://', 'w'), $stderr = fopen('string://', 'w'));
     $this->assertEquals(0, $tool->dump());
     fseek($stdout, 0);
     fseek($stderr, 0);
     $this->compareDump(__FUNCTION__, stream_get_contents($stdout));
     $this->assertEquals("Dumping document user-kore\n", stream_get_contents($stderr));
 }