/** * Test update where conditions are an array that needs to be prepared. */ public function testUpdateWithConditionsThatNeedToBePrepared() { $affected_rows = $this->connection->update('writers', ['name' => 'Anton Chekhov', 'birthday' => new DateTime('1860-01-29')], ['`name` = ?', 'Leo Tolstoy']); $this->assertEquals(1, $affected_rows); $this->assertEquals(1, $this->connection->executeFirstCell('SELECT COUNT(`id`) AS "row_count" FROM `writers` WHERE `name` = ?', 'Anton Chekhov')); $this->assertEquals(0, $this->connection->executeFirstCell('SELECT COUNT(`id`) AS "row_count" FROM `writers` WHERE `name` = ?', 'Leo Tolstoy')); }
/** * Check if attempts value for the given job has an expected value. * * @param int|null $expected * @param int $job_id */ protected function assertAttempts($expected, $job_id) { $result = $this->connection->executeFirstCell('SELECT `attempts` FROM `' . MySqlQueue::JOBS_TABLE_NAME . '` WHERE id = ?', $job_id); if ($expected === null) { $this->assertEmpty($result); } else { $this->assertSame($expected, (int) $result); } }