Пример #1
0
 public function testSetGetService()
 {
     $mock = $this->getMock('ServiceFoo');
     $serviceName = 'Foo';
     $module = 'Bar';
     Light_Service_Abstract::setService($mock, $serviceName, $module);
     $this->assertEquals($mock, Light_Service_Abstract::getService($serviceName, $module));
 }
Пример #2
0
 /**
  * Injects a mock page service into Light_Service_Abstract
  *
  * @param PHPUnit_Framework_MockObject_Stub_Return $will
  * The resoult of the find call
  */
 private function _initPageService($will)
 {
     $content = $this->getRequestParam('content');
     $language = $this->getRequestParam('language');
     $service = $this->getMock('Default_Page_Service', array('find'));
     $service->expects($this->once())->method('find')->with($content, $language)->will($will);
     Light_Service_Abstract::setService($service, 'Page', 'Default');
 }
Пример #3
0
 public function testShowCallsServiceFind()
 {
     $content = 'foo';
     $language = 'bar';
     $service = $this->getMock('Default_Page_Service', array('find'));
     $service->expects($this->once())->method('find')->with($content, $language);
     Light_Service_Abstract::setService($service, 'Page', 'Default');
     $this->request->setQuery(array('content' => $content, 'language' => $language));
     $this->dispatch('/page/show');
     $this->assertModule('default');
     $this->assertController('page');
     $this->assertAction('show');
 }