xrow / eztika-ls
这是一个独立 Tika 工具包的包装脚本,允许将多种二进制文件类型(如 MsWord、MsOffice、PDF、Excel、ODF 等)转换为纯文本并索引。
Requires
Requires (Dev)
- phpunit/phpunit: ^5.0 || ^8.5.14
- roave/security-advisories: dev-disablechecks as dev-master
README
eZ Tika 是一个扩展,它允许将多种二进制文件格式转换为纯文本,以便由搜索引擎使用(如果您已启用这些属性以供搜索)。
目前,已启用大多数常见的办公格式(另见 binaryfile.ini.append.php)
[application/pdf]
[application/msword]
[application/vnd.ms-excel]
[application/vnd.ms-powerpoint]
[application/vnd.visio]
[application/vnd.ms-outlook]
[application/xml]
[application/rtf]
[application/vnd.oasis.opendocument.text]
[application/vnd.oasis.opendocument.presentation]
[application/vnd.oasis.opendocument.spreadsheet]
[application/vnd.oasis.opendocument.formula]
[application/zip]
[application/vnd.openxmlformats-officedocument.wordprocessingml.document]
[application/vnd.openxmlformats-officedocument.spreadsheetml.sheet]
[application/vnd.openxmlformats-officedocument.presentationml.presentation]
[application/octet-stream]
安装
参见 INSTALL.md
许可证
除 tika.jar 文件外的所有文件的许可证:GNU GPL 2.0。tika.jar 使用 ASF 许可证(Apache)。
运行测试
该包使用 PHPUnit 运行功能测试。
注意 测试不会模拟与数据库的交互,而是在其中创建/修改/删除多种类型的数据。因此,运行测试可能会留下过时/损坏的数据。建议使用专门的 eZPublish 安装或至少一个专门的数据库运行测试套件。
为该包设置专门的测试环境
运行扩展测试的一个安全选择是设置一个类似 GitHub Actions 上运行的测试套件的环境。优点是多方面的:一方面,您可以以任何版本的 eZPublish 开始;另一方面,您将更有信心,您添加或修改的任何测试也将通过 GitHub。缺点是您需要 Docker 和 Docker-compose,并且您将使用的环境将与传统 eZPublish 设置大不相同!此外,构建此环境将需要相当大的磁盘空间和时间。
设置专用测试环境和在其中运行测试的步骤
git clone --depth 1 https://github.com/tanoconsulting/euts.git teststack
# if you have a github auth token, it is a good idea to copy it now to teststack/docker/data/.composer/auth.json
# this config sets up a test environment with eZPlatform 2.5 running on php 7.4 / ubuntu jammy
export TESTSTACK_CONFIG_FILE=Tests/environment/.euts.2.5.env
./teststack/teststack build
./teststack/teststack runtests
./teststack/teststack stop
注意:第一次运行此操作将花费一些时间,但后续运行将更快。注意:请确保有足够的磁盘空间可用。
如果您想手动运行命令,例如 symfony 控制台
./teststack/teststack console cache:clear
或轻松访问数据库 shell 提示符
./teststack/teststack dbconsole
或命令行 shell 提示符到运行测试的 Docker 容器
./teststack/teststack shell
Docker 容器中的测试使用在文件 Tests/environment/.euts.2.5.env
中指定的 debian/php/mysql/eZPlatform 内核版本运行,该文件由环境变量 TESTSTACK_CONFIG_FILE
指定。如果没有设置该环境变量的值,则查找名为 .euts.env
的文件。如果不存在此类文件,则使用一些默认值,您可以在 ./teststack/README.md 中的文档中找到它们。如果您想针对不同的 eZ/php/debian 版本进行测试,请
- 创建一个
.euts.env
文件(如果不存在) - 向其中添加任何所需的变量(以文件
teststack/.euts.env.example
为指导) - 重新构建测试堆栈
- 以通常的方式运行测试
您甚至可以通过使用不同的环境文件同时保留多个测试堆栈,例如
- 创建一个
.euts.env.local
文件并添加任何所需的 env 变量,以唯一的COMPOSE_PROJECT_NAME
开头 - 通过
./teststack/teststack. -e .euts.env.local build
构建新的测试堆栈 - 通过
./teststack/teststack -e .euts.env.local runtests
运行测试