Issue generating skeleton classes
Hannes Papenberg <hackwar06 <at> googlemail.com>
2011-10-26 15:59:21 GMT
Hi folks,
I'm trying to generate skeleton classes from the code of the Joomla
framework and ran into issues. Basically, the script stops without doing
anything for several files of the code base and I tried it with several
different ways. I also traced it to one line of the code of phpunit.
Maybe you can help? Here is what I did:
I ran "phpunit --skeleton-test JUpdater updater.php" in the folder where
this file resides. The file is attached to this post. PHPUnit starts and
then terminates directly again and the only output is this:
# phpunit --skeleton-test JUpdater updater.php
PHPUnit 3.5.15 by Sebastian Bergmann.
^Notice the empty line above
I was able to trace it to /PHPUnit/TextUI/Command.php line 711, where it
fails without throwing an error or doing anything. That line contains
the following on my installation:
$skeleton = $reflector->newInstanceArgs($args);
My install is PHPUnit 3.5.15 on PHP 5.3.8, Apache 2.2.21 on Win7x64.
When using Netbeans to generate a range of skeleton test files, dozens
if not even hundreds of my files get skipped. Am I missing something
here? Does it fail because of missing parent classes of the class to
generate skeletons for?
I would be glad if you could help. Thanks!
Hannes
getDBO();
$retval = false;
// Push it into an array
if (!is_array($eid))
{
$query = 'SELECT DISTINCT update_site_id, type, location FROM #__update_sites WHERE enabled = 1';
}
else
{
$query = 'SELECT DISTINCT update_site_id, type, location FROM #__update_sites' .
' WHERE update_site_id IN' .
' (SELECT update_site_id FROM #__update_sites_extensions WHERE extension_id IN ('. implode(',', $eid) . '))';
}
$dbo->setQuery($query);
$results = $dbo->loadAssocList();
$result_count = count($results);
for ($i = 0; $i setAdapter($result['type']);
if (!isset($this->_adapters[$result['type']]))
{
// Ignore update sites requiring adapters we don't have installed
continue;
}
$update_result = $this->_adapters[$result['type']]->findUpdate($result);
if (is_array($update_result))
{
if (array_key_exists('update_sites', $update_result) && count($update_result['update_sites']))
{
$results = JArrayHelper::arrayUnique(array_merge($results, $update_result['update_sites']));
$result_count = count($results);
}
if (array_key_exists('updates', $update_result) && count($update_result['updates']))
{
for ($k = 0, $count = count($update_result['updates']); $k find(
array(
'element' => strtolower($current_update->get('element')), 'type' => strtolower($current_update->get('type')),
'client_id' => strtolower($current_update->get('client_id')),
'folder' => strtolower($current_update->get('folder'))
)
);
$eid = $extension
->find(
array(
'element' => strtolower($current_update->get('element')), 'type' => strtolower($current_update->get('type')),
'client_id' => strtolower($current_update->get('client_id')),
'folder' => strtolower($current_update->get('folder'))
)
);
if (!$uid)
{
// Set the extension id
if ($eid)
{
// We have an installed extension, check the update is actually newer
$extension->load($eid);
$data = json_decode($extension->manifest_cache, true);
if (version_compare($current_update->version, $data['version'], '>') == 1)
{
$current_update->extension_id = $eid;
$current_update->store();
}
}
else
{
// A potentially new extension to be installed
$current_update->store();
}
}
else
{
$update->load($uid);
// if there is an update, check that the version is newer then replaces
if (version_compare($current_update->version, $update->version, '>') == 1)
{
$current_update->store();
}
}
}
}
$update_result = true;
}
elseif ($retval)
{
$update_result = true;
}
}
return $retval;
}
/**
* Multidimensional array safe unique test
*
* <at> param array $myArray The source array.
*
* <at> return array
*
* <at> deprecated 12.1
* <at> note Use JArrayHelper::arrayUnique() instead.
* <at> note Borrowed from PHP.net
* <at> see http://au2.php.net/manual/en/function.array-unique.php
* <at> since 11.1
*
*/
public function arrayUnique($myArray)
{
JLog::add('JUpdater::arrayUnique() is deprecated. See JArrayHelper::arrayUnique().', JLog::WARNING, 'deprecated');
return JArrayHelper::arrayUnique($myArray);
}
/**
* Finds an update for an extension
*
* <at> param integer $id Id of the extension
*
* <at> return mixed
*
* <at> since 11.1
*/
public function update($id)
{
$updaterow = JTable::getInstance('update');
$updaterow->load($id);
$update = new JUpdate;
if ($update->loadFromXML($updaterow->detailsurl))
{
return $update->install();
}
return false;
}
}