Esempio n. 1
0
 public function testLoadVersionOutput()
 {
     $tool = new phpillowTool(null, array('version' => false));
     $tool->setOutputStreams($stdout = fopen('string://', 'w'), $stderr = fopen('string://', 'w'));
     $this->assertEquals(0, $tool->load());
     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 testLoadDocumentWithAttachment()
 {
     $tool = new phpillowTool('http://localhost:5984/test', array('verbose' => false, 'input' => dirname(__FILE__) . '/data/testDumpDocumentWithAttachment.dump'));
     $tool->setOutputStreams($stdout = fopen('string://', 'w'), $stderr = fopen('string://', 'w'));
     $this->assertEquals(0, $tool->load());
     fseek($stdout, 0);
     fseek($stderr, 0);
     $this->assertEquals('', stream_get_contents($stdout));
     $this->assertEquals("Loading document user-kore\n", stream_get_contents($stderr));
     $user = new phpillowUserDocument();
     $user->fetchById('user-kore');
     $this->assertEquals('kore', $user->login);
     $this->assertEquals(base64_encode($user->getFile('image_png.png')->data), base64_encode(file_get_contents(dirname(__FILE__) . '/../phpillow/data/image_png.png')));
 }