- eval { my $nonexisting_user = $user_rs->recursive_update($updates); };
- like(
- $@,
- qr/No such column, relationship, many-to-many helper accessor or generic accessor 'nonexisting'/,
- 'nonexisting column, accessor, relationship fails'
- );
+
+# for future use when we switch from warn to throw_exception
+# eval { $user_rs->recursive_update($updates); };
+# like(
+# $@,
+# qr/No such column, relationship, many-to-many helper accessor or generic accessor 'nonexisting'/,
+# 'nonexisting column, accessor, relationship fails'
+# );
+ warning_like {
+ my $user = $user_rs->recursive_update($updates);
+ }
+ qr/No such column, relationship, many-to-many helper accessor or generic accessor 'nonexisting'/,
+ 'nonexisting column, accessor, relationship warns';
+ $expected_user_count++;
+ is( $user_rs->count, $expected_user_count, 'User created' );
+
+ # try to create with a not existing rel but suppressed warning
+ $updates = {
+ name => 'Test for nonexisting rel with suppressed warning',
+ username => 'suppressed_nonexisting_rel',
+ password => 'whatever',
+ nonexisting => { foo => 'bar' },
+ };
+
+ warning_is {
+ my $user =
+ $user_rs->recursive_update( $updates,
+ { unknown_params_ok => 1 } );
+ }
+ "",
+ "nonexisting column, accessor, relationship doesn't warn with unknown_params_ok";
+ $expected_user_count++;
+ is( $user_rs->count, $expected_user_count, 'User created' );