Leser: 2
6 Einträge, 1 Seite |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/perl
use strict;
use warnings;
#use Data::Dumper;
use Test::Simple tests => 12;
use DB::Countries;
my $country = new DB::Countries;
my $to_insert = { country => 'Testunien',
country_code => 'TST' };
my $inserted = $country->insert($to_insert);
my $to_update = { country => 'Lummerland',
country_code => 'LUM',
ID_country => $inserted };
ok (defined $inserted,
'$inserted is defined');
ok ($inserted =~ m/^\d+$/,
'$inserted is a numerical id');
my $response = $country->get($inserted);
ok (defined $response,
'$response is defined');
ok (ref $response eq 'ARRAY',
'$response is a reference to an array');
ok ($response->[0]->{country} eq 'Testunien',
'$response->[0]->{country} has expected value: "Testunien"');
ok ($response->[0]->{country_code} eq 'TST',
'$response->[0]->{country_code} has expected value: "TST"');
ok ($country->update($to_update),
'$country->update($to_update) called and succeeded');
$response = $country->get($inserted);
ok (defined $response,
'$response is defined');
ok (ref $response eq 'ARRAY',
'$response is a reference to an array');
ok ($response->[0]->{country} eq 'Lummerland',
'$response->[0]->{country} has expected value: "Lummerland"');
ok ($response->[0]->{country_code} eq 'LUM',
'$response->[0]->{country_code} has expected value: "LUM"');
ok ($country->remove($inserted),
'$country->remove($inserted) called and succeeded');
exit;
QuoteWie geht ihr bei sowas vor?
1
2
3
4
5
6
7
#!/usr/bin/perl
use strict;
use warnings;
#use Data::Dumper;
use Test::Simple tests => 12;
1
2
3
my $country = new DB::Countries;
my $to_insert = { country => 'Testunien',
country_code => 'TST' };
1
2
3
4
5
6
7
8
9
10
11
my $to_update = { country => 'Lummerland',
country_code => 'LUM',
ID_country => $inserted };
ok (defined $inserted,
'$inserted is defined');
ok ($inserted =~ m/^\d+$/,
'$inserted is a numerical id');
my $response = $country->get($inserted);
1
2
ok ($response->[0]->{country_code} eq 'TST',
'$response->[0]->{country_code} has expected value: "TST"');
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
$response = $country->get($inserted);
ok (defined $response,
'$response is defined');
ok (ref $response eq 'ARRAY',
'$response is a reference to an array');
ok ($response->[0]->{country} eq 'Lummerland',
'$response->[0]->{country} has expected value: "Lummerland"');
ok ($response->[0]->{country_code} eq 'LUM',
'$response->[0]->{country_code} has expected value: "LUM"');
ok ($country->remove($inserted),
'$country->remove($inserted) called and succeeded');
exit;
6 Einträge, 1 Seite |