2 require_once 'ModuleInstall/PackageManager/PackageManager.php';
4 class Bug39980Test extends Sugar_PHPUnit_Framework_TestCase
7 public function tearDown()
9 if (is_file(Bug39980PackageManger::$manifest_location))
10 unlink(Bug39980PackageManger::$manifest_location);
13 public function testGetinstalledPackagesUninstallable()
15 $pm = new Bug39980PackageManger();
16 $pm->extractManifest(0, 0);
17 $packs = $pm->getinstalledPackages();
18 //Its confusing, but "UNINSTALLABLE" in file_install means the package is NOT uninstallable
19 $this->assertEquals("UNINSTALLABLE", $packs[0]['file_install']);
24 class Bug39980PackageManger extends PackageManager {
25 static $manifest_location = "cache/Bug39980manifest.php";
27 public function __construct() {
28 parent::__construct();
29 $this->manifest_content = <<<EOQ
32 'acceptable_sugar_versions' =>
36 'acceptable_sugar_flavors' =>
45 'is_uninstallable' => false,
46 'name' => 'test_file_1',
47 'published_date' => '2010-10-20 22:10:01',
49 'version' => '1287612601',
50 'remove_tables' => 'prompt',
52 \$installdefs = array (
57 'from' => '<basepath>/Extension/modules/Cases/Ext/Vardefs/dummy_extension2.php',
58 'to' => 'custom/Extension/modules/Cases/Ext/Vardefs/dummy_extension2.php',
66 public function getInstalled($types)
68 include($this->extractManifest(0,0));
70 'manifest' => (isset($manifest) ? $manifest : ''),
71 'installdefs' => (isset($installdefs) ? $installdefs : ''),
72 'upgrade_manifest' => (isset($upgrade_manifest) ? $upgrade_manifest : '')
76 'filename' => Bug39980PackageManger::$manifest_location,
77 'manifest' => base64_encode(serialize($sm)),
78 'date_entered' => '1/1/2010',
80 'module_dir' => 'Administration' ,
81 'id' => 'b4d22740-4e96-65b3-b712-4ca230d95987' ,
82 'md5sum' => 'fe221d731d8c624f15712878300aa907' ,
84 'version' => '1285697780' ,
85 'status' => 'installed' ,
86 'name' => 'test_file_1' ,
94 public function extractManifest($filename, $base_tmp_upgrade_dir)
96 if (!is_file(Bug39980PackageManger::$manifest_location))
97 file_put_contents(Bug39980PackageManger::$manifest_location, $this->manifest_content);
99 return Bug39980PackageManger::$manifest_location;