| 148 |
lars |
1 |
.. index::
|
|
|
2 |
single: Mocking; Public Static Methods
|
|
|
3 |
|
|
|
4 |
Mocking Public Static Methods
|
|
|
5 |
=============================
|
|
|
6 |
|
|
|
7 |
Static methods are not called on real objects, so normal mock objects can't
|
|
|
8 |
mock them. Mockery supports class aliased mocks, mocks representing a class
|
|
|
9 |
name which would normally be loaded (via autoloading or a require statement)
|
|
|
10 |
in the system under test. These aliases block that loading (unless via a
|
|
|
11 |
require statement - so please use autoloading!) and allow Mockery to intercept
|
|
|
12 |
static method calls and add expectations for them.
|
|
|
13 |
|
|
|
14 |
See the :ref:`creating-test-doubles-aliasing` section for more information on
|
|
|
15 |
creating aliased mocks, for the purpose of mocking public static methods.
|