示例#1
0
 public function setUp()
 {
     MockHttp::routeGroup('admin');
     MockHttp::routeSet(['alias' => 'route']);
     MockHttp::run();
     MockConf::run();
     MockDoctrine::queryBuilderResult([null]);
     // Symulate no result
     $entity = $this->getMockBuilder('Entity\\Posts')->getMock();
     $entity->method('getPublic');
     $this->_queryController = new QueryController(get_class($entity));
 }
示例#2
0
 public function setUp()
 {
     MockHttp::routeSet(['year' => '2016', 'month' => '02', 'day' => '21', 's1' => '-', 's2' => '-']);
     MockHttp::run();
     $this->_dateBc = new DateBreadcrumbs();
 }
示例#3
0
 public function testGetCategoryIdFromPostRoute()
 {
     MockHttp::routeGroup('post');
     MockHttp::routeSet(['alias' => 'anyPost']);
     MockHttp::run();
     $this->_categoryBc = new CategoryBreadcrumbs();
     $stub = new class
     {
         public function getCategory()
         {
             return new class
             {
                 public function getId()
                 {
                     return 1;
                 }
             };
         }
     };
     MockDoctrine::queryBuilderResult([$stub]);
     $catId = MockTest::callMockMethod($this->_categoryBc, 'getCategoryId');
     $this->assertEquals(1, $catId);
 }