Пример #1
0
        }
        if (count($response['deactivate_list']) > 0) {
            $log_entry = "Deactivates " . implode(", ", $response['deactivate_list']);
            transaction_log($ibl_team, $log_entry, $db);
        }
        // Display our template showing what was updated
        include 'templates/modify_roster/update.php';
    }
    // Check to see if we're adding a new player to this list
    $add = 0;
    if (isset($_POST["new_tig_name"]) && $_POST["new_tig_name"] != "") {
        $add = 1;
    }
    if ($add == 1) {
        $values = ['tig_name' => $_POST['new_tig_name'], 'ibl_team' => $_POST['ibl_team'], 'item_type' => $_POST['new_type'], 'status' => $_POST['new_status'], 'comments' => $_POST['new_comments']];
        $roster->addPlayer($values);
    }
    // We've picked a team, let's grab all the players on their roster
    $ibl_team = $_POST["ibl_team"];
    $select = $db->newSelect();
    $select->from('teams')->cols(['id', 'tig_name', 'item_type', 'comments', 'status'])->where('ibl_team = :team')->orderBy(['tig_name']);
    $select->bindValue('team', $ibl_team);
    $sth = $pdo->prepare($select->getStatement());
    $sth->execute($select->getBindValues());
    $results = $sth->fetchAll(PDO::FETCH_ASSOC);
    // Include our main template
    include 'templates/modify_roster/main.php';
}
?>
<hr>
<div align=center><a href=roster_management.php>Return to Roster Management</a></div>
Пример #2
0
 public function testAddPlayerAddsPlayerCorrectly()
 {
     // Create an array of player data
     $player_data = ['tig_name' => 'Testy McTesterton', 'ibl_team' => 'MAD', 'item_type' => 1, 'comments' => 'Test item'];
     // Create a mock insert object
     $insert = $this->getMockBuilder('stdClass')->setMethods(['into', 'cols'])->getMock();
     $insert->expects($this->once())->method('cols')->will($this->returnValue($insert));
     $insert->expects($this->once())->method('into')->will($this->returnValue($insert));
     // Create a mock DB connection
     $db = $this->getMockBuilder('stdClass')->setMethods(['newInsert', 'query'])->getMock();
     $db->expects($this->once())->method('newInsert')->will($this->returnValue($insert));
     $db->expects($this->once())->method('query')->will($this->returnValue(true));
     // Create a new roster object
     $roster = new Roster($db);
     // Assert that true was returned when adding a player
     $this->assertTrue($roster->addPlayer($player_data), 'addPlayer() did not correctly add a new player');
 }