Skip to content

Commit

Permalink
Fix the download log unit test, with the new constraint key introduce…
Browse files Browse the repository at this point in the history
…d in #19330 the download log needs a valid download to save correctly.
  • Loading branch information
kloon committed Apr 18, 2018
1 parent 59d967c commit f0f6169
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/unit-tests/customer/customer-download-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,16 @@ class WC_Tests_Customer_Download_Log extends WC_Unit_Test_Case {
* Test: get_id
*/
function test_get_id() {
$customer_id = wc_create_new_customer( 'test@example.com', 'testuser', 'testpassword' );
$download = new WC_Customer_Download();
$download->set_user_id( $customer_id );
$download->set_order_id( 1 );
$download->save();

$object = new WC_Customer_Download_Log();
$object->set_permission_id( $download->get_id() );
$object->set_user_id( $customer_id );
$object->set_user_ip_address( '1.2.3.4' );
$id = $object->save();
$this->assertEquals( $id, $object->get_id() );
}
Expand Down

0 comments on commit f0f6169

Please sign in to comment.