-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Method Mage_GiftMessage_Model_Observer::checkoutEventCreateOrder() does not exist #1154
Comments
Nice find! Just delete the XML I suppose.. |
Seems right. Looks like the event name is built with fullActionName but |
@midlan btw can you share your test? It would be nice to get it integrated in openmage. |
@tmotyl I already work on a PR for N98-magerun ... |
@tmotyl my test looks is this: <?php
use Tester\Assert;
/**
* @testCase
*/
class ObserversTest extends Tester\TestCase {
public function testObservers() {
$eventAreas = array(
Mage_Core_Model_App_Area::AREA_GLOBAL,
Mage_Core_Model_App_Area::AREA_FRONTEND,
Mage_Core_Model_App_Area::AREA_ADMINHTML,
);
foreach ($eventAreas as $eventArea) {
$eventConfig = Mage::app()->getConfig()->getNode(sprintf('%s/events', $eventArea));
if ($eventConfig instanceof Mage_Core_Model_Config_Element) {
foreach ($eventConfig->children() as $eventName => $event) {
foreach ($event->observers->children() as $observerName => $observer) {
/** create observer instance @see Mage_Core_Model_App::dispatchEvent */
$getInstanceMethod = 'getSingleton'; //singleton is default
switch($observer->type ?? '') {
case 'disabled':
continue 2; //do not check disabled observers
case 'object':
case 'model':
$getInstanceMethod = 'getModel';
break;
}
//check object exists
$modelClass = (string) $observer->class;
$observerInstance = Mage::{$getInstanceMethod}($modelClass);
Assert::type(
'object',
$observerInstance,
"Model '{$modelClass}' was not found. (observer: {$observerName}; event: {$eventName})"
);
//check method is public
$method = (string) $observer->method;
try {
$reflection = new ReflectionMethod($observerInstance, $method);
}
catch (ReflectionException $e) {
throw new Exception($e->getMessage() . " (observer: {$observerName}; event: {$eventName})");
}
Assert::true(
$reflection->isPublic(),
"Method '{$modelClass}::{$method}' is not public. (observer: {$observerName}; event: {$eventName})"
);
}
}
}
}
}
} It is not phpunit but nette/tester; but I think migrations should be pretty easy |
#1156 |
@midlan we could also add a testrun to our github action with nette/tester if this is more comfortable. |
Phpunit is more stable (more users, more development). We are using nette-tester because it runs in multiple threads so the tests are finished in less time. |
@midlan do you have more tests? This is getting off-topic, but the community would benefit a lot from more tests. |
I have lots of tests for our modules, but I have some for core:
Maybe we can discus it in discussion? |
Can we close this issue? |
yeah, it is fixed: |
I have created test to test all observers and it screams:
Exception: Method Mage_GiftMessage_Model_Observer::checkoutEventCreateOrder() does not exist (observer: giftmessage; event: adminhtml_sales_order_create_create_order)
Event definition:
app/code/core/Mage/GiftMessage/etc/config.xml
And it is right, there is no such method there:
https://github.com/OpenMage/magento-lts/blob/1.9.4.x/app/code/core/Mage/GiftMessage/Model/Observer.php
The text was updated successfully, but these errors were encountered: