1]); $registry = $this->createPartialMock(\Magento\Framework\Registry::class, ['registry']); $registry->expects( $this->once() )->method( 'registry' )->with( 'current_shipment' )->will( $this->returnValue($shipment) ); $carrier = $this->createPartialMock( \Magento\OfflineShipping\Model\Carrier\Freeshipping::class, ['isTrackingAvailable', 'getConfigData'] ); $carrier->expects($this->once())->method('isTrackingAvailable')->will($this->returnValue(true)); $carrier->expects( $this->once() )->method( 'getConfigData' )->with( 'title' )->will( $this->returnValue('configdata') ); $config = $this->createPartialMock(\Magento\Shipping\Model\Config::class, ['getAllCarriers']); $config->expects( $this->once() )->method( 'getAllCarriers' )->with( 1 )->will( $this->returnValue(['free' => $carrier]) ); /** @var \Magento\Shipping\Block\Adminhtml\Order\Tracking $model */ $model = $helper->getObject( \Magento\Shipping\Block\Adminhtml\Order\Tracking::class, ['registry' => $registry, 'shippingConfig' => $config] ); $this->assertEquals(['custom' => 'Custom Value', 'free' => 'configdata'], $model->getCarriers()); } }