Was there a couple of years ago doing this in reverse (Perpignan - Portbou), and yes, I DID have my passport checked - bizarrely, by the French at Cerbere - we were about 15 mins late leaving as a consequence. There were no checks in and out of Spain, or coming back into France. It's an odd operation, where Frencn trains (SNCF) used to operate (sometimes) to Portbou, but NOT Portbou to Cerbere (they operated empty back to Cerbere) and Renfe operated (sometimes) to Cerbere but NOT Cerbere to Portbou. It's the same malarkey with Hendaye and Irun at the other end of the Pyrennes.
Annoyingly, you can buy a ticket Perpignan to Portbou with SNCF (€9.20, sometimes €5), but at Portbou, they wouldonly sell you a ticket to Cerbere, you have to buy another ticket if you want to go to Cerbere (or buy a return ticket to Cerbere, and a return ticket Cerbere to Portbou). I am told there are arcane reasons behind this operational style, notwithstanding the gauge change. I think you CAN buy these tickets on line however.