Skip to content

Instantly share code, notes, and snippets.

@mergeweb
Created August 24, 2015 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mergeweb/c54117fc1c586fefcd48 to your computer and use it in GitHub Desktop.
Save mergeweb/c54117fc1c586fefcd48 to your computer and use it in GitHub Desktop.
<?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