Split the `testForeignKey` into several methods. Added some phpdoc so its cleaer