Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for TestFailedToSaveAssociationShouldRollback (0.47 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"}}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
Back to top