Changeset 375

Show
Ignore:
Timestamp:
09/26/07 10:30:59 (1 year ago)
Author:
bermiferrer
Message:

Fixing bug that generated a new version on updating versioned models. By Salavert

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/acts_as_versioned/lib/ActsAsVersioned.php

    r368 r375  
    382382    function afterUpdate(&$Object) 
    383383    { 
    384         if(!empty($Object->versioned->_skipVersioning)){ 
     384        if(!empty($Object->versioned->_skipVersioning) || !$Object->versioned->isDifferentFromLastVersion()){ 
    385385            return true; 
    386386        } 
  • plugins/acts_as_versioned/test/acts_as_versioned_tests.php

    r351 r375  
    187187    } 
    188188 
     189    function test_should_not_create_new_versions_when_updating_models_without_changes() 
     190    { 
     191        $this->assertTrue($Post =& $this->Post->findFirstBy('title', 'Post 3.5')); 
     192        $Post->versioned->load(); 
     193        $expected_versions_count = count($Post->versions); 
     194         
     195        $this->assertTrue($Post =& $this->Post->findFirstBy('title', 'Post 3.5')); 
     196        $this->assertTrue($Post->save()); 
     197        $Post->versioned->load(); 
     198        $this->assertEqual(count($Post->versions), $expected_versions_count); 
     199    } 
     200     
    189201    function test_should_drop_versioned_table() 
    190202    {