assertRedirectToUrlRegExp does not work?
I have an assertion
$this->assertRedirectToUrlRegExp('#.*/wishlist/index/index/.*#');
This fails:
Failed asserting that request header "Location" value matches PCRE pattern "#.*/wishlist/index/index/.*#". http://foobar.local/wishlist/index/index/wishlist_id/7/
When I debug into it, I see that \PHPUnit_Framework_Constraint_PCREMatch::matches returns true.
Also in \PHPUnit_Framework_Constraint::evaluate $success is TRUE, BUT: $returnResult is FALSE and so the result is not passed up.
The call to callProtectedByType does not specify the parameter https://github.com/IvanChepurnyi/EcomDev_PHPUnit/blob/master/lib/EcomDev/PHPUnit/Constraint/Abstract.php#L169
So I think there might be a problem?
My current workaround (without touching the module)
$responseMatch = '#.*/wishlist/index/index/.*#';
//$this->assertRedirectToUrlRegExp($responseMatch); - does not seem to work @see https://github.com/IvanChepurnyi/EcomDev_PHPUnit/issues/80
$this->assertRedirect();
$locationHeader = $this->getResponse()->getSentHeader('Location');
$this->assertTrue(preg_match($responseMatch, $locationHeader) > 0, sprintf('Location header "%s" did not match "%s"', $locationHeader, $responseMatch));
some seems to happen for assertResponseBodyContains()
PHPUnit: 3.7.13
Please create a pull request with test for this functionality. Test should be created in EcomDev_PHPUnitTest module.
The problem you are talking about, could be caused by this call: https://github.com/EcomDev/EcomDev_PHPUnit/blob/dev/lib/EcomDev/PHPUnit/Constraint/Controller/Response/Header.php#L88
It calls PHPUnit evaluate, instead of matches, so it could be the issue.