コード例 #1
0
 public function setUp()
 {
     parent::setUp();
     $subscriptionModel = new Subscription();
     $subscriptionModel->setSubscriptionId(1)->setNewsletterId(1)->setSubscriberId(1);
     $subscriptions = [$subscriptionModel];
     $subscriber = new SubscriberModel();
     $subscriber->setSubscriberId(1)->setEmail('*****@*****.**')->setName('Joe Bloggs')->setSubscriptions($subscriptions);
     $subscriberMapperMock = $this->getMock('UthandoNewsletter\\Mapper\\Subscriber');
     $subscriberMapperMock->expects($this->any())->method('getById')->willReturn($subscriber);
     $subscriberMapperMock->expects($this->any())->method('getByEmail')->willReturn($subscriber);
     $subscriberMapperMock->expects($this->any())->method('getPrimaryKey')->willReturn('subscriberId');
     $subscriberMapperMock->expects($this->any())->method('delete')->willReturn(1);
     $this->serviceManager->get('UthandoMapperManager')->setAllowOverride(true);
     $this->serviceManager->get('UthandoMapperManager')->setService('UthandoNewsletterSubscriber', $subscriberMapperMock);
     $subscriptionServiceMock = $this->getMock('UthandoNewsletter\\Service\\Subscription');
     $subscriptionServiceMock->expects($this->any())->method('getSubscriptionsBySubscriberId')->willReturn($subscriptions);
     $subscriptionServiceMock->expects($this->any())->method('delete')->willReturn(1);
     $this->serviceManager->get('UthandoServiceManager')->setAllowOverride(true);
     $this->serviceManager->get('UthandoServiceManager')->setService('UthandoNewsletterSubscription', $subscriptionServiceMock);
     $newsletterModel = new Newsletter();
     $newsletterModel->setNewsletterId(1);
     $newsletterServiceMock = $this->getMock('UthandoNewsletter\\Service\\Newsletter');
     $newsletterServiceMock->expects($this->any())->method('fetchAll')->willReturn([$newsletterModel]);
     $this->serviceManager->get('UthandoServiceManager')->setService('UthandoNewsletter', $newsletterServiceMock);
 }
 public function setUp()
 {
     parent::setUp();
     $urlHelperMock = $this->getMock('Zend\\View\\Helper\\Url');
     $this->serviceManager->get('ViewHelperManager')->setAllowOverride(true);
     $this->serviceManager->get('ViewHelperManager')->setService('url', $urlHelperMock);
 }
コード例 #3
0
 public function setup()
 {
     parent::setUp();
     // mock the adapter, driver, and parts
     $mockResult = $this->getMock('Zend\\Db\\Adapter\\Driver\\ResultInterface');
     $mockStatement = $this->getMock('Zend\\Db\\Adapter\\Driver\\StatementInterface');
     $mockStatement->expects($this->any())->method('execute')->will($this->returnValue($mockResult));
     $mockConnection = $this->getMock('Zend\\Db\\Adapter\\Driver\\ConnectionInterface');
     $mockDriver = $this->getMock('Zend\\Db\\Adapter\\Driver\\DriverInterface');
     $mockDriver->expects($this->any())->method('createStatement')->will($this->returnValue($mockStatement));
     $mockDriver->expects($this->any())->method('getConnection')->will($this->returnValue($mockConnection));
     $mockDriver->expects($this->any())->method('formatParameterName')->will($this->returnValue('?'));
     // setup mock adapter
     $this->mockAdapter = $this->getMock('Zend\\Db\\Adapter\\Adapter', null, [$mockDriver, new TrustingMysqlPlatform()]);
     $this->serviceManager->setAllowOverride(true);
     $this->serviceManager->setService('Zend\\Db\\Adapter\\Adapter', $this->mockAdapter);
 }
コード例 #4
0
 public function setUp()
 {
     parent::setUp();
     $model = new Template();
     $this->model = $model;
 }
コード例 #5
0
 public function setUp()
 {
     parent::setUp();
     $model = new Subscriber();
     $this->model = $model;
 }
コード例 #6
0
 public function setUp()
 {
     parent::setUp();
 }
コード例 #7
0
 public function setUp()
 {
     parent::setUp();
     $model = new Newsletter();
     $this->model = $model;
 }
コード例 #8
0
 public function setUp()
 {
     parent::setUp();
     $model = new Message();
     $this->model = $model;
 }