<commit_before>--TEST--
PEAR_PackageFile_Parser_v2->installBinary()
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
    echo 'skip';
}
?>
--FILE--
<?php
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
require_once 'PEAR/ChannelFile.php';
$pathtopackagexml = dirname(__FILE__)  . DIRECTORY_SEPARATOR .
    'test_installBinary'. DIRECTORY_SEPARATOR . 'foo_win-1.1.0.tgz';
$pathtopackagexml2 = dirname(__FILE__)  . DIRECTORY_SEPARATOR .
    'test_installBinary'. DIRECTORY_SEPARATOR . 'foo_linux-1.1.0.tgz';
$GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/foo_win-1.1.0.tgz', $pathtopackagexml);
$GLOBALS['pearweb']->addXmlrpcConfig('grob', 'package.getDownloadURL',
    array(array('channel' => 'grob', 'package' => 'foo_win', 'version' => '1.1.0'), 'stable'),
    array('version' => '1.1.0',
          'info' =>
          '<?xml version="1.0"?>
<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
 <name>foo_win</name>
 <channel>grob</channel>
 <summary>foo binary</summary>
 <description>foo binary for windows</description>
 <lead>
  <name><NAME></name>
  <user>cellog</user>
  <email><EMAIL></email>
  <active>yes</active>
 </lead>
 <date>2004-12-05</date>
 <time>16:23:15</time>
 <version>
  <release>1.1.0</release>
  <api>1.1.0</api>
 </version>
 <stability>
  <release>stable</release>
  <api>stable</api>
 </stability>
 <license>PHP License</license>
 <notes>foo_win</notes>
 <contents>
  <dir name="/">
   <file md5sum="c81e728d9d4c2f636f067f89cc14862c" name="foo.dll" role="ext" />
  </dir>
 </contents>
 <dependencies>
  <required>
   <php>
    <min>4.3.0</min>
    <max>6.0.0</max>
   </php>
   <pearinstaller>
    <min>1.4.0dev13</min>
   </pearinstaller>
   <os>
    <name>windows</name>
   </os>
  </required>
 </dependencies>
 <providesextension>foo</providesextension>
 <srcpackage>foo</srcpackage>
 <extbinrelease>
  <installconditions />
  <filelist />
 </extbinrelease>
</package>',
          'url' => 'http://www.example.com/foo_win-1.1.0'));
$GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/foo_linux-1.1.0.tgz', $pathtopackagexml2);
$GLOBALS['pearweb']->addXmlrpcConfig('grob', 'package.getDownloadURL',
    array(array('channel' => 'grob', 'package' => 'foo_linux', 'version' => '1.1.0'), 'stable'),
    array('version' => '1.1.0',
          'info' =>
          '<?xml version="1.0"?>
<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
 <name>foo_linux</name>
 <channel>grob</channel>
 <summary>foo binary</summary>
 <description>foo binary for windows</description>
 <lead>
  <name><NAME></name>
  <user>cellog</user>
  <email><EMAIL></email>
  <active>yes</active>
 </lead>
 <date>2004-12-05</date>
 <time>16:22:47</time>
 <version>
  <release>1.1.0</release>
  <api>1.1.0</api>
 </version>
 <stability>
  <release>stable</release>
  <api>stable</api>
 </stability>
 <license>PHP License</license>
 <notes>foo_linux</notes>
 <contents>
  <dir name="/">
   <file md5sum="c81e728d9d4c2f636f067f89cc14862c" name="foo.so" role="ext" />
  </dir>
 </contents>
 <dependencies>
  <required>
   <php>
    <min>4.3.0</min>
    <max>6.0.0</max>
   </php>
   <pearinstaller>
    <min>1.4.0dev13</min>
   </pearinstaller>
   <os>
    <name>linux</name>
   </os>
  </required>
 </dependencies>
 <providesextension>foo</providesextension>
 <srcpackage>foo</srcpackage>
 <extbinrelease>
  <installconditions />
  <filelist />
 </extbinrelease>
</package>',
          'url' => 'http://www.example.com/foo_linux-1.1.0'));

$_test_dep->setPHPVersion('4.3.9');
$_test_dep->setPEARVersion('1.4.0a1');

$cf = new PEAR_ChannelFile;
$cf->setName('grob');
$cf->setServer('grob');
$cf->setSummary('grob');
$cf->setDefaultPEARProtocols();
$reg = &$config->getRegistry();
$reg->addChannel($cf);
$phpunit->assertNoErrors('channel add');

