canRead($filename)); } public function providerCanReadVerySmallFile() { $padding = str_repeat('a', 2048); return [ [true, ' ' . $padding . ' '], [true, ' ' . $padding . ''], [true, ''], [false, ''], ]; } /** * @dataProvider providerCanReadVerySmallFile * * @param bool $expected * @param string $content */ public function testCanReadVerySmallFile($expected, $content) { $filename = tempnam(sys_get_temp_dir(), 'html'); file_put_contents($filename, $content); $reader = new Html(); $actual = $reader->canRead($filename); unlink($filename); self::assertSame($expected, $actual); } public function testBackgroundColorInRanding() { $html = '
Blue background
'; $filename = tempnam(sys_get_temp_dir(), 'html'); file_put_contents($filename, $html); $reader = new Html(); $spreadsheet = $reader->load($filename); $firstSheet = $spreadsheet->getSheet(0); $style = $firstSheet->getCell('A1')->getStyle(); self::assertEquals('FFFFFF', $style->getFont()->getColor()->getRGB()); unlink($filename); } }