assertEquals( $assert, $values ); } /** * Data provider for test_wc_is_webhook_valid_status. * * @since 3.5.3 */ public function data_provider_test_wc_is_webhook_valid_status() { return array( array( true, wc_is_webhook_valid_status( 'active' ) ), array( true, wc_is_webhook_valid_status( 'paused' ) ), array( true, wc_is_webhook_valid_status( 'disabled' ) ), array( false, wc_is_webhook_valid_status( 'pending' ) ), ); } /** * Test wc_is_webhook_valid_status * * @dataProvider data_provider_test_wc_is_webhook_valid_status * @since 3.5.3 * @param bool $assert Expected outcome. * @param array $values Values to test. * @return void */ public function test_wc_is_webhook_valid_status( $assert, $values ) { $this->assertEquals( $assert, $values ); } /** * Test wc_get_webhook_statuses(). * * @since 3.2.0 */ public function test_wc_get_webhook_statuses() { $expected = array( 'active' => 'Active', 'paused' => 'Paused', 'disabled' => 'Disabled', ); $this->assertEquals( $expected, wc_get_webhook_statuses() ); } /** * Test wc_load_webhooks(). * * @since 3.2.0 */ public function test_wc_load_webhooks() { $webhook = new WC_Webhook(); $webhook->set_props( array( 'status' => 'active', 'name' => 'Testing webhook', 'user_id' => 0, 'delivery_url' => 'https://requestb.in/17jajv31', 'secret' => 'secret', 'topic' => 'action.woocommerce_some_action', 'api_version' => 2, ) ); $webhook->save(); $this->assertTrue( wc_load_webhooks() ); $webhook->delete( true ); $this->assertFalse( wc_load_webhooks() ); } }