PHPUnit stuff.
This commit is contained in:
parent
91dc776e4d
commit
74f1d6e193
30 changed files with 358 additions and 89 deletions
|
@ -1,5 +1,7 @@
|
|||
<?php
|
||||
|
||||
namespace DJMixHosting;
|
||||
|
||||
class DJ
|
||||
{
|
||||
|
||||
|
@ -16,7 +18,7 @@ class DJ
|
|||
private string $created = "";
|
||||
private string $updated = "";
|
||||
private string $claimed_by = "";
|
||||
private mysqli $db;
|
||||
private $db;
|
||||
private array $mixes = [];
|
||||
|
||||
|
||||
|
@ -128,7 +130,7 @@ class DJ
|
|||
$this->updated = $dj['lastupdated'];
|
||||
}
|
||||
|
||||
$this->load_dj_mixes();
|
||||
$this->load_dj_mixes();
|
||||
|
||||
return true;
|
||||
} else {
|
||||
|
@ -136,6 +138,22 @@ class DJ
|
|||
}
|
||||
}
|
||||
|
||||
private function load_dj_mixes(): void
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE dj1 = ? OR dj2 = ? OR dj3 = ?");
|
||||
$stmt->bind_param("iii", $this->id, $this->id, $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$mixes = [];
|
||||
while ($mix = $result->fetch_assoc()) {
|
||||
$mixes[] = $mix;
|
||||
}
|
||||
$stmt->close();
|
||||
$this->mixes = $mixes;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function load_from_slug(): bool
|
||||
{
|
||||
$socials = [];
|
||||
|
@ -209,22 +227,6 @@ class DJ
|
|||
return $this->claimed;
|
||||
}
|
||||
|
||||
private function load_dj_mixes(): void
|
||||
{
|
||||
$stmt = $this->db->prepare("SELECT * FROM mix WHERE dj1 = ? OR dj2 = ? OR dj3 = ?");
|
||||
$stmt->bind_param("iii", $this->id, $this->id, $this->id);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$mixes = [];
|
||||
while ($mix = $result->fetch_assoc()) {
|
||||
$mixes[] = $mix;
|
||||
}
|
||||
$stmt->close();
|
||||
$this->mixes = $mixes;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function get_dj_mixes()
|
||||
{
|
||||
return $this->mixes;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue