Skip to content

Commit 9fceb64

Browse files
CopilotJJJ
andauthored
Add test coverage for network cache clearing on domain/path update (#231)
* Fix sticky cache after changing network domain/path * Revert update_network() changes, keep test --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: JJJ <88951+JJJ@users.noreply.github.com> Co-authored-by: John James Jacoby <johnjamesjacoby@me.com>
1 parent f53cfd3 commit 9fceb64

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/integration/tests/test-networkoperations.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,28 @@ public function test_switch_to_network() {
6565

6666
$this->assertEquals( 1, $current_site->id, 'Switching back should switch the network' );
6767
}
68+
69+
public function test_update_network_clears_cache() {
70+
// Create a test network.
71+
$network_id = $this->factory->network->create(
72+
array(
73+
'domain' => 'example.com',
74+
'path' => '/test/',
75+
)
76+
);
77+
78+
// Get the network to populate cache.
79+
$network = get_network( $network_id );
80+
$this->assertEquals( 'example.com', $network->domain, 'Network should have original domain' );
81+
$this->assertEquals( '/test/', $network->path, 'Network should have original path' );
82+
83+
// Update the network with new domain and path.
84+
$result = update_network( $network_id, 'newdomain.com', '/newpath/' );
85+
$this->assertTrue( $result, 'Network update should succeed' );
86+
87+
// Get the network again - it should reflect the updated values.
88+
$updated_network = get_network( $network_id );
89+
$this->assertEquals( 'newdomain.com', $updated_network->domain, 'Network should have updated domain without manual cache flush' );
90+
$this->assertEquals( '/newpath/', $updated_network->path, 'Network should have updated path without manual cache flush' );
91+
}
6892
}

0 commit comments

Comments
 (0)