Phalcon\Test\Unit\DiTest::testSetParameters PHP 메소드

testSetParameters() 공개 메소드

Tests registering a service with parameters
부터: 2016-01-29
저자: Serghei Iakovlev ([email protected])
public testSetParameters ( )
    public function testSetParameters()
    {
        $this->specify("Registering a service with parameters does now work correctly", function () {
            $this->phDi->set('someComponent1', function ($v) {
                return new \SomeComponent($v);
            });
            $this->phDi->set('someComponent2', 'SomeComponent');
            $someComponent1 = $this->phDi->get('someComponent1', [100]);
            expect($someComponent1->someProperty)->equals(100);
            $someComponent2 = $this->phDi->get('someComponent2', [500]);
            expect($someComponent2->someProperty)->equals(500);
        });
    }