mbhsoft / codeception-sitemap-module
该软件包最新版本(3.0.0)没有提供许可信息。
解析和验证sitemap.xml文件
3.0.0
2022-11-17 22:29 UTC
Requires
- php: ^8.0
- ext-simplexml: *
- codeception/codeception: ^5.0
- codeception/module-asserts: ^3.0
- codeception/module-phpbrowser: ^3.0
- mbhsoft/phpunit-xsdvalidation: 3.0.0
- vipnytt/sitemapparser: ~1.1.0
Requires (Dev)
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ~9.0
- squizlabs/php_codesniffer: ^3.2
README
该软件包提供对sitemap.xml文件的解析和验证。
从 portrino/codeception-sitemap-module 分支而来
安装
您需要将仓库添加到您的composer.json文件中
composer require --dev mbhsoft/codeception-sitemap-module
用法
您可以将此模块用作任何其他Codeception模块,通过在您的Codeception套件配置中添加'Sitemap'到启用模块中。
启用模块并设置配置变量
可以通过配置文件直接设置url
,或者通过环境变量:%BASE_URL%
modules: enabled: - Sitemap: depends: PhpBrowser url: ADD_YOUR_BASE_URL_HERE
您也可以配置sitemap解析软件包的guzzle实例。例如,要禁用SSL证书检查
modules: enabled: - Sitemap: sitemapParser: guzzle: verify: false
更新Codeception构建
codecept build
实现cept / cest
$I->wantToTest('If sitemap is valid.'); $I->amOnPage('sitemap_index.xml'); // validation against https://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd // sitemap will be retrieved from: http://<www.domain.tld>/sitemap.xml, where http://<www.domain.tld>/ is configured in module config $I->seeSiteMapIsValid('sitemap.xml'); // validation against https://www.sitemaps.org/schemas/sitemap/0.9/siteindex.xsd // siteindex will be retrieved from: http://<www.domain.tld>/sitemap_index.xml, where http://<www.domain.tld>/ is configured in module config $I->seeSiteIndexIsValid('sitemap_index.xml'); // validate url occurence (also recursively through siteindex files!) // complete url $I->seeSiteMapContainsUrl('sitemap_index.xml', 'https://www.domain.tld/foo/bar/'); // without base_url (checks if one of the sitemap urls contains the path) $I->seeSiteMapContainsUrlPath('sitemap.xml', '/foo/bar'); // via response object $I->seeSiteMapResponseContainsUrlPath('/bar/'); $I->seeSiteMapResponseContainsUrlPath('/foo/');
作者
- André Wuttig - 初始工作,单元测试,文档 - aWuttig
- Marc Bastian Heinrichs - 错误修复,验收测试,迁移到GitHub actions,升级到Codeception v4 Mabahe
请参阅参与此项目的贡献者列表。