View | Details | Raw Unified | Return to bug 14195
Collapse All | Expand All

(-)a/t/db_dependent/TestBuilder.t (+1 lines)
Lines 236-241 is( $bookseller_result->in_storage, 1, 'build with only_fk = 1 creates the forei Link Here
236
$bookseller = $builder->build({
236
$bookseller = $builder->build({
237
    source  => 'Aqbookseller',
237
    source  => 'Aqbookseller',
238
});
238
});
239
ok( length( $bookseller->{phone} ) <= 30, 'The length for a generated string should not be longer than the size of the DB field' );
239
delete $bookseller->{_fk};
240
delete $bookseller->{_fk};
240
$bookseller_from_db = $rs_aqbookseller->find($bookseller);
241
$bookseller_from_db = $rs_aqbookseller->find($bookseller);
241
is( $bookseller_from_db->in_storage, 1, 'build without the parameter only_sk stores the entry correctly' );
242
is( $bookseller_from_db->in_storage, 1, 'build without the parameter only_sk stores the entry correctly' );
(-)a/t/lib/TestBuilder.pm (-3 / +12 lines)
Lines 288-295 sub _gen_date { Link Here
288
288
289
sub _gen_text {
289
sub _gen_text {
290
    my ($self, $params) = @_;
290
    my ($self, $params) = @_;
291
    my $random = String::Random->new( max => $params->{info}->{size} );
291
    # From perldoc String::Random
292
    return $random->randregex('[A-Za-z]+[A-Za-z0-9_]*');
292
    # max: specify the maximum number of characters to return for * and other
293
    # regular expression patters that don't return a fixed number of characters
294
    my $regex = '[A-Za-z][A-Za-z0-9_]*';
295
    my $size = $params->{info}{size};
296
    if ( defined $size and $size > 1 ) {
297
        $size--;
298
    } elsif ( defined $size and $size == 1 ) {
299
        $regex = '[A-Za-z]';
300
    }
301
    my $random = String::Random->new( max => $size );
302
    return $random->randregex($regex);
293
}
303
}
294
304
295
sub _gen_set_enum {
305
sub _gen_set_enum {
296
- 

Return to bug 14195