@@ -440,79 +440,86 @@ TEST(object, non_existent_attr_operations) {
440440 ASSERT_TRUE (nonExistentAttr2.isNull ());
441441
442442 // Test attr() with update=true for non-existent properties
443- auto newAttr1 = obj.attr (" new_prop" , true );
444- newAttr1 = 2003 ;
445- ASSERT_EQ (obj.get (" new_prop" ).toInt (), 2003 );
443+ auto newAttr1 = obj.attr (" new_prop" , true );
444+ newAttr1 = 2003 ;
445+ ASSERT_EQ (obj.get (" new_prop" ).toInt (), 2003 );
446446
447447 // For attr chaining, we need to work with Object type
448- try_call ([&]() {
449- Object tempObj = newObject (" stdClass" );
450- auto chained = tempObj.attr (" non_existent" );
451- ASSERT_TRUE (chained.isNull ());
452- }, " " , true );
448+ try_call (
449+ [&]() {
450+ Object tempObj = newObject (" stdClass" );
451+ auto chained = tempObj.attr (" non_existent" );
452+ ASSERT_TRUE (chained.isNull ());
453+ },
454+ " " ,
455+ true );
453456
454457 // Test attrRef with non-existent properties
455- auto ref3 = obj.attrRef (" missing_prop" );
456- // This should work but return a reference to null/undefined
457- ASSERT_TRUE (ref3.isReference ());
458- ref3 = " assigned_value" ;
458+ auto ref3 = obj.attrRef (" missing_prop" );
459+ // This should work but return a reference to null/undefined
460+ ASSERT_TRUE (ref3.isReference ());
461+ ref3 = " assigned_value" ;
459462 ASSERT_STREQ (obj.get (" missing_prop" ).toCString (), " assigned_value" );
460463
461- try_call ([&]() {
462- null_object.attr (" prop" ); // Accessing attr on null object
463- }, " read property `prop` on null" );
464+ try_call (
465+ [&]() {
466+ null_object.attr (" prop" ); // Accessing attr on null object
467+ },
468+ " read property `prop` on null" );
464469}
465470
466471TEST (object, array_object_non_existent_items) {
467472 // Test ArrayObject specific behavior with non-existent items
468473 auto arrayObj = newObject (" ArrayObject" );
469-
474+
470475 // Test offsetGet with non-existent indices
471476 auto result1 = arrayObj.offsetGet (999 );
472477 ASSERT_TRUE (result1.isNull ());
473-
478+
474479 auto result2 = arrayObj.offsetGet (" non_existent_key" );
475480 ASSERT_TRUE (result2.isNull ());
476-
481+
477482 // Test exists methods
478483 ASSERT_FALSE (arrayObj.offsetExists (999 ));
479484 ASSERT_FALSE (arrayObj.offsetExists (" non_existent_key" ));
480-
485+
481486 // Test item method on ArrayObject
482487 auto item1 = arrayObj.item (500 );
483488 ASSERT_TRUE (item1.isNull ());
484-
489+
485490 auto item2 = arrayObj.item (" missing_key" );
486491 ASSERT_TRUE (item2.isNull ());
487-
492+
488493 // Test that non-existent items can be assigned
489494 auto newItem = arrayObj.item (" new_key" , true );
490495 newItem = " assigned_value" ;
491-
496+
492497 auto retrieved = arrayObj.item (" new_key" );
493498 ASSERT_STREQ (retrieved.toCString (), " assigned_value" );
494499}
495500
496501TEST (object, custom_class_non_existent_operations) {
497502 // Test non-existent operations on custom classes
498503 include (get_include_dir () + " /library.php" , INCLUDE_ONCE);
499-
504+
500505 auto obj = newObject (" TestClass2" );
501-
506+
502507 // Test non-existent properties on custom class
503508 ASSERT_TRUE (obj.attr (" non_existent_custom_prop" ).isNull ());
504509 ASSERT_FALSE (obj.propertyExists (" non_existent_custom_prop" ));
505-
510+
506511 // Test non-existent methods
507512 ASSERT_FALSE (obj.methodExists (" nonExistentMethod" ));
508-
513+
509514 // Test chained operations
510- try_call ([&]() {
511- Object tempObj = newObject (" stdClass" );
512- auto firstLevel = tempObj.attr (" missing_prop" );
513- ASSERT_TRUE (firstLevel.isNull ());
514- }, " " );
515-
515+ try_call (
516+ [&]() {
517+ Object tempObj = newObject (" stdClass" );
518+ auto firstLevel = tempObj.attr (" missing_prop" );
519+ ASSERT_TRUE (firstLevel.isNull ());
520+ },
521+ " " );
522+
516523 // Test with update on custom class
517524 try {
518525 auto newAttr = obj.attr (" dynamically_added_prop" , true );
@@ -524,40 +531,39 @@ TEST(object, custom_class_non_existent_operations) {
524531
525532TEST (object, special_object_types_non_existent) {
526533 // Test non-existent operations on special object types
527-
534+
528535 // DateTime object - test property access only
529536 auto dateTime = newObject (" DateTime" );
530537 ASSERT_TRUE (dateTime.attr (" non_existent_datetime_prop" ).isNull ());
531-
538+
532539 // Simple stdClass object
533540 auto simpleObj = newObject (" stdClass" );
534541 ASSERT_TRUE (simpleObj.attr (" simple_missing_prop" ).isNull ());
535542
536- try_call ([&](){
537- ASSERT_TRUE (simpleObj.item (" simple_missing_item" ).isNull ());
538- }, " Cannot use object of type stdClass as array" );
543+ try_call ([&]() { ASSERT_TRUE (simpleObj.item (" simple_missing_item" ).isNull ()); },
544+ " Cannot use object of type stdClass as array" );
539545
540546 // Test that basic operations work without crashing
541547 SUCCEED () << " Special object types test completed" ;
542548}
543549
544550TEST (object, simple_property_access) {
545551 auto obj = newObject (" stdClass" );
546-
552+
547553 // Test basic property operations
548554 obj.set (" test_prop" , " test_value" );
549555 ASSERT_STREQ (obj.get (" test_prop" ).toCString (), " test_value" );
550-
556+
551557 // Test non-existent property
552558 ASSERT_TRUE (obj.get (" non_existent" ).isNull ());
553-
559+
554560 // Test property existence
555561 ASSERT_TRUE (obj.propertyExists (" test_prop" ));
556562 ASSERT_FALSE (obj.propertyExists (" missing_prop" ));
557-
563+
558564 // Test attr access
559565 auto attrResult = obj.attr (" test_prop" );
560566 ASSERT_STREQ (attrResult.toCString (), " test_value" );
561-
567+
562568 SUCCEED () << " Simple property access test completed" ;
563569}
0 commit comments