Ejemplo n.º 1
0
 /**
  * @magentoAppArea adminhtml
  */
 public function testSaveDelete()
 {
     $first = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Store\\Model\\Group');
     $first->setData(['website_id' => 1, 'name' => 'test 1', 'root_category_id' => 1, 'default_store_id' => 1]);
     $second = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Store\\Model\\Group');
     $second->setData(['website_id' => 1, 'name' => 'test 2', 'root_category_id' => 1, 'default_store_id' => 1]);
     $first->save();
     $this->_model->addObject($first)->addObject($second, 'second');
     $this->_model->save();
     $this->assertNotEmpty($first->getId());
     $this->assertNotEmpty($second->getId());
     $this->_model->delete();
     $test = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Store\\Model\\Group');
     $test->load($first->getId());
     $this->assertEmpty($test->getId());
 }
 /**
  * @magentoAppArea adminhtml
  */
 public function testSaveDelete()
 {
     /** @var Flag $first */
     $first = $this->objectManager->create(Flag::class, ['data' => ['flag_code' => 'test1']]);
     $first->setFlagData('test1data');
     $second = $this->objectManager->create(Flag::class, ['data' => ['flag_code' => 'test2']]);
     $second->setFlagData('test2data');
     $first->save();
     $this->_model->addObject($first)->addObject($second, 'second');
     $this->_model->save();
     $this->assertNotEmpty($first->getId());
     $this->assertNotEmpty($second->getId());
     $this->_model->delete();
     $test = $this->objectManager->create(Flag::class);
     $test->load($first->getId());
     $this->assertEmpty($test->getId());
 }