In the main testing area, there is a light funnel down in the pit. The funnel is flowing toward a white wall. Your objective is to fall into the funnel, then make a portal on the white wall where the funnel is flowing, and put another portal up high on the wall in the distance, near the big monitor where you can see Wheatley. This will make you come out of that other wall.
After you go through the portal, look to the side toward where you can see Wheatley. There is another white wall. Carefully put a portal on that wall such that the funnel starts coming out of that wall instead, but make sure that you will fall into the funnel when it changes position. Wheatley will complain that you're taking too long.
After being pushed to the wall in this funnel, look below you to see a checkerboard floor. Put a portal there such that the light funnel comes out of it instead. It will send you up such that you can walk onto the ledge up here that has a couple of buttons on it.
The small red button will make a frankencube drop down from the chute. Put a portal on the wall below the chute to make the light funnel come out of it, then press the small button. The cube will flow toward the wall. Once it's up against the wall, put a portal on that checkerboard floor down below to make the funnel go up toward the ceiling. Grab the cube out of the light funnel and put it on the checkerboard floor up on the ledge that you are standing on. Put a portal on that floor to make the funnel come up out of it. The cube will rise up and be pressed against the big red button, opening the door. Go out through the exit.