for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Dekalee\AdbackAnalyticsBundle\Tests\Unit\CacheWarmer;
use Dekalee\AdbackAnalytics\Query\ScriptUrlQuery;
use Dekalee\AdbackAnalyticsBundle\CacheWarmer\ConfigFileCacheWarmer;
use Phake;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
/**
* Class ConfigFileCacheWarmerTest
*/
class ConfigFileCacheWarmerTest extends \PHPUnit_Framework_TestCase
{
* @var ConfigFileCacheWarmer
protected $warmer;
protected $query;
* Set up the test
public function setUp()
$this->query = Phake::mock(ScriptUrlQuery::CLASS);
$this->warmer = new ConfigFileCacheWarmer($this->query);
$this->query
object<Phake_IMock>
object<Dekalee\AdbackAna...s\Query\ScriptUrlQuery>
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);
}
* Test instance
public function testInstance()
$this->assertInstanceOf(CacheWarmerInterface::CLASS, $this->warmer);
* Test query call
public function testWarmup()
$this->warmer->warmUp('');
Phake::verify($this->query)->execute();
* Test optionnal
public function testIsOptional()
$this->assertFalse($this->warmer->isOptional());
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: