Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add nullvalue tests

  • Loading branch information...
commit cf5fe6d1a935420e4217c02e1995705cc13b5f89 1 parent bb4f78a
@sitetechie authored
Showing with 13 additions and 0 deletions.
  1. +13 −0 t/02-store/06-pi-attributes.t
View
13 t/02-store/06-pi-attributes.t
@@ -41,6 +41,19 @@ like( exception { $pi->add_to_attributes() }, qr/create needs a hashref/);
isa_ok(exception { $pi->add_to_attributes({}) }, 'DBIx::Class::Exception');
# mysql: execute failed: Field 'name' doesn't have a default value
#like( exception { $pi->add_to_attributes({}) }, qr/wfe_process_instance_attr.name may not be NULL/);
+
+ok($pi->add_to_attributes({ name => 'e1', }));
+ok($pi->add_to_attributes({ name => 'e2', value => undef }));
+ok($pi->add_to_attributes({ name => 'e3', value => \'NULL' }));
+foreach(qw/e1 e2 e3/) {
+ ok(!defined $pi->attribute($_)->value);
+ }
+
+ok($pi->add_to_attributes({ name => 'e4', value => '' }));
+like(exception { $pi->attribute('e4')->value }, qr/malformed JSON string/, 'value, if any, should be a reference');
+ok($pi->add_to_attributes({ name => 'e5', value => 'NULL' })); # string
+like(exception { $pi->attribute('e5')->value }, qr/malformed JSON string/, 'value, if any, should be a reference');
+
ok($pi->add_to_attributes({ name => '' }));
isa_ok(exception { $pi->add_to_attributes({ name => ''}) }, 'DBIx::Class::Exception');
# mysql: execute failed: Duplicate entry '3-'
Please sign in to comment.
Something went wrong with that request. Please try again.