for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\OrmFunctionalTestCase;
use Doctrine\Tests\Models\ECommerce\ECommerceProduct;
use Doctrine\Tests\Models\ECommerce\ECommerceCategory;
use Doctrine\Common\Collections\Criteria;
class DDC288Test extends OrmFunctionalTestCase
{
private $firstProduct;
private $secondProduct;
$secondProduct
This check marks private properties in classes that are never used. Those properties can be removed.
private $firstCategory;
private $secondCategory;
public function setUp()
$this->useModelSet('ecommerce');
parent::setUp();
$this->firstProduct = new ECommerceProduct();
$this->firstProduct->setName("First Product");
$this->firstCategory = new ECommerceCategory();
$this->firstCategory->setName("Business");
$this->secondCategory = new ECommerceCategory();
$this->secondCategory->setName("Home");
$this->firstProduct->addCategory($this->firstCategory);
$this->firstProduct->addCategory($this->secondCategory);
$this->_em->persist($this->firstProduct);
$this->_em->flush();
$this->_em->clear();
}
public function testCollectionFilteringOperator()
$firstProduct = $this->_em->find(ECommerceProduct::class, $this->firstProduct->getId());
$criteria = Criteria::create()->where(Criteria::expr()->lte('id', 999));
$this->assertCount(2, $firstProduct->getCategories()->matching($criteria));
This check marks private properties in classes that are never used. Those properties can be removed.