Download the PHP package level-level/wp-browser-woocommerce without Composer

On this page you can find all versions of the php package level-level/wp-browser-woocommerce. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-browser-woocommerce

wp-browser-woocommerce

This library simplifies testing of WooCommerce themes and plugins with wp-browser. Several Unit Test Factories are added that allow you to quickly create WooCommerce products and orders within an integration test.

Getting started

Before getting started with wp-browser-woocommerce, make sure you read the excellent documentation for wp-browser first.

Installation

To install wp-browser-woocommerce you use composer. The library is published on packagist.

Your first WooCommerce test

Tests written with wp-browser-woocommerce are a lot like regular wp-browser integration tests. By extending from \LevelLevel\WPBrowserWooCommerce\WCTestCase instead of the regular \WPTestCase, you will get access to WooCommerce unit test factories.

Factories

The factories provide methods to allow for quick object creation. The factories are access with the $this->factory() method on a testcase.

In the background, the factories use the WooCommerce REST API methods to create and retrieve objects. These are not actual GET/POST requests, but rather internal calls to the methods that would process the regular requests to the API.

All factories extend from the WordPress default WP_UnitTest_Factory_For_Thing. All methods that are specified on this base class are available on the factories you will use in WooCommerce tests.

In this documentation you will only find the most used ones, refer to the base class or WordPress documentation for others.

Orders

You can access the order factory by using $this->factory()->order within a WooCommerce integration test.

The main method you'll use is create_and_get( $args ). The input you can give to an order are the same as you can give to the order creation API endpoint.

create_and_get($args) returns the result of wc_get_order() for the created object.

See https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-order

Example:

Products

You can access the order factory by using $this->factory()->product within a WooCommerce integration test.

The main method you'll use is create_and_get( $args ). The input you can give to an order are the same as you can give to the product creation API endpoint.

create_and_get($args) returns the result of wc_get_product() for the created object.

See https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-product

Example:

Tax rates

You can access the order factory by using $this->factory()->tax_rate within a WooCommerce integration test.

The main method you'll use is create_and_get( $args ). The input you can give to an order are the same as you can give to the product creation API endpoint.

create_and_get($args) returns an array, as tax rates have no data class/model within WooCommerce.

See https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-tax-rate

Example:

Coupons

You can access the coupon factory by using $this->factory()->coupon within a WooCommerce integration test.

The main method you'll use is create_and_get( $args ). The input you can give to a coupon are the same as you can give to the coupon creation API endpoint.

create_and_get($args) returns the result of new WC_Coupon( $coupon_id ) for the created object.

See https://woocommerce.github.io/woocommerce-rest-api-docs/#create-a-coupon

Example:

Shipping zones

You can access the shipping zone factory by using $this->factory()->shipping_zone within a WooCommerce integration test.

The main method you'll use is create_and_get( $args ). The input you can give to a shipping zone are the same as you can give to the shipping zone creation API endpoint.

create_and_get($args) returns the result of new WC_Shipping_Zone( $shipping_zone_id ) for the created object.

See https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#create-a-shipping-zone

Example:

Adding locations

It's possible to add location rules to shipping zones. See the code below for an example:

Shipping zone methods

You can access the shipping zone method factory by using $this->factory()->shipping_zone_method within a WooCommerce integration test.

The main method you'll use is create_and_get( $args ). The input you can give to a shipping zone method are the same as you can give to the shipping zone method creation API endpoint.

create_and_get($args) returns an WC_Shipping_Method object.

Not that you have to set a zone_id, as created with the shipping_zone factory.

See https://woocommerce.github.io/woocommerce-rest-api-docs/?shell#include-a-shipping-method-to-a-shipping-zone

Example:

Subscriptions

The subscription factory can only be used when the WooCommerce Subscriptions plugin is installed and activated.

You can access the subscription factory by using $this->factory()->subscription within a WooCommerce integration test.

The main method you'll use is create_and_get( $args ). The input you can give to a subscription are the same as you can give to the subscription creation API endpoint.

create_and_get($args) returns the result of wcs_get_subscription( $subscription_id ) for the created object.

See https://woocommerce.github.io/subscriptions-rest-api-docs/v1.html#create-a-subscription

Example:

Testcases

For most testcases you will want to use \LevelLevel\WPBrowserWooCommerce\WCTestCase

Ajax calls

For ajax calls, the regular \WPAjaxTestCase would be replaced with \LevelLevel\WPBrowserWooCommerce\WCAjaxTestCase

Example:

Development

wp-browser-woocommerce is actively being used at Level Level. The library will get new features as we need them for client projects.

Roadmap

The main focus is on implementing more factories for other WooCommerce objects such as customers, and refunds.

After this, focus might shift to popular extensions for WooCommerce, such as Subscriptions or Bookings.

Contributing

Feel free to open issues or create pull requests if you feel something is missing or working incorrectly.


All versions of wp-browser-woocommerce with dependencies

PHP Build Version
Package Version
Requires lucatume/wp-browser Version ^2|^3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package level-level/wp-browser-woocommerce contains the following files

Loading the files please wait ....