/** * Execute where method with the specified episode and season numbers * * @param string|int|Episode $s Season, or array with keys season & episode * @param string|int|null $e Episode, optional if $s is an array * * @return self */ public function whereEp($s, $e = null) { if (!isset($e)) { parent::where('season', $s->season); parent::where('episode', $s->episode); } else { parent::where('season', $s); parent::where('episode', $e); } return $this; }
} if ($id !== 2) { fail('INSERT_RETURN_WRONG_DATA'); } // Check insert with returning string $name = $Database->insert('users', array('name' => 'Anna'), 'name'); checkQuery('INSERT INTO users ("name") VALUES (\'Anna\') RETURNING "name"', 'INSERT_QUERY_MISMATCH'); if (!is_string($name)) { fail('INSERT_RETURN_WRONG_DATA_TYPE_STRING'); } if ($name !== 'Anna') { fail('INSERT_RETURN_WRONG_DATA'); } # where() Checks // Generic use $Id1 = $Database->where('id', 1)->get('users'); checkQuery('SELECT * FROM users WHERE "id" = 1', 'WHERE_QUERY_MISMATCH'); if (empty($Id1) || !isset($Id1[0]['id'])) { fail('WHERE_RETURNING_WRONG_DATA'); } if ($Id1[0]['id'] !== 1) { fail('WHERE_RETURNING_WRONG_DATA_TYPE_INT'); } if ($Id1[0]['name'] !== 'David') { fail('WHERE_RETURNING_WRONG_DATA_TYPE_STRING'); } // String check $Id1 = $Database->where('"id" = 1')->get('users'); checkQuery('SELECT * FROM users WHERE "id" = 1', 'WHERE_QUERY_STRING_MISMATCH'); if (empty($Id1) || !isset($Id1[0]['id']) || $Id1[0]['id'] != 1) { fail('WHERE_RETURNING_WRONG_DATA');