/** * @test */ public function selectSingleCanUseOffset() { $this->testingFramework->createRecord('tx_phpunit_test', array('title' => 'Title A')); $uid = $this->testingFramework->createRecord('tx_phpunit_test', array('title' => 'Title B')); self::assertSame(array('uid' => (string) $uid), \Tx_Phpunit_Service_Database::selectSingle('uid', 'tx_phpunit_test', '', '', 'title', 1)); }
/** * Reads the highest UID for a database table. * * This function may only be called after that the provided table name * has been checked to be non-empty, valid and pointing to an existing * database table that has the "uid" column. * * @param string $tableName * the name of an existing table that has the "uid" column * * @return integer the highest UID from this table, will be >= 0 */ protected function getMaximumUidFromTable($tableName) { $row = Tx_Phpunit_Service_Database::selectSingle('MAX(uid) AS uid', $tableName); return $row['uid']; }
/** * @test */ public function increaseRelationCounterIncreasesNonZeroFieldValueByOne() { $uid = $this->fixture->createRecord('tx_phpunit_test', array('related_records' => 41)); $this->fixture->increaseRelationCounter('tx_phpunit_test', $uid, 'related_records'); $row = Tx_Phpunit_Service_Database::selectSingle('related_records', 'tx_phpunit_test', 'uid = ' . $uid); $this->assertSame(42, intval($row['related_records'])); }