public function testWithersReturnNewModifiedInstance() { $property = new Property('username', 'alice'); $bag = new PropertyBag(); $newBag = $bag->with($property); $this->assertInstanceOf(PropertyBag::class, $newBag); $this->assertSame([], $this->propRefl->getValue($bag)); $this->assertSame(['username' => $property], $this->propRefl->getValue($newBag)); }