Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
senadir committed Dec 12, 2023
1 parent f8567fb commit b9aa65e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion tests/php/Bootstrap/MainFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,37 @@ class MainFile extends WP_UnitTestCase {
* Ensure that container is reset between tests.
*/
protected function setUp(): void {
// reset container
// reset container.
$this->container = Package::container( true );
}

/**
* Test that the container is returned from the main file.
*/
public function test_container_returns_same_instance() {
$container = Package::container();
$this->assertSame( $container, $this->container );
}

/**
* Test that the container is reset when the reset flag is passed.
*/
public function test_container_reset() {
$container = Package::container( true );
$this->assertNotSame( $container, $this->container );
}

/**
* Asserts that the bootstrap class is returned from the container.
*/
public function wc_blocks_bootstrap() {
$this->assertInstanceOf( Bootstrap::class, wc_blocks_bootstrap() );
}

/**
* Ensure that the init method is called on the bootstrap class. This is a workaround since we're using an anti-pattern for DI.
*/
protected function tearDown(): void {
Package::init();
}
}
2 changes: 1 addition & 1 deletion tests/php/StoreApi/Routes/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ public function test_add_variable_product_to_cart_returns_variation_data() {
array(
'variation' => array( // order matters, alphabetical attribute order.
array(
'attribute' => 'color',
'attribute' => 'Color',
'value' => 'red',
),
array(
Expand Down

0 comments on commit b9aa65e

Please sign in to comment.