예제 #1
0
 public function testInject()
 {
     $container = new Container();
     $example = new InjectTestExample();
     static::assertNull($example->getSomething());
     // null
     static::assertNull($example->getOtherthing());
     // null
     // inject object
     $container->inject($example, ['something' => $something = new stdClass()]);
     static::assertSame($something, $example->getSomething());
     // same
     // inject scalar
     $container->inject($example, ['otherthing' => $otherthing = 303030]);
     static::assertSame($something, $example->getSomething());
     // same
     static::assertSame($otherthing, $example->getOtherthing());
     // same
 }