コード例 #1
0
    public function injectCompositeProperties()
    {
        $command = newinstance(Command::class, [], '{

      #[@inject(name= "debug")]
      public function setTrace(\\util\\Properties $prop) {
        $this->out->write("Have ", $prop->readString("section", "key"));
      }

      public function run() {
        // Intentionally empty
      }
    }');
        $debug = new \util\Properties('');
        $debug->load(new MemoryInputStream("[section]\nkey=overwritten_value"));
        $this->runWith([nameof($command)], '', new Config(new \util\RegisteredPropertySource('debug', $debug), new \util\FilesystemPropertySource(__DIR__)));
        $this->assertEquals('', $this->err->getBytes());
        $this->assertEquals('Have overwritten_value', $this->out->getBytes());
    }
コード例 #2
0
 public function noApplication()
 {
     with($p = new \util\Properties(null));
     $p->load(new \io\streams\MemoryInputStream(''));
     $p->writeSection('app');
     $p->writeString('app', 'map.service', '/service');
     $p->writeSection('app::service');
     $r = new Runner('/htdocs');
     $r->configure($p);
     $r->applicationAt('/');
 }