$a = new test_PEAR_Installer($fakelog);
$pf = new test_PEAR_PackageFile_v2;
$pf->setConfig($config);
$pf->setPackageType('extsrc');
$pf->addBinarypackage('foo_win');
$pf->setPackage('foo');
$pf->setChannel('grob');
$pf->setAPIStability('stable');
$pf->setReleaseStability('stable');
$pf->setAPIVersion('1.0.0');
$pf->setReleaseVersion('1.1.0');
$pf->setDate('2004-11-12');
$pf->setDescription('foo source');
$pf->setSummary('foo');
$pf->setLicense('PHP License');
$pf->setLogger($fakelog);
$pf->clearContents();
$pf->addFile('', 'foo.grop', array('role' => 'src'));
$pf->addBinarypackage('foo_linux');
$pf->addMaintainer('lead', 'cellog', '<NAME>', '<EMAIL>');
$pf->setNotes('blah');
$pf->setPearinstallerDep('1.4.0a1');
$pf->setPhpDep('4.2.0', '5.0.0');
$pf->setProvidesExtension('foo');

$phpunit->assertNotFalse($pf->validate(), 'first pf');

$dp = &newFakeDownloaderPackage(array());
$dp->setPackageFile($pf);
$b = array(&$dp);
$a->setDownloadedPackages($b);
$_test_dep->setOs('windows');
$pf->installBinary($a);
$phpunit->assertNoErrors('post-install');
$dld = $last_dl->getDownloadDir();
$cleandld = str_replace('\\\\', '\\', $last_dl->getDownloadDir());
if (OS_WINDOWS) {
    $phpunit->assertEquals(array (
      0 => 
      array (
        0 => 0,
        1 => 'Attempting to download binary version of extension "foo"',<commit_msg>attempted fix on linux<commit_after>--TEST--
PEAR_PackageFile_Parser_v2->installBinary()
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
    echo 'skip';
}
?>
--FILE--
<?php
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
require_once 'PEAR/ChannelFile.php';
$pathtopackagexml = dirname(__FILE__)  . DIRECTORY_SEPARATOR .
    'test_installBinary'. DIRECTORY_SEPARATOR . 'foo_win-1.1.0.tgz';
$pathtopackagexml2 = dirname(__FILE__)  . DIRECTORY_SEPARATOR .
    'test_installBinary'. DIRECTORY_SEPARATOR . 'foo_linux-1.1.0.tgz';
$GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/foo_win-1.1.0.tgz', $pathtopackagexml);
$GLOBALS['pearweb']->addXmlrpcConfig('grob', 'package.getDownloadURL',
    array(array('channel' => 'grob', 'package' => 'foo_win', 'version' => '1.1.0'), 'stable'),
    array('version' => '1.1.0',
          'info' =>
          '<?xml version="1.0"?>
<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
 <name>foo_win</name>
 <channel>grob</channel>
 <summary>foo binary</summary>
 <description>foo binary for windows</description>
 <lead>
  <name><NAME></name>
  <user>cellog</user>
  <email><EMAIL></email>
  <active>yes</active>
 </lead>
 <date>2004-12-05</date>
 <time>16:23:15</time>
 <version>
  <release>1.1.0</release>
  <api>1.1.0</api>
 </version>
 <stability>
  <release>stable</release>
  <api>stable</api>
 </stability>
 <license>PHP License</license>
 <notes>foo_win</notes>
 <contents>
  <dir name="/">
   <file md5sum="c81e728d9d4c2f636f067f89cc14862c" name="foo.dll" role="ext" />
  </dir>
 </contents>
 <dependencies>
  <required>
   <php>
    <min>4.3.0</min>
    <max>6.0.0</max>
   </php>
   <pearinstaller>
    <min>1.4.0dev13</min>
   </pearinstaller>
   <os>
    <name>windows</name>
   </os>
  </required>
 </dependencies>
 <providesextension>foo</providesextension>
 <srcpackage>foo</srcpackage>
 <extbinrelease>
  <installconditions />
  <filelist />
 </extbinrelease>
</package>',
          'url' => 'http://www.example.com/foo_win-1.1.0'));
$GLOBALS['pearweb']->addHtmlConfig('http://www.example.com/foo_linux-1.1.0.tgz', $pathtopackagexml2);
$GLOBALS['pearweb']->addXmlrpcConfig('grob', 'package.getDownloadURL',
    array(array('channel' => 'grob', 'package' => 'foo_linux', 'version' => '1.1.0'), 'stable'),
    array('version' => '1.1.0',
          'info' =>
          '<?xml version="1.0"?>
<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
 <name>foo_linux</name>
 <channel>grob</channel>
 <summary>foo binary</summary>
 <description>foo binary for windows</description>
 <lead>
  <name><NAME></name>
  <user>cellog</user>
  <email><EMAIL></email>
  <active>yes</active>
 </lead>
 <date>2004-12-05</date>
 <time>16:22:47</time>
 <version>
  <release>1.1.0</release>
  <api>1.1.0</api>
 </version>
 <stability>
  <release>stable</release>
  <api>stable</api>
 </stability>
 <license>PHP License</license>
 <notes>foo_linux</notes>
 <contents>
  <dir name="/">
   <file md5sum="c81e728d9d4c2f636f067f89cc14862c" name="foo.so" role="ext" />
  </dir>
 </contents>
 <dependencies>
  <required>
   <php>
    <min>4.3.0</min>
    <max>6.0.0</max>
   </php>
   <pearinstaller>
    <min>1.4.0dev13</min>
   </pearinstaller>
   <os>
    <name>linux</name>
   </os>
  </required>
 </dependencies>
 <providesextension>foo</providesextension>
 <srcpackage>foo</srcpackage>
 <extbinrelease>
  <installconditions />
  <filelist />
 </extbinrelease>
</package>',
          'url' => 'http://www.example.com/foo_linux-1.1.0'));

$_test_dep->setPHPVersion('4.3.9');
$_test_dep->setPEARVersion('1.4.0a1');

$cf = new PEAR_ChannelFile;
$cf->setName('grob');
$cf->setServer('grob');
$cf->setSummary('grob');
$cf->setDefaultPEARProtocols();
$reg = &$config->getRegistry();
$reg->addChannel($cf);
$phpunit->assertNoErrors('channel add');

$a = &new test_PEAR_Installer($fakelog);
$pf = new test_PEAR_PackageFile_v2;
$pf->setConfig($config);
$pf->setPackageType('extsrc');
$pf->addBinarypackage('foo_win');
$pf->setPackage('foo');
$pf->setChannel('grob');
$pf->setAPIStability('stable');
$pf->setReleaseStability('stable');
$pf->setAPIVersion('1.0.0');
$pf->setReleaseVersion('1.1.0');
$pf->setDate('2004-11-12');
$pf->setDescription('foo source');
$pf->setSummary('foo');
$pf->setLicense('PHP License');
$pf->setLogger($fakelog);
$pf->clearContents();
$pf->addFile('', 'foo.grop', array('role' => 'src'));
$pf->addBinarypackage('foo_linux');
$pf->addMaintainer('lead', 'cellog', '<NAME>', '<EMAIL>');
$pf->setNotes('blah');
$pf->setPearinstallerDep('1.4.0a1');
$pf->setPhpDep('4.2.0', '5.0.0');
$pf->setProvidesExtension('foo');

$phpunit->assertNotFalse($pf->validate(), 'first pf');

$dp = &newFakeDownloaderPackage(array());
$dp->setPackageFile($pf);
$b = array(&$dp);
$a->setDownloadedPackages($b);
$_test_dep->setOs('windows');
$pf->installBinary($a);
$phpunit->assertNoErrors('post-install');
$dld = $GLOBALS['last_dl']->getDownloadDir();
$cleandld = str_replace('\\\\', '\\', $GLOBALS['last_dl']->getDownloadDir());
if (OS_WINDOWS) {
    $phpunit->assertEquals(array (
      0 => 
      array (
        0 => 0,
        1 => 'Attempting to download binary version of extension "foo"',
{'fraction_non_alphanumeric': 0.23070866141732282, 'fraction_numerical': 0.03797025371828521, 'mean_word_length': 4.7269539078156315, 'pattern_counts': {'":': 0, '<': 307, '<?xml version=': 4, '>': 429, 'https://': 0, 'lorem ipsum': 0, 'www.': 12, 'xml': 24}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4149144', 'n_tokens_mistral': 4708, 'n_tokens_neox': 4501, 'n_words': 562}