Phalcon\Test\Unit\DiTest::testSetParameters PHP Method

testSetParameters() public method

Tests registering a service with parameters
Since: 2016-01-29
Author: 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);
        });
    }