That's an odd behaviour. Any unit test we can look at?
Your test/ and config/environment are outdated
On changeset 468 we removed that line from config/environments/testing.php
Try to update your test and /environment folders in your application with the latest version.
In test you just need to update unit.php, app.php and fixtures/app/config
Sorry I should have said test/fixtures/config
Ok, I've tracked it down to a strange issue with Ak::make_dir. It goes into an infinite loop and then causes a seg fault. Here's the function:
function make_dir($path, $options = array())
{
error_log("Make_dir path:".var_export($path,TRUE), 1,"suthern101@gmail.com");
error_log("Make_dir options:".var_export($options,TRUE), 1,"suthern101@gmail.com");
$default_options = array(
'ftp' => defined('AK_UPLOAD_FILES_USING_FTP') && AK_UPLOAD_FILES_USING_FTP,
'base_path' => AK_BASE_DIR
);
$options = array_merge($default_options, $options);
$path = trim(str_replace($options['base_path'], '',$path),DS);
if($options['ftp']){
require_once(AK_LIB_DIR.DS.'AkFtp.php');
$path = trim(str_replace(array(DS,'//'),array('/','/'),$path),'/');
return AkFtp::make_dir($path);
}else{
$path = $options['base_path'].DS.$path;
if (!file_exists($path)){
Ak::make_dir(dirname($path), $options);
return mkdir($path);
}
}
return false;
}
Note my two error_log calls.. My e-mail box was flooding with messages until I hit ctrl-c to quite the ./script/test process. Here are the two arguments that are being passed to it.
$path = NULL
$options = array (
'ftp' => false,
'base_path' => '/home/sambaserve/web/apps/inventory/test/tmp',
)
make_dir is being called from Ak::file_put_contents, which is called from AkInstaller::SetInstalledVersion, which is called from AkInstaller::getInstalledVersion, which is called from AkInstaller::_upgradeOrDowngrade, which is called from AkInstall::install which is called from AkUnitTest::installAndIncludeModels which is called from function test_setup inside /test/unit/app/models/spots_transfers.php.
I've gotten around the seg fault by manually creating /test/tmp/install_versions/ and thus no segfault anymore.
Here's the next problem:
[me@server]$ ./script/test unit/app/models/spots_transfers
SpotsTransfersTestCase
OK
Test cases run: 1/1, Passes: 0, Failures: 0, Exceptions: 0
/home/sambaserve/web/apps/inventory/test/unit/app/models/spots_transfers.php
Fatal error: Cannot redeclare class SpotsTransfersTestCase in
/home/sambaserve/web/apps/inventory/test/unit/app/models/spots_transfers.php on line 18
With something VERY simple in the spots_transfers.php file:
<?php
// To run this test calling ./script/test unit/app/models/spots_transfers // More about testing at
http://wiki.akelos.org/testing-guide
class SpotsTransfersTestCase extends AkUnitTest
{
/*
function test_setup()
{
$this->installAndIncludeModels('SpotsTransfers');
}
function test_SpotsTransfers()
{
$this->assertTrue(false,'Unit test for SpotsTransfers not implemented');
}
*/
}
?>
Such a simple test (It's even commented out!!), and I still get the error. Is this normal?
Thanks for the svn update to fix the recursive make_dir bug. You're fast!
Try
./script/test model spots_transfers
or
php ./test/unit/app/models/spots_transfers
Thanks to Kaste!
solved the recursive call in [561]
can't reproduce the second failure though.
oops, we're all in now.
I'm working on a unit test, but now after doing an svn revert and update I'm getting this:
[me@host]$ ./script/test model SpotsTransfers
PHP Warning: Call-time pass-by-reference has been deprecated - argument passed by value; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file. However, future versions may not support this any longer. in /home/sambaserve/web/akelos/lib/AkObject.php on line 67
Content-type: text/html
X-Powered-By: PHP/4.3.9
I've defined ALLOW_CALL_TIME_PASS_REFERENCE as true in both /config/config.php and /test/fixtures/config/config.php. Need I define it somewhere else? Also note that when I do phpinfo, it tells me I'm running 5.2.something. But X-Powered-By: says 4.3.9! Could it be that running ./script uses a different php engine than the xampp install? Hmm...
I am quite sure that your command line php is not the same as the web php. You can check that by running "php -v" on the shell.
Hope this helps.
Yup, you are right. php -v tells me it's running php 4.3.9.
I also solved the strange save() behavior by changing my beforeSave() function into a afterValidation() function. Now I've just got to figure out how to change running php engine to point at lampp's php executable (so the versions match).
Thank you all for your help!
Changing the default search path should be easy: "export PATH=/path/to/php5/bin:$PATH" Another trick would be to change the first line in ./script to "#!/path/to/php5/bin/php5" Just try it.
I modified ./script/test for now. Thanks again!
1 to 22 of 22