Fixed creation of mock for methods that are necessary.
Merge pull request #2593 from hason/phpunit

Fixed creation of mock in tests for methods that are necessary.