_em->getClassMetadata('Doctrine\Tests\Models\ECommerce\ECommerceProduct'); $product = new ECommerceProduct(); $category = new ECommerceCategory(); $collection = new PersistentCollection($this->_em, $class, new ArrayCollection(array($category))); $collection->setOwner($product, $class->associationMappings['categories']); $uow = $this->_em->getUnitOfWork(); $clonedCollection = clone $collection; $clonedCollection->clear(); $this->assertEquals(0, count($uow->getScheduledCollectionDeletions())); } }