for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace JCIT\jobqueue\tests\unit\components\jobQueues;
use Codeception\Test\Unit;
use JCIT\jobqueue\components\jobQueues\Beanstalk;
use JCIT\jobqueue\components\jobQueues\Synchronous;
use JCIT\jobqueue\factories\JobFactory;
use JCIT\jobqueue\interfaces\JobInterface;
use JCIT\jobqueue\jobs\HelloJob;
use League\Tactician\CommandBus;
use Pheanstalk\Connection;
class BeanstalkTest extends Unit
{
public function testPut(): void
$connection = $this->createMock(Connection::class);
$jobFactory = $this->createMock(JobFactory::class);
$counter = 0;
$beforePut = static function (JobInterface $job) use (&$counter) {
$job
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
$beforePut = static function (/** @scrutinizer ignore-unused */ JobInterface $job) use (&$counter) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$counter++;
};
$jobQueue = $this->getMockBuilder(Beanstalk::class)
->setConstructorArgs([$connection, $jobFactory, $beforePut])
->onlyMethods(['put'])
->getMock();
;
$jobQueue->expects($this->once())->method('put');
$job = new HelloJob('Test');
$jobQueue->putJob($job);
$this->assertEquals(1, $counter);
}
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.