On a procedure for testing the order of time series