The entire season played out before it was revealed that it was a dream Pam was having.
but they went for this whole season and they had all these situations and then to end the season come to find out Pam it was all a dream