
Untitled
By: a guest on
Oct 5th, 2012 | syntax:
PHP | size: 1.61 KB | hits: 5 | expires: Never
<?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();
}
}