File: test_bug4072.phpt

package info (click to toggle)
php-pear 1%3A1.10.13%2Bsubmodules%2Bnotgz%2B2022032202-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 18,516 kB
  • sloc: php: 52,984; ansic: 39,986; xml: 33,175; yacc: 677; pascal: 452; makefile: 122; sh: 114
file content (136 lines) | stat: -rw-r--r-- 3,614 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
--TEST--
list-all command, bug #4072 - installed packages not listed for list-all -c option
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
    echo 'skip';
}
?>
--FILE--
<?php

require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'setup.php.inc';

$_test_dep->setPHPVersion('4.3.10');
$_test_dep->setPEARVersion('1.4.0a10');
$reg = &$config->getRegistry();

$ch = new PEAR_ChannelFile;
$ch->setName('smoog');
$ch->setSUmmary('smooging about');
$ch->setBaseURL('REST1.0', 'http://smoog/rest/');
$reg->addChannel($ch);

$pf = new PEAR_PackageFile_v2_rw;
$pf->setConfig($config);
$pf->setPackage('APC');
$pf->setChannel('smoog');
$pf->setAPIStability('stable');
$pf->setReleaseStability('stable');
$pf->setAPIVersion('1.2.0');
$pf->setReleaseVersion('1.2.0');
$pf->setSummary('foo');
$pf->setDate(date('Y-m-d'));
$pf->setDescription('foo');
$pf->setLicense('PHP License');
$pf->setNotes('foo');
$pf->addMaintainer('lead', 'cellog', 'Greg', 'cellog@php.net');
$pf->setPackageType('php');
$pf->clearContents();
$pf->addFile('', 'foo.dat', array('role' => 'data'));
$pf->setPhpDep('4.0.0', '6.0.0');
$pf->setPearinstallerDep('1.4.0a10');
$pf->addRelease();
$pf->validate();
$phpunit->assertNoErrors('setup');
$reg->addPackage2($pf);

$pearweb->addRESTConfig('http://smoog/rest/p/packages.xml',
'<?xml version="1.0" ?>
<a xmlns="http://pear.php.net/dtd/rest.allpackages"
    xsi:schemaLocation="http://pear.php.net/dtd/rest.allpackages
    http://pear.php.net/dtd/rest.allpackages.xsd">
<c>smoog</c>
 <p>APC</p>
</a>',
'text/xml');

$pearweb->addRESTConfig("http://smoog/rest/p/apc/info.xml",
'<?xml version="1.0" encoding="UTF-8" ?>
<p xmlns="http://pear.php.net/dtd/rest.package"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xlink="http://www.w3.org/1999/xlink"    xsi:schemaLocation="http://pear.php.net/dtd/rest.package    http://pear.php.net/dtd/rest.package.xsd">
 <n>APC</n>
 <c>smoog</c>
 <ca xlink:href="/rest/c/Caching">Caching</ca>
 <l>PHP License</l>
 <s>Alternative PHP Cache</s>

 <d>APC is a free, open, and robust framework for caching and optimizing PHP intermediate code.</d>
 <r xlink:href="/rest/r/apc"/>
</p>',
'text/xml');

$pearweb->addRESTConfig("http://smoog/rest/r/apc/deps.2.0.4.txt", 'b:0;', 'text/plain');

$pearweb->addRESTConfig('http://smoog/rest/r/apc/allreleases.xml',
'<?xml version="1.0"?>
<a xmlns="http://pear.php.net/dtd/rest.allreleases"
    xsi:schemaLocation="http://pear.php.net/dtd/rest.allreleases
    http://pear.php.net/dtd/rest.allreleases.xsd">
 <p>APC</p>
 <c>smoog</c>
 <r><v>2.0.4</v><s>stable</s></r>
</a>',
'text/xml');


$reg = &$config->getRegistry();
$e = $command->run('list-all', array('channel' => 'smoog'), array());
$phpunit->assertEquals(array (
  0 =>
  array (
    0 => 'Retrieving data...0%',
    1 => true,
  ),
  1 =>
  array (
    'info' =>
    array (
      'caption' => 'All packages [Channel smoog]:',
      'border' => true,
      'headline' =>
      array (
        0 => 'Package',
        1 => 'Latest',
        2 => 'Local',
      ),
      'channel' => 'smoog',
      'data' =>
      array (
        'Caching' =>
        array (
          0 =>
          array (
            0 => 'smoog/APC',
            1 => '2.0.4',
            2 => '1.2.0',
            3 => 'Alternative PHP Cache',
            4 =>
            array (
            ),
          ),
        ),
      ),
    ),
    'cmd' => 'list-all',
  ),
), $fakelog->getLog(), 'smoog log');
$phpunit->assertNoErrors('smoog');
echo 'tests done';
?>
--CLEAN--
<?php
require_once dirname(dirname(__FILE__)) . '/teardown.php.inc';
?>
--EXPECT--
tests done