/** * @param int $storage * @param int $callNum * @param bool|null $expected * @dataProvider fileExistsDataProvider */ public function testFileExists($storage, $callNum, $expected) { $this->configMock->expects($this->once())->method('getValue')->with(\Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA, 'default')->will($this->returnValue($storage)); $dbModelMock = $this->getMockBuilder('Magento\\Core\\Model\\File\\Storage\\Database')->disableOriginalConstructor()->getMock(); $this->dbStorageFactoryMock->expects($this->exactly($callNum))->method('create')->will($this->returnValue($dbModelMock)); $dbModelMock->expects($this->exactly($callNum))->method('fileExists')->with('file')->will($this->returnValue(true)); $this->assertEquals($expected, $this->helper->fileExists('media-dir/file')); }