feat: add videodb media index with Docker stack
- Add videodb PHP/MySQL media collection manager (Blu-ray, DVD, CD) - Dockerfile: PHP 8.1 + Apache with GD/mysqli/exif extensions - docker-compose.yml: app on port 6761 + MySQL 8.0 with health checks - docker-entrypoint.sh: auto-generates config.inc.php from env vars, waits for MySQL, initializes DB schema idempotently - init-db.php: CLI schema installer using app's own prefix_query() logic - Persistent volumes for DB, cache, and cover images Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
81
videodb/vendor/pear/spreadsheet_excel_writer/test/Test/Spreadsheet/Excel/Writer/WorkbookTest.php
vendored
Normal file
81
videodb/vendor/pear/spreadsheet_excel_writer/test/Test/Spreadsheet/Excel/Writer/WorkbookTest.php
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @author stev leibelt <artodeto@bazzline.net>
|
||||
* @since 2016-01-17
|
||||
*/
|
||||
class Test_Spreadsheet_Excel_Writer_WorkbookTest extends Test_Spreadsheet_Excel_WriterTestCase
|
||||
{
|
||||
public static function doSetUpBeforeClass()
|
||||
{
|
||||
// Preload constants from OLE
|
||||
@class_exists(OLE::class);
|
||||
}
|
||||
|
||||
public function testSetVersion()
|
||||
{
|
||||
$workbook = $this->getNewWorkbook();
|
||||
|
||||
$before = get_object_vars($workbook);
|
||||
|
||||
$workbook->setVersion(1);
|
||||
|
||||
$this->assertEquals($before, get_object_vars($workbook), "Version 1 should not change internal state");
|
||||
|
||||
$workbook->setVersion(8);
|
||||
|
||||
$this->assertNotEquals($before, get_object_vars($workbook), "Version 8 should change internal state");
|
||||
|
||||
return $workbook;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSetVersion
|
||||
*/
|
||||
public function testWriteSingleCell(Spreadsheet_Excel_Writer $workbook)
|
||||
{
|
||||
$sheet = $workbook->addWorksheet("Example");
|
||||
$sheet->write(0, 0, "Example");
|
||||
|
||||
$this->assertSameAsInFixture('example.xls', $workbook);
|
||||
}
|
||||
|
||||
public function testWriteWithFormat()
|
||||
{
|
||||
$workbook = $this->getNewWorkbook();
|
||||
$workbook->setVersion(8);
|
||||
|
||||
$format = $workbook->addFormat();
|
||||
$format->setFontFamily('Helvetica');
|
||||
$format->setSize(16);
|
||||
$format->setVAlign('vcenter');
|
||||
$format->setBorder(1);
|
||||
|
||||
$sheet = $workbook->addWorksheet('Example report');
|
||||
$sheet->setInputEncoding('utf-8');
|
||||
|
||||
$sheet->setColumn(0, 10, 35);
|
||||
|
||||
$sheet->writeString(0, 0, "Test string", $format);
|
||||
$sheet->setRow(0, 40);
|
||||
|
||||
$sheet->writeString(1, 0, "こんにちわ");
|
||||
|
||||
$this->assertSameAsInFixture('with_format.xls', $workbook);
|
||||
}
|
||||
|
||||
public function testWithDefaultVersion()
|
||||
{
|
||||
$workbook = $this->getNewWorkbook();
|
||||
|
||||
$sheet = $workbook->addWorksheet("Example");
|
||||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
for ($j = 0; $j < 10; $j++) {
|
||||
$sheet->write($i, $j, "Row $i $j");
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertSameAsInFixture('example2.xls', $workbook);
|
||||
}
|
||||
}
|
||||
55
videodb/vendor/pear/spreadsheet_excel_writer/test/Test/Spreadsheet/Excel/WriterTestCase.php
vendored
Normal file
55
videodb/vendor/pear/spreadsheet_excel_writer/test/Test/Spreadsheet/Excel/WriterTestCase.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @author stev leibelt <artodeto@bazzline.net>
|
||||
* @since 2016-01-17
|
||||
*/
|
||||
class Test_Spreadsheet_Excel_WriterTestCase extends \LegacyPHPUnit\TestCase
|
||||
{
|
||||
const FIXTURES_PATH = 'test/fixture/';
|
||||
|
||||
/**
|
||||
* @param string $filename
|
||||
* @return Spreadsheet_Excel_Writer
|
||||
*/
|
||||
protected function getNewWorkbook($filename = '')
|
||||
{
|
||||
// we're writing to the standard output by defaulr
|
||||
return new Spreadsheet_Excel_Writer($filename);
|
||||
}
|
||||
|
||||
protected function assertSameAsInFixture($filename, Spreadsheet_Excel_Writer $workbook)
|
||||
{
|
||||
$this->assertEmpty($workbook->_filename, "Testing with fixtures works only for standard output");
|
||||
|
||||
// we have to fix timestamp for fixtures to work
|
||||
$workbook->_timestamp = 1000000000; // somewhere in 2001
|
||||
|
||||
ob_start();
|
||||
$workbook->close();
|
||||
$data = ob_get_clean();
|
||||
|
||||
$fullPath = self::FIXTURES_PATH.$filename;
|
||||
|
||||
if ($this->shouldUpdateFixtures()) {
|
||||
file_put_contents($fullPath, $data);
|
||||
}
|
||||
|
||||
if (!is_file($fullPath)) {
|
||||
$this->fail("Fixture $filename not found");
|
||||
}
|
||||
|
||||
// TODO: should we save data for future analysis?
|
||||
//file_put_contents("{$fullPath}.work", $data);
|
||||
|
||||
$this->assertEquals(file_get_contents($fullPath), $data, "Output differs for $filename");
|
||||
}
|
||||
|
||||
/**
|
||||
* We should update golden files
|
||||
*/
|
||||
private function shouldUpdateFixtures()
|
||||
{
|
||||
return isset($_SERVER['GOLDEN']);
|
||||
}
|
||||
}
|
||||
BIN
videodb/vendor/pear/spreadsheet_excel_writer/test/fixture/example.xls
vendored
Normal file
BIN
videodb/vendor/pear/spreadsheet_excel_writer/test/fixture/example.xls
vendored
Normal file
Binary file not shown.
BIN
videodb/vendor/pear/spreadsheet_excel_writer/test/fixture/example2.xls
vendored
Normal file
BIN
videodb/vendor/pear/spreadsheet_excel_writer/test/fixture/example2.xls
vendored
Normal file
Binary file not shown.
BIN
videodb/vendor/pear/spreadsheet_excel_writer/test/fixture/with_format.xls
vendored
Normal file
BIN
videodb/vendor/pear/spreadsheet_excel_writer/test/fixture/with_format.xls
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user