public function test_sanity_TestMapIsUsed()
 {
     $skeleton = new Skeleton();
     $testSkeleton = new UnitTestSkeleton($skeleton);
     $testSkeleton->override('a', 'b');
     $this->assertEquals('b', $skeleton->get('a'));
 }
Beispiel #2
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;
 }
Beispiel #3
0
 /**
  * @return Skeleton
  */
 protected function skeleton()
 {
     if (!$this->skeleton) {
         $this->skeleton = new Skeleton();
         $map = new TestMap($this->skeleton->getMap());
         $this->skeleton->setMap($map);
         $map->override('a', 'a_val');
         $map->override('b', 'b_val');
     }
     return $this->skeleton;
 }
Beispiel #4
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);
 }
Beispiel #5
0
 /**
  * @param Skeleton $skeleton
  */
 public function __construct(Skeleton $skeleton)
 {
     $this->testMap = new TestMap($skeleton->getMap());
     $skeleton->setMap($this->testMap);
 }
Beispiel #6
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);
 }