0

I'm using typo3 6 with extbase and some dependency injection features.

MyClass is injected with a service. The property which holds the service is protected.

class MyClass {
    /**
     *
     * @var \X\Y\Z\MyService
     * @inject
     */
    protected $myService;
}

How can I change (or mock) the service in my UnitTest by?

koalabruder
  • 2,794
  • 9
  • 33
  • 40
  • In my opinion you could use the method *injectMyService* from your fixture-class. The *@inject* only calls the magic-method *injectMyService*. – freshp Oct 30 '13 at 07:35

1 Answers1

0

I use reflection api to inject mock object to a protected field. See http://php.net/manual/en/class.reflectionobject.php