for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Magium\Assertions\Browser;
use Magium\AbstractTestCase;
use Magium\Assertions\AbstractAssertion;
use Magium\Assertions\SelectorAssertionInterface;
class TitleEndsWith extends AbstractAssertion implements SelectorAssertionInterface
{
use TitleTrait;
const ASSERTION = 'Browser\TitleEndsWith';
public function assert()
$title = $this->webDriver->getTitle();
AbstractTestCase::assertNotNull($title);
AbstractTestCase::assertNotNull($this->title);
$title = trim($title);
$pos = strpos($title, $this->title);
AbstractTestCase::assertNotFalse($pos);
$pos
integer
boolean
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$testEquals = $pos + strlen($this->title);
$browserEquals = strlen($title);
AbstractTestCase::assertEquals($testEquals, $browserEquals);
}
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: