Exemple #1
0
 public function testServiceProvider()
 {
     S::bootstrap('Saltwater\\Root\\Root');
     S::$n->modules->append('Saltwater\\RedBean\\RedBean', true);
     $this->assertEquals('Saltwater\\RedBean\\Provider\\Entity', get_class(S::$n->entity));
     $this->assertEquals('Saltwater\\RedBean\\Provider\\Log', get_class(S::$n->log));
 }
 public function testServiceProvider()
 {
     S::bootstrap('Saltwater\\Root\\Root');
     $context = S::$n->context->get('root');
     $this->assertEquals('Saltwater\\Root\\Context\\Root', get_class($context));
     $service = S::$n->service->get('info', $context);
     $this->assertEquals('Saltwater\\Root\\Service\\Info', get_class($service));
     $this->assertNull($service->getInfo());
 }
 /**
  * @runInSeparateProcess
  *
  * @requires PHP 5.4
  */
 public function testHalt()
 {
     if ($GLOBALS['IS_HHVM']) {
         $this->markTestSkipped();
         return;
     }
     S::halt('404', 'Not Found');
     $this->assertEquals(404, http_response_code());
 }
 /**
  * @runInSeparateProcess
  *
  * @requires PHP 5.4
  */
 public function testMissingProvider()
 {
     if ($GLOBALS['IS_HHVM']) {
         $this->markTestSkipped();
         return;
     }
     S::destroy();
     S::bootstrap('Saltwater\\Root\\Root');
     S::$n->nosuchprovider;
     $this->assertEquals(500, http_response_code());
 }
 public function testSecondDb()
 {
     S::addModule('Saltwater\\Overload\\Overload');
     $this->assertArrayHasKey('overload', S::$n->db->toolboxes);
 }
 protected function tearDown()
 {
     S::destroy();
 }
Exemple #7
0
 public static function tearDownAfterClass()
 {
     S::$n->db->nuke();
     S::destroy();
 }
 public static function tearDownAfterClass()
 {
     S::destroy();
 }
Exemple #9
0
 /**
  * Generic call for a type of provider
  *
  * @param string $type
  * @param string $caller Caller module name
  *
  * @return Provider
  */
 public function provider($type, $caller = null)
 {
     $salt = 'provider.' . $type;
     if (!($bit = $this->registry->bit($salt))) {
         S::halt(500, 'provider does not exist: ' . $type);
     }
     if (empty($caller)) {
         $caller = $this->modules->finder->find(Backtrace::lastCaller(), $salt);
     }
     return $this->modules->finder->provider($bit, $caller, $type);
 }