/** * @covers ::delete */ public function testDelete() { $mockdb = new \TMT\MockDB(); $mockdb->expectPrepare("DELETE FROM quicklinks WHERE guid=:guid"); $mockdb->expectExecute(array(':guid' => 'testguid')); $accessor = new Quicklinks($mockdb); $accessor->delete('testguid'); $mockdb->verify(); }
/** * @covers ::delete */ public function testDelete() { $mockdb = new \TMT\MockDB(); $mockdb->expectPrepare("DELETE FROM notificationMethods WHERE name=:name"); $mockdb->expectExecute(array(":name" => "email")); $accessor = new NotificationMethod($mockdb); $actual = $accessor->delete("email"); $mockdb->verify(); }
/** * @covers ::delete */ public function testDelete() { $mockdb = new \TMT\MockDB(); $mockdb->expectPrepare("DELETE FROM notificationEmails WHERE guid=:guid"); $mockdb->expectExecute(array(":guid" => "guid1")); $accessor = new NotificationEmail($mockdb); $accessor->delete("guid1"); $mockdb->verify(); }
/** * @covers ::search */ public function testSearchDateRange() { $mockdb = new \TMT\MockDB(); $accessor = new Notification($mockdb); $mockdb->expectPrepare("SELECT * FROM notifications WHERE (timestamp >= :startDate AND timestamp <= :endDate)"); $mockdb->expectExecute(array(':startDate' => "2000-01-01 00:00:00", ':endDate' => "2000-01-01 00:00:00")); $mockdb->setReturnData(array((object) array("guid" => "guid1", "timestamp" => "2000-01-01 00:00:00", "message" => "something happened", "area" => "area1", "type" => "type1"))); $result = $accessor->search(array('startDate' => "2000-01-01 00:00:00", 'endDate' => "2000-01-01 00:00:00")); $this->assertEquals(array(new \TMT\model\Notification(array("guid" => "guid1", "timestamp" => "2000-01-01 00:00:00", "message" => "something happened", "area" => "area1", "type" => "type1"))), $result); $mockdb->verify(); }
/** * @covers ::deleteAll */ public function testDeleteAll() { $mockdb = new \TMT\MockDB(); $mockdb->expectPrepare("DELETE FROM notificationPreferences WHERE netId=:netId"); $mockdb->expectExecute(array(":netId" => "netId")); $accessor = new NotificationPreferences($mockdb); $accessor->deleteAll("netId"); $mockdb->verify(); }
/** * @covers ::delete */ public function testDelete() { $mockdb = new \TMT\MockDB(); $mockdb->expectPrepare("UPDATE userNotifications SET deleted=1 WHERE netId=:netId AND notificationGuid=:guid"); $mockdb->expectExecute(array(":netId" => "netId", ":guid" => "guid1")); $accessor = new UserNotification($mockdb); $accessor->delete("netId", "guid1"); $mockdb->verify(); }