/** * http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers */ public function getOrm() { $t = new MingoTestOrm(); $t->setFields(array('foo' => rand(0, PHP_INT_MAX), 'bar' => array('baz' => md5(microtime(true))))); return $t; }
public function testAttach() { $t = new MingoTestOrm(); $t->setFoo(array(1, 2, 3)); $t->attachFoo(4); $this->assertEquals(array(1, 2, 3, 4), $t->getFoo()); $t->attachFoo(5, 6); $this->assertEquals(array(1, 2, 3, 4, 5, 6), $t->getFoo()); $t->setBar('foo'); $t->attachBar('bar'); $this->assertEquals('foobar', $t->getBar()); $this->assertTrue($t->isModified()); }