Why was the Vera C. Rubin Observatory LSST Camera tested with a broccoli and a pinhole?
From the first article you linked:

Taking the first 3,200-megapixel images of a variety of objects, including a head of Romanesco – a type of broccoli – that was chosen for its very detailed surface structure, was one of these tests. To do so without a fully assembled camera, the SLAC team used a 150-micron pinhole to project images onto the focal plane.

Which implies:

the advantage of using a pinhole is that it allows the sensors to be tested without requiring the full camera to be assembled yet.
the Romanesco was chosen to test the sensors' ability to image an object with detailed structure.