예제 #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));
 }
예제 #2
0
 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());
 }
예제 #3
0
 /**
  * @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());
 }
예제 #4
0
 /**
  * @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());
 }
예제 #5
0
 public function testSecondDb()
 {
     S::addModule('Saltwater\\Overload\\Overload');
     $this->assertArrayHasKey('overload', S::$n->db->toolboxes);
 }
 protected function tearDown()
 {
     S::destroy();
 }
예제 #7
0
 public static function tearDownAfterClass()
 {
     S::$n->db->nuke();
     S::destroy();
 }
예제 #8
0
 public static function tearDownAfterClass()
 {
     S::destroy();
 }
예제 #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);
 }