Skip to content

Commit

Permalink
added some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mirko-pagliai committed Nov 12, 2018
1 parent fca3d9f commit 0716dd2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/TestCase/TestSuite/TestCaseTest.php
Expand Up @@ -494,16 +494,26 @@ public function testGetMockForModelTable()
$entity = new Entity([]);
$this->assertTrue($Mock->save($entity));
$this->assertFalse($Mock->save($entity));
$Mock = $this->getMockForModel(

$allMethodsStubs = $this->getMockForModel(
'Table',
null,
[],
['alias' => 'Comments', 'className' => '\Cake\ORM\Table']
);
$result = $this->getTableLocator()->get('Comments');
$this->assertInstanceOf('Cake\ORM\Table', $result);
$this->assertEmpty([], $allMethodsStubs->getAlias());

$allMethodsMocks = $this->getMockForModel(
'Table',
null,
['alias' => 'Comments', 'className' => '\Cake\ORM\Table']
);
$result = $this->getTableLocator()->get('Comments');
$this->assertInstanceOf('Cake\ORM\Table', $result);
$this->assertEquals('Comments', $Mock->getAlias());
$this->assertEquals('Comments', $allMethodsMocks->getAlias());

$this->assertNotEquals($allMethodsStubs, $allMethodsMocks);
}

/**
Expand Down

0 comments on commit 0716dd2

Please sign in to comment.