product = $this->factory->product->create_simple_product(array( 'country' => 'sweden' )); $this->package = $this->factory->product->create_product_bundle(array( 'country' => 'sweden' )); } /** * @covers Wiaas_Countries::register_product_countries_taxonomy() */ function test_available_countries_created() { // test taxonomy is available $countries = Wiaas_Countries::get_available_countries(); $country_codes = wp_list_pluck($countries, 'code'); $this->assertContains('se', $country_codes); $this->assertContains('fi', $country_codes); $this->assertContains('dk', $country_codes); } /** * @covers Wiaas_Countries::get_product_country() */ function test_get_product_country() { $retrieved_country = Wiaas_Countries::get_product_country($this->product); $this->assertNotNull($retrieved_country, 'Product has not country!'); $this->assertEquals($retrieved_country['name'], 'Sweden', 'Retrieved product country is incorrect!'); } /** * @covers Wiaas_Countries::get_package_country() */ function test_get_package_country() { $retrieved_country = Wiaas_Countries::get_package_country($this->package); $this->assertNotNull($retrieved_country, 'Package has not country!'); $this->assertEquals($retrieved_country['name'], 'Sweden', 'Retrieved package country is incorrect!'); } }