Example #1
0
 public function testDeletePlayerByIdWorksAsExpected()
 {
     $new_delete = $this->createMockNewDelete();
     $player_values = ['player_id' => 1];
     $db = $this->getMockBuilder('stdClass')->setMethods(['newDelete', 'query'])->getMock();
     $db->expects($this->once())->method('newDelete')->will($this->returnValue($new_delete));
     $db->expects($this->once())->method('query')->with($new_delete, $player_values)->will($this->returnValue(true));
     $roster = new Roster($db);
     $response = $roster->deletePlayerById(1);
     $this->assertEquals(true, $response, 'deletePlayerById() did not return expected true response');
 }
Example #2
0
 }
 if (isset($_POST["shadow_comments"])) {
     $shadow_comments = $_POST["shadow_comments"];
 }
 if (isset($_POST["shadow_status"])) {
     $shadow_status = $_POST["shadow_status"];
 }
 // First, let's see if we're deleting any entries
 $delete = 0;
 if (isset($_POST["delete"])) {
     $delete = 1;
 }
 if ($delete == 1) {
     $delete_list = $_POST["delete"];
     foreach ($delete_list as $player_id) {
         $roster->deletePlayerById($player_id);
     }
 }
 // Hey, are we releasing anyone?
 $release = 0;
 if (isset($_POST["release"])) {
     $release = 1;
 }
 if ($release == 1) {
     $release_list = $_POST["release"];
     $roster->releasePlayerByList($release_list);
     include 'templates/modify_roster/release.php';
     // Build log_entry for transaction log
     $log_entry = "Releases " . implode(", ", $released_player);
     transaction_log($ibl_team, $log_entry, $db);
 }
Example #3
0
 if (isset($_POST['shadow_tig_name'])) {
     $shadow_tig_name = $_POST["shadow_tig_name"];
 }
 if (isset($_POST['shadow_type'])) {
     $shadow_type = $_POST['shadow_type'];
 }
 if (isset($_POST['delete'])) {
     $delete = $_POST["delete"];
 }
 if (isset($_POST['tig_type'])) {
     $type = $_POST["tig_type"];
 }
 print "<div align=center>";
 foreach ($tig_name as $id => $player) {
     if (isset($delete[$id]) && $delete[$id] == 1) {
         $roster->deletePlayerById($id);
         print "Deleted <b>{$player}</b> from free agent pool<br>";
     } else {
         if ($shadow_tig_name[$id] != $player) {
             $update = $db->newUpdate();
             $update->table('teams')->cols(['tig_name' => $player])->where('id = :id')->bindValues(['id' => $id]);
             $sth = $pdo->prepare($update->getStatement());
             $sth->execute($update->getBindValues());
             print "Changed <b>" . $shadow_tig_name[$id] . "</b> to {$player}<br>";
         }
         if ($shadow_type[$id] != $type[$id]) {
             $db->execute($sth2, array($type[$id], $id));
             print "Changed player type for {$player}<br>";
         }
     }
 }