public function testFindOrCreateMakesNewObject() { $box = Machinist::blueprint("box", "box", array('name' => 'square box')); Machinist::blueprint("stuff_in_a_box", "stuff", array('name' => "hello", 'box' => Machinist::relationship($box)->local('box_id'))); $stuff = Machinist::blueprint("stuff_in_a_box")->findOrCreate(array('name' => 'A New Name That Ihope is not there')); $this->assertInstanceOf('\\DerpTest\\Machinist\\Machine', $stuff); $this->assertTrue(is_numeric($stuff->getId())); $this->assertEquals("A New Name That Ihope is not there", $stuff->name); }
public function testRelationshipWithInvalidRelationshipThrowsInvalidArgumentException() { $this->setExpectedException('\\InvalidArgumentException'); Machinist::relationship('invalid'); }