GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#25)
by Scott van
31:46 queued 19:22
created

ObserverTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 47
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testHandleSalesOrderBeforeSave() 0 12 1
A testHandleSalesConvertQuoteToOrder() 0 23 1
1
<?php
2
/**
3
 * Copyright (c) 2013-2014 eBay Enterprise, Inc.
4
 *
5
 * NOTICE OF LICENSE
6
 *
7
 * This source file is subject to the Open Software License (OSL 3.0)
8
 * that is bundled with this package in the file LICENSE.md.
9
 * It is also available through the world-wide-web at this URL:
10
 * http://opensource.org/licenses/osl-3.0.php
11
 *
12
 * @copyright   Copyright (c) 2013-2014 eBay Enterprise, Inc. (http://www.ebayenterprise.com/)
13
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
14
 */
15
16
class EbayEnterprise_Multishipping_Test_Model_ObserverTest extends EcomDev_PHPUnit_Test_Case
17
{
18
    /**
19
     * When handling a sales order before save event, ensure that any shipment
20
     * amounts for that order have been collected before the order is saved.
21
     */
22
    public function testHandleSalesOrderBeforeSave()
23
    {
24
        $order = $this->getModelMock('sales/order', ['collectShipmentAmounts']);
25
        $order->expects($this->once())
26
            ->method('collectShipmentAmounts')
27
            ->will($this->returnSelf());
28
        $event = new Varien_Event(['order' => $order]);
29
        $eventObserver = new Varien_Event_Observer(['event' => $event]);
30
31
        $observer = Mage::getModel('ebayenterprise_multishipping/observer');
32
        $observer->handleSalesOrderSaveBefore($eventObserver);
33
    }
34
35
    /**
36
     * When converting a quote to an order, discount data from quote addresses
37
     * needs to bubble up to the order.
38
     */
39
    public function testHandleSalesConvertQuoteToOrder()
40
    {
41
        $shipAddressDiscountAmt = 5.00;
42
        $shipAddressBaseDiscountAmt = 7.00;
43
        $discountDescription = 'Discount Description';
44
45
        $order = Mage::getModel('sales/order');
46
        $quote = $this->getModelMock('sales/quote', ['getAllAddresses']);
47
        $shippingAddress = Mage::getModel('sales/quote_address', ['discount_amount' => $shipAddressDiscountAmt, 'base_discount_amount' => $shipAddressBaseDiscountAmt, 'discount_description' => $discountDescription]);
48
        $billingAddress = Mage::getModel('sales/quote_address', []);
49
50
        $quote->method('getAllAddresses')->willReturn([$shippingAddress, $billingAddress]);
51
52
        $event = new Varien_Event(['order' => $order, 'quote' => $quote]);
53
        $eventObserver = new Varien_Event_Observer(['event' => $event]);
54
55
        $observer = Mage::getModel('ebayenterprise_multishipping/observer');
56
        $observer->handleSalesConvertQuoteToOrder($eventObserver);
57
58
        $this->assertSame($shipAddressDiscountAmt, $order->getDiscountAmount());
59
        $this->assertSame($shipAddressBaseDiscountAmt, $order->getBaseDiscountAmount());
60
        $this->assertSame($discountDescription, $order->getDiscountDescription());
61
    }
62
}
63