Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestFailedToSaveAssociationShouldRollback (0.12 sec)

  1. tests/hooks_test.go

    		return errors.New("invalid item")
    	}
    	return nil
    }
    
    func (pi *ProductItem) AfterFind(*gorm.DB) error {
    	pi.AfterFindCallTimes = pi.AfterFindCallTimes + 1
    	return nil
    }
    
    func TestFailedToSaveAssociationShouldRollback(t *testing.T) {
    	DB.Migrator().DropTable(&Product4{}, &ProductItem{})
    	DB.AutoMigrate(&Product4{}, &ProductItem{})
    
    	product := Product4{Name: "Product-1", Price: 100, Item: ProductItem{Code: "invalid"}}
    Registered: Sun Sep 07 09:35:13 UTC 2025
    - Last Modified: Mon Jun 17 03:59:06 UTC 2024
    - 16.7K bytes
    - Viewed (0)
Back to top