has('unknownProperty')); self::assertTrue($properties->has($property->name())); self::assertSame($property, $properties->get($property->name())); } public function test_get_non_existing_property_throws_exception(): void { $this->expectException(PropertyNotFound::class); $this->expectExceptionCode(1510936145); $this->expectExceptionMessage('The property `unknownProperty` does not exist.'); (new Properties())->get('unknownProperty'); } public function test_properties_are_countable(): void { $properties = new Properties( FakePropertyDefinition::new('propertyA'), FakePropertyDefinition::new('propertyB'), FakePropertyDefinition::new('propertyC'), ); self::assertCount(3, $properties); } public function test_properties_are_iterable(): void { $propertiesInstances = [ 'propertyA' => FakePropertyDefinition::new('propertyA'), 'propertyB' => FakePropertyDefinition::new('propertyB'), 'propertyC' => FakePropertyDefinition::new('propertyC'), ]; $properties = new Properties(...array_values($propertiesInstances)); $this->checkIterable($properties, $propertiesInstances); } }