Skip to content
Permalink
Browse files

Fix failing tests caused by already existing classes

  • Loading branch information...
ndm2
ndm2 committed Mar 1, 2014
1 parent 008ad32 commit 01e1b5ca610cda98453ea1e1c6fbc2ae3f1d49d9
@@ -481,7 +481,7 @@ public function testDispatchNotAShellWithMain() {
$Dispatcher = new TestShellDispatcher();
$methods = get_class_methods('Object');
array_push($methods, 'main', 'initdb', 'initialize', 'loadTasks', 'startup', '_secret');
$Shell = $this->getMock('Object', $methods, array(), 'MockWithMainNotAShell');
$Shell = $this->getMock('Object', $methods);
$Shell->expects($this->never())->method('initialize');
$Shell->expects($this->once())->method('startup');
@@ -493,7 +493,7 @@ public function testDispatchNotAShellWithMain() {
$this->assertTrue($result);
$this->assertEquals(array(), $Dispatcher->args);
$Shell = $this->getMock('Object', $methods, array(), 'MockWithMainNotAShell');
$Shell = $this->getMock('Object', $methods);
$Shell->expects($this->once())->method('initdb')->will($this->returnValue(true));
$Shell->expects($this->once())->method('startup');
$Dispatcher->TestShell = $Shell;
@@ -512,7 +512,7 @@ public function testDispatchNotAShellWithoutMain() {
$Dispatcher = new TestShellDispatcher();
$methods = get_class_methods('Object');
array_push($methods, 'main', 'initdb', 'initialize', 'loadTasks', 'startup', '_secret');
$Shell = $this->getMock('Object', $methods, array(&$Dispatcher), 'MockWithoutMainNotAShell');
$Shell = $this->getMock('Object', $methods);
$Shell->expects($this->never())->method('initialize');
$Shell->expects($this->once())->method('startup');
@@ -524,7 +524,7 @@ public function testDispatchNotAShellWithoutMain() {
$this->assertTrue($result);
$this->assertEquals(array(), $Dispatcher->args);
$Shell = $this->getMock('Object', $methods, array(&$Dispatcher), 'MockWithoutMainNotAShell');
$Shell = $this->getMock('Object', $methods);
$Shell->expects($this->once())->method('initdb')->will($this->returnValue(true));
$Shell->expects($this->once())->method('startup');
$Dispatcher->TestShell = $Shell;
@@ -33,7 +33,9 @@ class AclComponentTest extends CakeTestCase {
*/
public function setUp() {
parent::setUp();
$this->MockAclImplementation = $this->getMock('AclInterface', array(), array(), 'MockAclImplementation');
if (!class_exists('MockAclImplementation', false)) {
$this->getMock('AclInterface', array(), array(), 'MockAclImplementation');
}
Configure::write('Acl.classname', 'MockAclImplementation');
$Collection = new ComponentCollection();
$this->Acl = new AclComponent($Collection);
@@ -68,10 +70,11 @@ public function testConstrutorException() {
* @return void
*/
public function testAdapter() {
$this->MockAclImplementation->expects($this->once())->method('initialize')->with($this->Acl);
$this->assertNull($this->Acl->adapter($this->MockAclImplementation));
$Adapter = $this->getMock('AclInterface');
$Adapter->expects($this->once())->method('initialize')->with($this->Acl);
$this->assertEquals($this->Acl->adapter(), $this->MockAclImplementation, 'Returned object is different %s');
$this->assertNull($this->Acl->adapter($Adapter));
$this->assertEquals($this->Acl->adapter(), $Adapter, 'Returned object is different %s');
}
/**

0 comments on commit 01e1b5c

Please sign in to comment.
You can’t perform that action at this time.