Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Enterprise Test cases generated on: 2012-09-28 21:53:19 : 1348883599*/
- App::uses('Model', 'Model');
- class Enterprise extends Model {
- public function subscribe() {
- echo 'Subscription ID: ';
- var_dump($this->field('subscription_id'));
- echo 'Name: ';
- var_dump($this->field('name'));
- }
- }
- /**
- * Enterprise Test Case
- *
- */
- class EnterpriseSOTestCase extends CakeTestCase {
- /**
- * setUp method
- *
- * @return void
- */
- public function setUp() {
- parent::setUp();
- }
- /**
- * tearDown method
- *
- * @return void
- */
- public function tearDown() {
- parent::tearDown();
- }
- /**
- * testSubscribe method
- *
- * @return void
- */
- public function testValueMap() {
- // Subscribe new customer.
- $enterprise = $this->getMock('Enterprise', array('field'));
- $enterprise->expects($this->any())
- ->method('field')
- ->will($this->returnValueMap(array(
- array('subscription_id', null),
- array('name', 'Monday Farms')
- )));
- $enterprise->subscribe();
- }
- public function testCallback() {
- // Subscribe new customer.
- $enterprise = $this->getMock('Enterprise', array('field'));
- $enterprise->expects($this->any())
- ->method('field')
- ->will($this->returnCallback(function ($arg) {
- $map = array(
- 'subscription_id' => null,
- 'name' => 'Monday Farms'
- );
- return $map[$arg];
- }));
- $enterprise->subscribe();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement