Ejemplo n.º 1
0
 /**
  * ディレクトリ比較のテスト(改行コードを無視するテスト)
  */
 public function testDiffDir2()
 {
     $this->fs->mkdir(__DIR__ . '/_output2/');
     $this->assertTrue($this->fs->rm(__DIR__ . '/_output2/'));
     $crlfHTML = '';
     $crlfHTML .= '<div>LF</div>' . "\n";
     $crlfHTML .= '<div>CRLF</div>' . "\r\n";
     $crlfHTML .= '<div>CR</div>' . "\r";
     $crlfHTML .= '<div>(EOL)</div>';
     $this->fs->save_file(__DIR__ . '/sample_a/crlf.html', $crlfHTML);
     $crlfHTML = preg_replace('/(?:\\r\\n|\\r|\\n)/', "\r\n", $crlfHTML);
     $this->fs->save_file(__DIR__ . '/sample_b/crlf.html', $crlfHTML);
     touch(__DIR__ . '/sample_a/crlf.html', $this->timestamp);
     touch(__DIR__ . '/sample_b/crlf.html', $this->timestamp);
     $diffdir = new \tomk79\diffdir(__DIR__ . '/sample_a/', __DIR__ . '/sample_b/', array('output' => __DIR__ . '/_output2/', 'strip_crlf' => true));
     $this->assertFalse(is_dir($diffdir->is_error()));
     $this->assertTrue(is_dir($diffdir->get_output_dir()));
     clearstatcache();
     $this->assertTrue($this->fs->is_dir(__DIR__ . '/_output2/'));
     $this->assertTrue($this->fs->is_dir(__DIR__ . '/_output2/pickup/'));
     $this->assertTrue($this->fs->is_dir(__DIR__ . '/_output2/report/'));
 }
Ejemplo n.º 2
0
    }
    if ($argv[$i] == '-v') {
        $conf['verbose'] = true;
        continue;
    }
    if ($argv[$i] == '-q') {
        $conf['verbose'] = false;
        continue;
    }
}
if ($conf['verbose']) {
    print '-- starting "diffdir" --' . "\n";
    print '$before = ' . $before . "\n";
    print '$after = ' . $after . "\n";
}
$diffdir = new tomk79\diffdir($before, $after, $conf);
if ($conf['verbose']) {
    if ($diffdir->is_error()) {
        print 'ERROR.' . "\n";
        $errors = $diffdir->get_errors();
        foreach ($errors as $error) {
            print @$error['msg'] . "\n";
            print '  (' . @$error['FILE'] . ':' . @$error['LINE'] . ')' . "\n";
        }
    } else {
        print 'success.' . "\n";
        print '' . "\n";
        print 'see: ' . $diffdir->get_output_dir() . "\n";
    }
    print '' . "\n";
    print 'bye;' . "\n";