Add unit test

This commit is contained in:
James Collins 2019-12-04 12:29:40 +08:00
parent b29f8cc1bd
commit 7187db66e1
1 changed files with 13 additions and 0 deletions

View File

@ -189,4 +189,17 @@ class WC_Tests_CRUD_Webhooks extends WC_Unit_Test_Case {
$object = new WC_Webhook();
$this->assertEquals( 'GBDo00G55h6IiV+6CxqivQPLbI//KzaOZm747971tPs=', $object->generate_signature( 'secret' ) );
}
/**
* Test: webhook deletion invalidates caches
*/
public function test_webhook_deletion() {
$object = new WC_Webhook();
$id = $object->save();
$object = new WC_Webhook( $id );
$this->assertEquals( $id, $object->get_id() );
$this->assertTrue( $object->delete() );
$object = new WC_Webhook( $id );
$this->assertNotEquals( $id, $object->get_id() );
}
}