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

(-)a/t/cypress/integration/Acquisitions/Vendors_spec.ts (-2 / +2 lines)
Lines 94-100 describe("Vendor CRUD operations", () => { Link Here
94
        // Click the button in the toolbar
94
        // Click the button in the toolbar
95
        cy.visit("/cgi-bin/koha/vendors");
95
        cy.visit("/cgi-bin/koha/vendors");
96
        cy.contains("New vendor").click();
96
        cy.contains("New vendor").click();
97
        cy.get("#vendor_add h2").contains("New vendor");
97
        cy.get("#vendor_add h1").contains("Add vendor");
98
98
99
        // Fill in the form for normal attributes
99
        // Fill in the form for normal attributes
100
        cy.get("#vendor_add").contains("Submit").click();
100
        cy.get("#vendor_add").contains("Submit").click();
Lines 189-195 describe("Vendor CRUD operations", () => { Link Here
189
        cy.get("#vendors_list table tbody tr:first").contains("Edit").click();
189
        cy.get("#vendors_list table tbody tr:first").contains("Edit").click();
190
        cy.wait("@get-vendor");
190
        cy.wait("@get-vendor");
191
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
191
        cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet!
192
        cy.get("#vendor_add h2").contains("Edit vendor");
192
        cy.get("#vendor_add h1").contains("Edit vendor");
193
193
194
        // Form has been correctly filled in
194
        // Form has been correctly filled in
195
        cy.get("#vendor_name").should("have.value", vendor.name);
195
        cy.get("#vendor_name").should("have.value", vendor.name);
(-)a/t/db_dependent/Koha/Acquisition/Booksellers.t (-2 / +76 lines)
Lines 17-28 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 6;
20
use Test::More tests => 9;
21
21
22
use t::lib::TestBuilder;
22
use t::lib::TestBuilder;
23
23
24
use C4::Acquisition qw( NewBasket );
24
use C4::Acquisition qw( NewBasket );
25
use C4::Biblio      qw( AddBiblio );
25
use C4::Biblio      qw( AddBiblio );
26
use C4::Contract    qw( AddContract );
26
use C4::Budgets     qw( AddBudgetPeriod AddBudget );
27
use C4::Budgets     qw( AddBudgetPeriod AddBudget );
27
use C4::Serials     qw( NewSubscription SearchSubscriptions );
28
use C4::Serials     qw( NewSubscription SearchSubscriptions );
28
29
Lines 168-173 subtest '->contacts() tests' => sub { Link Here
168
        }
169
        }
169
    );
170
    );
170
171
172
    # Ensure contacts aren't being duplicated on store
173
    $vendor->contacts( [ $contact_1->unblessed, $contact_2->unblessed ] );
174
171
    # Re-fetch vendor
175
    # Re-fetch vendor
172
    $vendor = Koha::Acquisition::Booksellers->find( $vendor->id );
176
    $vendor = Koha::Acquisition::Booksellers->find( $vendor->id );
173
    my $contacts = $vendor->contacts;
177
    my $contacts = $vendor->contacts;
Lines 257-259 subtest 'issues' => sub { Link Here
257
261
258
    $schema->storage->txn_rollback();
262
    $schema->storage->txn_rollback();
259
};
263
};
260
- 
264
265
subtest 'contracts' => sub {
266
267
    plan tests => 2;
268
269
    $schema->storage->txn_begin();
270
271
    my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } );
272
273
    is( scalar( @{ $vendor->contracts } ), 0, 'Vendor has no contracts' );
274
275
    AddContract(
276
        {
277
            booksellerid => $vendor->id,
278
            contractname => 'Test contract',
279
        }
280
    );
281
282
    $vendor = $vendor->get_from_storage;
283
    my $contracts = $vendor->contracts;
284
    is( scalar( @{$contracts} ), 1, '1 contract stored' );
285
286
    $schema->storage->txn_rollback();
287
};
288
289
subtest 'invoices' => sub {
290
291
    plan tests => 3;
292
293
    $schema->storage->txn_begin();
294
295
    my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } );
296
297
    is( $vendor->invoices->count, 0, 'Vendor has no invoices' );
298
299
    Koha::Acquisition::Invoice->new(
300
        {
301
            booksellerid  => $vendor->id,
302
            invoicenumber => 'INV12345'
303
        }
304
    )->store;
305
306
    $vendor = $vendor->get_from_storage;
307
    my $invoices = $vendor->invoices;
308
    is( $invoices->count, 1,                             '1 invoice stored' );
309
    is( ref($invoices),   'Koha::Acquisition::Invoices', 'Type is correct' );
310
311
    $schema->storage->txn_rollback();
312
};
313
314
subtest 'to_api() tests' => sub {
315
316
    plan tests => 4;
317
318
    $schema->storage->txn_begin;
319
320
    my $vendor = $builder->build_object( { class => 'Koha::Acquisition::Booksellers' } );
321
322
    is( $vendor->interfaces->count, 0, 'Vendor has no interfaces' );
323
324
    $vendor->interfaces(
325
        [ { name => 'first interface' }, { name => 'second interface', login => 'one_login', password => 'Test1234' } ]
326
    );
327
328
    my $interfaces = $vendor->to_api->{interfaces};
329
    is( scalar(@$interfaces),          2,          'Vendor has two interfaces' );
330
    is( @{$interfaces}[0]->{password}, undef,      'No password set for the interface' );
331
    is( @{$interfaces}[1]->{password}, 'Test1234', 'password is unhashed' );
332
333
    $schema->storage->txn_rollback;
334
};

Return to bug 38010