/**
  * Fetches a single order by its unique Id.
  *
  * @param  int $id
  * @return \IocExample\Model\Order
  */
 public function getById($id)
 {
     $customer = new \IocExample\Model\Customer();
     $customer->setName("Chris Weldon");
     $customer->setEmail("*****@*****.**");
     $order = new \IocExample\Model\Order();
     $order->setId($id);
     $order->setCustomer($customer);
     return $order;
 }
    public function testRepositoryReturnsOrderAndPassesToNotifier()
    {
        $customerToReturn = new \IocExample\Model\Customer();
        $customerToReturn->setName('Test Customer');
        $customerToReturn->setEmail('*****@*****.**');
        $orderToReturn = new \IocExample\Model\Order();
        $orderToReturn->setId(1);
        $orderToReturn->setCustomer($customerToReturn);

        $this->_repositoryMock->expects($this->once())
                              ->method('getById')
                              ->with($orderToReturn->getId())
                              ->will($this->returnValue($orderToReturn));

        $this->_notifierMock->expects($this->once())
                            ->method('notifyCustomerOfDelivery')
                            ->with($customerToReturn, $orderToReturn);

        $this->_controller->deliverOrder(1);
        $this->verifyMockObjects();
    }