/** * @test * it should allow having a link in the database */ public function it_should_allow_having_a_link_in_the_database(FunctionalTester $I) { $now = time(); Date::_injectNow($now); $linkId = $I->haveLinkInDatabase(); $table = $I->grabLinksTableName(); $criteria = Links::getDefaults(); $criteria['link_id'] = $linkId; $I->seeInDatabase($table, $criteria); }
/** * Inserts a link in the database. * * @param array $overrides The data to insert. * * @return int The inserted link `link_id`. */ public function haveLinkInDatabase(array $overrides = array()) { $tableName = $this->grabLinksTableName(); $defaults = Links::getDefaults(); $overrides = array_merge($defaults, array_intersect_key($overrides, $defaults)); return $this->haveInDatabase($tableName, $overrides); }