Skip to content

Instantly share code, notes, and snippets.

@mergeweb
Created Aug 24, 2015
Embed
What would you like to do?
<?php
App::uses('PwfSource', 'Model/Datasource');
App::uses('Model', 'Model');
public function setUp() {
$this->Source = ClassRegistry::init('PwfSource');
$this->sourceMethods = get_class_methods($this->Source);
$methods = array_diff($this->sourceMethods, ['read', '__call', '__isset', '__get']);
$this->Source = $this->getMock('PwfSource', $methods);
$this->Model = $this->getMock('Model');
}
public function testRead() {
$this->Source->expects($this->any())
->method('request')
->with(
$this->anything(),
$this->anything()
)
->will($this->returnValue($expected_result));
$result = $this->Source->read($this->Model, ['conditions' => array('id' => 9379)]);
$this->assertEquals($expected_result, $result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment