https://github.com/formapro/fumocker
A php function mocker.
https://github.com/formapro/fumocker
Last synced: over 1 year ago
JSON representation
A php function mocker.
- Host: GitHub
- URL: https://github.com/formapro/fumocker
- Owner: formapro
- License: mit
- Created: 2011-09-21T15:02:44.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2014-05-02T17:55:45.000Z (about 12 years ago)
- Last Synced: 2024-04-26T22:42:06.045Z (about 2 years ago)
- Language: PHP
- Homepage:
- Size: 253 KB
- Stars: 7
- Watchers: 4
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.markdown
- License: LICENSE
Awesome Lists containing this project
README
# Fumocker [](http://travis-ci.org/formapro/Fumocker)
Are you wonna mock mail function?
```php
fumocker = new \Fumocker\Fumocker;
}
public function tearDown()
{
$this->fumocker->cleanup();
}
public function testMailNeverCalled()
{
/**
* @var $mock \PHPUnit_Framework_MockObject_MockObject
*/
$mock = $this->fumocker->getMock('Namespace\Where\Tested\Class\Is', 'mail');
$mock
->expects($this->never())
->method('mail')
;
//test your Namespace\Where\Tested\Class\Is\Foo
}
public function testMailSendToAdminWithStatisticSubject()
{
$expectedEmailTo = 'admin@example.com';
/**
* @var $mock \PHPUnit_Framework_MockObject_MockObject
*/
$mock = $this->fumocker->getMock('Namespace\Where\Tested\Class\Is', 'mail');
$mock
->expects($this->once())
->method('mail')
->with(
$this->equalTo($expectedEmailTo),
$this->equalTo('Statisitic of money earned by a week')
)
;
//test your Namespace\Where\Tested\Class\Is\Foo
}
public function testRealMailSend()
{
/**
* Dont do a mock and real function will be called
*/
}
}
```