Пример #1
0
 protected function getInvoiceManager($qbCallback)
 {
     $em = EntityManagerMockFactory::create($this, $qbCallback, array('reference', 'status', 'name'));
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     return new InvoiceManager('Sonata\\InvoiceBundle\\Entity\\BaseInvoice', $registry);
 }
Пример #2
0
 protected function getPostManager($qbCallback)
 {
     $em = EntityManagerMockFactory::create($this, $qbCallback, array());
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     return new PostManager('Sonata\\NewsBundle\\Entity\\BasePost', $registry);
 }
Пример #3
0
 protected function getCustomerManager($qbCallback)
 {
     $em = EntityManagerMockFactory::create($this, $qbCallback, array('firstname', 'lastname', 'email'));
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     return new CustomerManager('Sonata\\CustomerBundle\\Entity\\BaseCustomer', $registry);
 }
 protected function getUserManager($qbCallback)
 {
     $em = EntityManagerMockFactory::create($this, $qbCallback, array('username', 'email'));
     $encoder = $this->getMock('Symfony\\Component\\Security\\Core\\Encoder\\EncoderFactoryInterface');
     $canonicalizer = $this->getMock('FOS\\UserBundle\\Util\\CanonicalizerInterface');
     return new UserManager($encoder, $canonicalizer, $canonicalizer, $em, 'Sonata\\UserBundle\\Entity\\BaseUser');
 }
Пример #5
0
 protected function getMediaManager($qbCallback)
 {
     $em = EntityManagerMockFactory::create($this, $qbCallback, array('name', 'description', 'enabled'));
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     return new MediaManager('Sonata\\MediaBundle\\Entity\\BaseMedia', $registry);
 }
 protected function getCategoryManager($qbCallback)
 {
     $em = EntityManagerMockFactory::create($this, $qbCallback, array());
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     $contextManager = $this->getMock('Sonata\\ClassificationBundle\\Model\\ContextManagerInterface');
     return new CategoryManager('Sonata\\PageBundle\\Entity\\BaseCategory', $registry, $contextManager);
 }
 protected function getProductManager($qbCallback)
 {
     if (version_compare(\PHPUnit_Runner_Version::id(), '5.0.0', '>=')) {
         $this->markTestSkipped('Not compatible with PHPUnit 5.');
     }
     $em = EntityManagerMockFactory::create($this, $qbCallback, array('sku', 'slug', 'name'));
     $registry = $this->getMock('Doctrine\\Common\\Persistence\\ManagerRegistry');
     $registry->expects($this->any())->method('getManagerForClass')->will($this->returnValue($em));
     return new ProductManager('Sonata\\PageBundle\\Entity\\BaseProduct', $registry);
 }
 /**
  * @param $qbCallback
  *
  * @return GroupManager
  */
 protected function getUserManager($qbCallback)
 {
     $em = EntityManagerMockFactory::create($this, $qbCallback, array('name', 'roles'));
     return new GroupManager($em, 'Sonata\\UserBundle\\Entity\\BaseGroup');
 }