-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Command line tool for XML sync testing between languages: entities (#219
- Loading branch information
Showing
5 changed files
with
75 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php /* | ||
+----------------------------------------------------------------------+ | ||
| Copyright (c) 1997-2025 The PHP Group | | ||
+----------------------------------------------------------------------+ | ||
| This source file is subject to version 3.01 of the PHP license, | | ||
| that is bundled with this package in the file LICENSE, and is | | ||
| available through the world-wide-web at the following url: | | ||
| https://www.php.net/license/3_01.txt. | | ||
| If you did not receive a copy of the PHP license and are unable to | | ||
| obtain it through the world-wide-web, please send a note to | | ||
| [email protected], so we can mail you a copy immediately. | | ||
+----------------------------------------------------------------------+ | ||
| Authors: André L F S Bacci <ae php.net> | | ||
+----------------------------------------------------------------------+ | ||
# Description | ||
Compare XML entities usage between two XML leaf/fragment files. */ | ||
|
||
require_once __DIR__ . '/libqa/all.php'; | ||
|
||
$ignore = new OutputIgnore( $argv ); // always first, may exit. | ||
$list = SyncFileList::load(); | ||
|
||
foreach ( $list as $file ) | ||
{ | ||
$source = $file->sourceDir . '/' . $file->file; | ||
$target = $file->targetDir . '/' . $file->file; | ||
$output = new OutputBuffer( "# qaxml.e" , $target , $ignore ); | ||
|
||
[ $_ , $s , $_ ] = XmlFrag::loadXmlFragmentFile( $source ); | ||
[ $_ , $t , $_ ] = XmlFrag::loadXmlFragmentFile( $target ); | ||
|
||
if ( implode( "\n" , $s ) == implode( "\n" , $t ) ) | ||
continue; | ||
|
||
$match = array(); | ||
|
||
foreach( $s as $v ) | ||
$match[$v] = [ 0 , 0 ]; | ||
foreach( $t as $v ) | ||
$match[$v] = [ 0 , 0 ]; | ||
|
||
foreach( $s as $v ) | ||
$match[$v][0] += 1; | ||
foreach( $t as $v ) | ||
$match[$v][1] += 1; | ||
|
||
foreach( $match as $k => $v ) | ||
{ | ||
if ( $v[0] == $v[1] ) | ||
continue; | ||
$output->addDiff( $k , $v[0] , $v[1] ); | ||
} | ||
|
||
$output->print(); | ||
} |