1
1
<?php
2
2
/**
3
- * Copyright © Magento, Inc. All rights reserved.
4
- * See COPYING.txt for license details .
3
+ * Copyright 2019 Adobe
4
+ * All Rights Reserved .
5
5
*/
6
6
declare (strict_types=1 );
7
7
8
8
namespace Magento \Catalog \Model \Indexer \Category \Product \Action ;
9
9
10
10
use Magento \Catalog \Model \Indexer \Category \Product \Action \Full as OriginObject ;
11
+ use Magento \Framework \Module \Manager ;
11
12
use Magento \TestFramework \Catalog \Model \Indexer \Category \Product \Action \Full as PreferenceObject ;
12
13
use Magento \Framework \Interception \PluginListInterface ;
13
14
use Magento \TestFramework \Helper \Bootstrap ;
@@ -35,6 +36,11 @@ class FullTest extends \PHPUnit\Framework\TestCase
35
36
*/
36
37
private $ objectManager ;
37
38
39
+ /**
40
+ * @var Manager
41
+ */
42
+ private Manager $ moduleManager ;
43
+
38
44
/**
39
45
* @inheritDoc
40
46
*/
@@ -45,6 +51,7 @@ protected function setUp(): void
45
51
$ this ->objectManager ->addSharedInstance ($ preferenceObject , OriginObject::class);
46
52
$ this ->interceptor = $ this ->objectManager ->get (OriginObject::class);
47
53
$ this ->pluginList = $ this ->objectManager ->get (PluginListInterface::class);
54
+ $ this ->objectManager ->get (Manager::class);
48
55
}
49
56
50
57
/**
@@ -63,7 +70,14 @@ public function testPreference()
63
70
$ interceptorClassName = get_class ($ this ->interceptor );
64
71
65
72
// Check interceptor class name
66
- $ this ->assertEquals ($ interceptorClassName , PreferenceObject::class . '\Interceptor ' );
73
+ if ($ this ->moduleManager ->isEnabled ('Magento_Staging ' )) {
74
+ $ this ->assertEquals (
75
+ '\Magento\Staging\Model\Indexer\Category\Product\Action\Full\Interceptor ' ,
76
+ $ interceptorClassName
77
+ );
78
+ } else {
79
+ $ this ->assertEquals (PreferenceObject::class . '\Interceptor ' , $ interceptorClassName );
80
+ }
67
81
68
82
//check that there are no fatal errors
69
83
$ this ->pluginList ->getNext ($ interceptorClassName , 'execute ' );
0 commit comments