88namespace Magento \SalesGraphQl \Test \Unit \Model \Resolver ;
99
1010use Magento \Framework \GraphQl \Query \Resolver \ContextInterface ;
11- use Magento \Sales \Api \Data \ OrderExtensionInterface ;
11+ use Magento \Framework \Api \ExtensionAttributesInterface ;
1212use PHPUnit \Framework \MockObject \MockObject ;
1313use PHPUnit \Framework \TestCase ;
1414use Magento \SalesGraphQl \Model \Resolver \OrderTotal ;
1515use Magento \Sales \Api \Data \OrderInterface ;
16- use Magento \Quote \Model \QuoteFactory ;
1716use Magento \Framework \GraphQl \Config \Element \Field ;
1817use Magento \Framework \GraphQl \Schema \Type \ResolveInfo ;
1918use Magento \Framework \Exception \LocalizedException ;
@@ -46,7 +45,7 @@ class OrderTotalTest extends TestCase
4645 private $ resolveInfoMock ;
4746
4847 /**
49- * @var OrderExtensionInterface |MockObject
48+ * @var ExtensionAttributesInterface |MockObject
5049 */
5150 private $ extensionAttributesMock ;
5251
@@ -55,7 +54,6 @@ protected function setUp(): void
5554 $ this ->contextMock = $ this ->createMock (ContextInterface::class);
5655 $ this ->fieldMock = $ this ->createMock (Field::class);
5756 $ this ->resolveInfoMock = $ this ->createMock (ResolveInfo::class);
58- $ this ->extensionAttributesMock = $ this ->createMock (OrderExtensionInterface::class);
5957 $ this ->orderMock = $ this ->createMock (OrderInterface::class);
6058 $ this ->orderMock ->method ('getOrderCurrencyCode ' )->willReturn ('USD ' );
6159 $ this ->orderMock ->method ('getBaseCurrencyCode ' )->willReturn ('USD ' );
@@ -76,12 +74,12 @@ public function testResolve(): void
7674 $ resolveInfoMock = $ this ->createMock (ResolveInfo::class);
7775 $ value = ['model ' => $ this ->orderMock ];
7876 $ args = [];
79- $ this ->extensionAttributesMock -> expects ( $ this ->once () )
80- ->method ( 'getAppliedTaxes ' )
81- ->willReturn ([]);
82- $ this -> extensionAttributesMock -> expects ( $ this -> once ())
83- -> method ('getItemAppliedTaxes ' )
84- ->willReturn ([]);
77+ $ this ->extensionAttributesMock = $ this ->getMockBuilder (ExtensionAttributesInterface::class )
78+ ->addMethods ([ 'getAppliedTaxes ' , ' getItemAppliedTaxes ' ] )
79+ ->disableOriginalConstructor ()
80+ -> getMock ();
81+ $ this -> extensionAttributesMock -> expects ( $ this -> once ())-> method ('getAppliedTaxes ' )-> willReturn ([]);
82+ $ this -> extensionAttributesMock -> expects ( $ this -> once ())-> method ( ' getItemAppliedTaxes ' ) ->willReturn ([]);
8583 $ this ->orderMock ->method ('getExtensionAttributes ' )->willReturn ($ this ->extensionAttributesMock );
8684 $ result = $ this ->orderTotal ->resolve ($ fieldMock , $ this ->contextMock , $ resolveInfoMock , $ value , $ args );
8785 $ this ->assertArrayHasKey ('base_grand_total ' , $ result );
0 commit comments