A court may order pendente lite relief consisting of a custody or visitation order pursuant to Part 2 (commencing with Section 3020) of Division 8, if the court finds both of the following:
(a) Based on the tests authorized by Section 7541, a parent and child relationship exists pursuant to Section 7540.
(b) The custody or visitation order would be in the best interest of the child.