Пример #1
0
 /**
  * Register the compiler pass and compile the DI
  *
  * @return void
  * @author Dan Cox
  */
 public function test_compileAndRegister()
 {
     $mock = new ServiceMockery('service');
     $mock->add();
     $this->DI->addCompilerPass(new MockeryPass());
     $this->DI->compile();
     $this->DI->get('service')->shouldReceive('test')->andReturn(true);
     $this->assertTrue($this->DI->get('service')->test());
 }
Пример #2
0
 /**
  * Set up test env
  *
  * @return void
  * @author Dan Cox
  */
 public function setUp()
 {
     $mock = new ServiceMockery('fixtures');
     $mock->add();
     parent::setUp();
 }
Пример #3
0
 /**
  * Registers the mocks present in the Mock property
  *
  * @return void
  * @author Dan Cox
  */
 public function registerMocks()
 {
     if (!is_null($this->mocks)) {
         foreach ($this->mocks as $m) {
             $mockery = new ServiceMockery($m);
             $mockery->add();
         }
     }
 }
Пример #4
0
 /**
  * Set up test env
  *
  * @return void
  * @author Dan Cox
  */
 public function setUp()
 {
     $mock = new ServiceMockery('schema');
     $mock->add();
     parent::setUp();
 }
Пример #5
0
 /**
  * Setup test env
  *
  * @return void
  * @author Dan Cox
  */
 public function setUp()
 {
     $dbMock = new ServiceMockery('database');
     $dbMock->add();
     parent::setUp();
 }
Пример #6
0
 /**
  * Set up test env
  *
  * @return void
  * @author Dan Cox
  */
 public function setUp()
 {
     $mock = new ServiceMockery('response.file');
     $mock->add();
     parent::setUp();
 }
Пример #7
0
 /**
  * Test adding the twig configuration
  *
  * @return void
  * @author Dan Cox
  */
 public function test_templatingWithTwigConfig()
 {
     $profile = new Profile(new Filesystem());
     $profile->setSettings(['templates' => array('twig' => array('debug' => true))]);
     $this->app->profile = $profile;
     $env = new Environment();
     $env->load($this->app);
     $env->getDI()->addCompilerPass(new \Wasp\DI\Pass\MockeryPass());
     $t = new ServiceMockery('twigengine');
     $t->add();
     $temp = new ServiceMockery('template');
     $temp->add();
     $env->createDI();
     $twig = $env->getDI()->get('twigengine');
     $template = $env->getDI()->get('template');
     $twig->shouldReceive('create')->once()->with(array('debug' => true));
     $template->shouldReceive('setDirectory')->andReturn($template);
     $template->shouldReceive('getDirectory')->andReturn(__DIR__);
     $template->shouldReceive('addEngine')->andReturn($template);
     $template->shouldReceive('start');
     $env->startTemplating(dirname(__DIR__) . '/Templating/Templates/');
     // Clean Up
     $library = new ServiceMockeryLibrary();
     $library->clear();
 }
Пример #8
0
 /**
  * Test getting a decorator without adding this to the library
  *
  * @return void
  * @author Dan Cox
  */
 public function test_getMockDecoratorWithoutAdding()
 {
     $mock = new ServiceMockery('template');
     $m = $mock->getMock();
     $this->assertInstanceOf('Wasp\\DI\\ServiceMockeryDecorator', $m);
 }