Advertisement
Ra1ski

Untitled

Oct 14th, 2014
538
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?php
  2. namespace Tests\Unit;
  3.  
  4. /**
  5.  * Базовый класс для Unit-тестов
  6.  * @package Tests\Unit
  7.  */
  8. abstract class Base extends \Codeception\TestCase\Test
  9. {
  10.     /**
  11.      * @var \Phalcon\Mvc\Micro
  12.      */
  13.     protected $app;
  14.  
  15.     /**
  16.      * @var \Grumpy\Bootstrap
  17.      */
  18.     protected $bs;
  19.  
  20.     /**
  21.      * @var \Phalcon\DI\FactoryDefault
  22.      */
  23.     protected $di;
  24.  
  25.     /**
  26.      * @var \Api\Drivers\Interfaces\Storage
  27.      */
  28.     protected $storage;
  29.  
  30.     public function getApp()
  31.     {
  32.         return \PHPUnit_Framework_Assert::readAttribute($this->bs, 'app');
  33.     }
  34.  
  35.     public function getBs()
  36.     {
  37.         if(!$this->bs) {
  38.             return new Bootstrap(require_once LOADER_PATH);
  39.         }
  40.  
  41.         return $this->bs;
  42.     }
  43.  
  44.     public function getDi()
  45.     {
  46.         return $this->bs->getDi();
  47.     }
  48.  
  49.     public function getStorage()
  50.     {
  51.         return $this->bs->getStorage();
  52.     }
  53.  
  54.     /**
  55.      *  Конструктор
  56.      */
  57.     protected function __before()
  58.     {
  59.         $this->bs      = $this->getBs();
  60.         $this->di      = $this->getDi();
  61.         $this->storage = $this->getStorage();
  62.         $this->app     = $this->getApp();
  63.     }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement