Laravel testing (sitemap xml page) ->get() returns blank xml
I’m trying to test a Laravel sitemap page.
Want to test that a uri ‘sitemap/departments.xml’ contains ‘/adhesives-sealants/adhesives/c657’
Here is my code:
$response = $this->get( 'sitemap/departments.xml');
$response->assertSee('/adhesives-sealants/adhesives/c657');
This is the response I get from test:
Failed asserting that '' contains "/interior-exterior-pva-wood-glue/p31670".
When I dump out $response I get this:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
</urlset>
Which is not what is on the page!
Page looks like this
Where am i going wrong???
from Laravel Questions and Answers https://laravelquestions.com/laravel/laravel-testing-sitemap-xml-page-get-returns-blank-xml/
via Lzo Media
No comments:
Post a Comment