To test things for durability, program the Arduino to turn the electromagnet on and off every second for an hour. Check in frequently to see if it has blown up, melted down or gone up in smoke. ;)
Re the PNP transistor, to turn the transistor on you need to bias the base-emitter junction.
In the 5V bias, NPN transistor version that's in the diagram, this is no problem: Arudino pin goes high, current flows through resistor into the B-E junction and back to Arduino ground.
To do the same thing with a PNP transistor, as in this diagram, we have to send the 24V supply current through the B-E junction, and into the Arduino pin. Goodbye pin.
You could add another small NPN trnasistor to get around this, something like in this diagram, but it is probably better and definitley more reliable to just get single NPN Darlingtons like the TIP102 or TIP122.