_objectManager = $this->createMock(\Magento\Framework\ObjectManagerInterface::class); $this->_model = new \Magento\Framework\Backup\Factory($this->_objectManager); } /** * @expectedException \Magento\Framework\Exception\LocalizedException */ public function testCreateWrongType() { $this->_model->create('WRONG_TYPE'); } /** * @param string $type * @dataProvider allowedTypesDataProvider */ public function testCreate($type) { $this->_objectManager->expects($this->once())->method('create')->will($this->returnValue('ModelInstance')); $this->assertEquals('ModelInstance', $this->_model->create($type)); } /** * @return array */ public function allowedTypesDataProvider() { return [['db'], ['snapshot'], ['filesystem'], ['media'], ['nomedia']]; } }