public function testService()
 {
     $provider = m::mock('Clarity\\Providers\\Aliaser');
     $provider->shouldReceive('register')->once()->andReturn($this);
     $provider->shouldReceive('getAlias')->once()->andReturn('servicetest');
     $provider->shouldReceive('callRegister')->once()->andReturn($provider->register());
     $provider->shouldReceive('getShared')->once()->andReturn(true);
     $provider->shouldReceive('boot')->once();
     $container = new Container();
     $container->addServiceProvider($provider);
     $container->boot();
     # assert should be instance of ServiceProvider::class
     $this->assertInstanceOf(ServiceProvider::class, $provider);
     # assert via array subset, in the first place, the di()
     # should already injected the 'servicetest' and it should
     # be pullable
     $this->assertArraySubset(di()->get('servicetest')->sampleDiContent(), $this->sampleDiContent());
 }
 /**
  * Load the providers.
  *
  * @param  bool $after_module If you want to load services after calling
  *                               run() function
  * @return $this
  */
 public function loadServices($after_module = false, $services = [])
 {
     # load all the service providers, providing our
     # native phalcon classes
     $container = new Container();
     if (empty($services)) {
         $services = config()->app->services;
     }
     foreach ($services as $service) {
         $instance = new $service();
         if ($instance->getAfterModule() === $after_module) {
             $container->addServiceProvider($instance);
         }
     }
     $container->boot();
     return $this;
 }