Example #1
0
 /**
  * @param string $item
  * @return Skeleton|mixed
  */
 public static function skeleton($item = null)
 {
     if (!self::$skeleton) {
         self::setUp();
     }
     if ($item) {
         return self::$skeleton->get($item);
     }
     return self::$skeleton;
 }
 public function test_sanity_TestMapIsUsed()
 {
     $skeleton = new Skeleton();
     $testSkeleton = new UnitTestSkeleton($skeleton);
     $testSkeleton->override('a', 'b');
     $this->assertEquals('b', $skeleton->get('a'));
 }
Example #3
0
 /**
  * @param string|null $interface Set to null to get the skeleton object.
  * @return mixed
  */
 public static function skeleton($interface = null)
 {
     if (is_null(self::$skeleton)) {
         self::$skeleton = (new Skeleton())->enableKnot()->setConfigLoader(new DirectoryConfigLoader(__DIR__ . '/_skeleton'));
     }
     if (is_null($interface)) {
         return self::$skeleton;
     }
     return self::$skeleton->get($interface);
 }
Example #4
0
 public function testSanity_knotNotEnabled()
 {
     $s = new Skeleton();
     $s->set(SkeletonTest_Helper_A::class, SkeletonTest_Helper_A::class);
     $s->set(SkeletonTest_Helper_B::class, SkeletonTest_Helper_B::class);
     /** @var SkeletonTest_Helper_B $a */
     $a = $s->get(SkeletonTest_Helper_B::class);
     $this->assertNull($a->a);
 }