Skip to content

Commit fc87e69

Browse files
committed
woocommmerce connector test updated.
1 parent 9d911a3 commit fc87e69

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

connectors/class-connector-woocommerce.php

+2-15
Original file line numberDiff line numberDiff line change
@@ -660,27 +660,14 @@ public function callback_woocommerce_tax_rate_updated( $tax_rate_id, $tax_rate )
660660
* @param int $tax_rate_id Tax Rate ID.
661661
*/
662662
public function callback_woocommerce_tax_rate_deleted( $tax_rate_id ) {
663-
global $wpdb;
664-
665-
$tax_rate_name = $wpdb->get_var(
666-
$wpdb->prepare(
667-
"SELECT tax_rate_name FROM {$wpdb->prefix}woocommerce_tax_rates
668-
WHERE tax_rate_id = %s
669-
",
670-
$tax_rate_id
671-
)
672-
);
673-
674663
$this->log(
675664
/* translators: %4$s: a tax rate name (e.g. "GST") */
676665
_x(
677-
'"%s" tax rate deleted',
666+
'Tax rate identified by ID:"%s" deleted',
678667
'Tax rate name',
679668
'stream'
680669
),
681-
array(
682-
'tax_rate_name' => $tax_rate_name,
683-
),
670+
compact( 'tax_rate_id' ),
684671
$tax_rate_id,
685672
'tax',
686673
'deleted'

tests/tests/connectors/test-class-connector-woocommerce.php

+4-13
Original file line numberDiff line numberDiff line change
@@ -461,15 +461,8 @@ public function test_callback_woocommerce_attribute_deleted() {
461461
public function test_callback_woocommerce_tax_rate_added() {
462462
// Create tax rate array for later use.
463463
$tax_rate = array(
464-
'tax_rate_country' => 'USA',
465-
'tax_rate_state' => 'Pennsylvania',
466464
'tax_rate' => '10',
467465
'tax_rate_name' => 'test tax rate',
468-
'tax_rate_priority' => 1,
469-
'tax_rate_compound' => 1,
470-
'tax_rate_shipping' => 1,
471-
'tax_rate_order' => 0,
472-
'tax_rate_class' => '',
473466
);
474467

475468
// Expected log calls
@@ -478,7 +471,7 @@ public function test_callback_woocommerce_tax_rate_added() {
478471
->with(
479472
$this->equalTo( '"%4$s" tax rate created' ),
480473
$this->equalTo( $tax_rate ),
481-
$this->notEqualTo( '' ),
474+
$this->greaterThan( 0 ),
482475
$this->equalTo( 'tax' ),
483476
$this->equalTo( 'created' )
484477
);
@@ -546,10 +539,8 @@ public function test_callback_woocommerce_tax_rate_deleted() {
546539
$this->mock->expects( $this->once() )
547540
->method( 'log' )
548541
->with(
549-
$this->equalTo( '"%s" tax rate deleted' ),
550-
$this->equalTo(
551-
array( 'tax_rate_name' => 'test tax rate' )
552-
),
542+
$this->equalTo( 'Tax rate identified by ID:"%s" deleted' ),
543+
$this->equalTo( compact( 'tax_rate_id' ) ),
553544
$this->equalTo( $tax_rate_id ),
554545
$this->equalTo( 'tax' ),
555546
$this->equalTo( 'deleted' )
@@ -563,6 +554,6 @@ public function test_callback_woocommerce_tax_rate_deleted() {
563554
}
564555

565556
public function test_callback_updated_option() {
566-
557+
$this->markTestSkipped( 'This test needs to be written.' );
567558
}
568559
}

0 commit comments

Comments
 (0)