Magento – Testing cron module

cronmagento-1.7module

having a module that just run through cron, can I test it without firing the cron process?
I installed AOE scheduler but even if I select the process and run it, I've to wait for the cron scheduling.

Is there any solution to run it like calling an url, bypassing the cron process?

thanks very much

Best Answer

The best way to test cron methods in any new controller action. There is no difference between method, which executes by cron and any other observer method.

You can create your own controller (or use any existing controller and temporarily call there this action).

Following solution is not very clean. Purpose of this solution only understand what do you need:

For example there is ProductController.

app/code/core/Mage/Catalog/controllers/ProductController.php

This controller has many different actions, like viewAction, etc... You can create any new action like cronAction and put there your call there:

Mage::getModel('yourmodulename/observer')->yourCronMethod();

Don't forget to write your existed module, class and method names. After that call in browser

http://host/catalog/product/cron

Related Topic