_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); } /** * @magentoDataFixture Magento/Store/_files/store.php * @magentoDataFixture Magento/Tax/_files/tax_classes.php */ public function testGetTitles() { /** @var \Magento\Tax\Model\Calculation\Rate $rate */ $rate = $this->_objectManager->create(\Magento\Tax\Model\Calculation\Rate::class); $rate->load(1); /** @var \Magento\Store\Model\Store $store */ $store = $this->_objectManager->get(\Magento\Store\Model\Store::class); $store->load('test', 'code'); $title = 'title'; $rate->saveTitles([$store->getId() => $title]); $coreRegistry = $this->_objectManager->create(\Magento\Framework\Registry::class); $coreRegistry->register(RegistryConstants::CURRENT_TAX_RATE_ID, 1); /** @var \Magento\Tax\Block\Adminhtml\Rate\Title $block */ $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Tax\Block\Adminhtml\Rate\Title::class, [ 'coreRegistry' => $coreRegistry, ] ); $titles = $block->getTitles(); $this->assertArrayHasKey($store->getId(), $titles, 'Store was not created'); $this->assertEquals($title, $titles[$store->getId()], 'Invalid Tax Title'); } }