Navigation Menu

Skip to content

Commit

Permalink
Fixed unit tests after latest merge
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Oct 25, 2013
1 parent b324bd5 commit 5dca57e
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions Cake/Test/TestCase/ORM/TableTest.php
Expand Up @@ -899,7 +899,7 @@ public function testSaveNewEntity() {
'created' => new \DateTime('2013-10-10 00:00'),
'updated' => new \DateTime('2013-10-10 00:00')
]);
$table = TableRegistry::get('user');
$table = TableRegistry::get('users');
$this->assertSame($entity, $table->save($entity));
$this->assertEquals($entity->id, 5);

Expand All @@ -921,7 +921,7 @@ public function testSaveEntityOnlySchemaFields() {
'created' => new \DateTime('2013-10-10 00:00'),
'updated' => new \DateTime('2013-10-10 00:00'),
]);
$table = Table::build('users');
$table = TableRegistry::get('users');
$this->assertSame($entity, $table->save($entity));
$this->assertEquals($entity->id, 5);

Expand All @@ -943,7 +943,7 @@ public function testSaveWithFieldList() {
'created' => new \DateTime('2013-10-10 00:00'),
'updated' => new \DateTime('2013-10-10 00:00')
]);
$table = Table::build('users');
$table = TableRegistry::get('users');
$fieldList = ['fieldList' => ['username', 'created', 'updated']];
$this->assertSame($entity, $table->save($entity, $fieldList));
$this->assertEquals($entity->id, 5);
Expand All @@ -959,7 +959,7 @@ public function testSaveWithFieldList() {
* @return void
*/
public function testBeforeSaveModifyData() {
$table = Table::build('users');
$table = TableRegistry::get('users');
$data = new \Cake\ORM\Entity([
'username' => 'superuser',
'created' => new \DateTime('2013-10-10 00:00'),
Expand All @@ -982,7 +982,7 @@ public function testBeforeSaveModifyData() {
* @return void
*/
public function testBeforeSaveModifyOptions() {
$table = Table::build('users');
$table = TableRegistry::get('users');
$data = new \Cake\ORM\Entity([
'username' => 'superuser',
'password' => 'foo',
Expand Down Expand Up @@ -1013,7 +1013,7 @@ public function testBeforeSaveModifyOptions() {
* @return void
*/
public function testBeforeSaveStopEvent() {
$table = Table::build('users');
$table = TableRegistry::get('users');
$data = new \Cake\ORM\Entity([
'username' => 'superuser',
'created' => new \DateTime('2013-10-10 00:00'),
Expand All @@ -1036,7 +1036,7 @@ public function testBeforeSaveStopEvent() {
* @return void
*/
public function testAfterSave() {
$table = Table::build('users');
$table = TableRegistry::get('users');
$data = new \Cake\ORM\Entity([
'username' => 'superuser',
'created' => new \DateTime('2013-10-10 00:00'),
Expand All @@ -1060,8 +1060,16 @@ public function testAfterSave() {
* @return void
*/
public function testAfterSaveNotCalled() {
$table = $this->getMock('\Cake\ORM\Table', ['_buildQuery'], [['table' => 'users']]);
$query = $this->getMock('\Cake\ORM\Query', ['executeStatement'], [null, $table]);
$table = $this->getMock(
'\Cake\ORM\Table',
['_buildQuery'],
[['table' => 'users', 'connection' => ConnectionManager::get('test')]]
);
$query = $this->getMock(
'\Cake\ORM\Query',
['executeStatement', 'addDefaultTypes'],
[null, $table]
);
$statement = $this->getMock('\Cake\Database\Statement\StatementDecorator');
$data = new \Cake\ORM\Entity([
'username' => 'superuser',
Expand Down

0 comments on commit 5dca57e

Please sign in to comment.