Improve this doc

# `ngMock`

# ngMock

The `ngMock` module providers support to inject and mock Angular services into unit tests. In addition, ngMock also extends various core ng services such that they can be inspected and controlled in a synchronous manner within test code.

## Installation

First include `angular-mock.js` in your HTML:

        <script src="angular.js">
        <script src="angular-mock.js">

You can download this file from the following places:

- Google CDN
  e.g. `//ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mock.js`
- Bower
  e.g.

      bower install angular-mock@X.Y.Z

- code.angularjs.org
  e.g.

      "//code.angularjs.org/X.Y.Z/angular-mock.js"

where X.Y.Z is the AngularJS version you are running.

Then load the module in your application by adding it as a dependent module:

      angular.module('app', ['ngMock']);

With that you're ready to get started!

## Module Components

### Object

Name | Description
--- | ---
angular.mock | Namespace from 'angular-mocks.js' which contains testing related code.

### Provider

Name | Description
--- | ---
$exceptionHandlerProvider | Configures the mock implementation of `$exceptionHandler` to rethrow or to log errors passed into the `$exceptionHandler`.

### Service

Name | Description
--- | ---
$exceptionHandler | Mock implementation of `$exceptionHandler` that rethrows or logs errors passed into it. See $exceptionHandlerProvider for configuration information.
$log | Mock implementation of `$log` that gathers all logged messages in arrays (one array per logging level). These arrays are exposed as `logs` property of each of the level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`.
$interval | Mock implementation of the $interval service.
$httpBackend | Fake HTTP backend implementation suitable for unit testing applications that use the $http service.
$timeout | This service is just a simple decorator for $timeout service that adds a "flush" and "verifyNoPendingTasks" methods.

### Type

Name | Description
--- | ---
angular.mock.TzDate | NOTE: this is not an injectable instance, just a globally available mock class of `Date`.

### Function

Name | Description
--- | ---
angular.mock.dump | NOTE: this is not an injectable instance, just a globally available function.
angular.mock.module | NOTE: This function is also published on window for easy access.
angular.mock.inject | NOTE: This function is also published on window for easy access.