/** * Tests virtual foreign keys. * * When having multiple virtual foreign keys, check of the first one should * affect the check of the next one. * * @issue 12071 * @author Radek Crlik <*****@*****.**> * @since 2016-08-03 */ public function testInvalidVirtualForeignKeys() { $this->specify('The Model::save with multiple virtual foreign keys and invalid entity', function () { $body = new Body(); $body->head_1_id = null; $body->head_2_id = 999; // PDOException should'n be thrown expect($body->save())->equals(false); expect($body->getMessages())->count(1); expect($body->getMessages()[0]->getMessage())->equals('Second head does not exists'); }); }