HEX
Server: nginx/1.27.1
System: Linux in-4 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
User: ilikadirect (1186)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source
Upload Files
File: /storage/v6964/avoxlive/public_html/application/libraries/stripe-php/tests/InvoiceTest.php
<?php

namespace Stripe;

class InvoiceTest extends TestCase
{
    public function testUpcoming()
    {
        self::authorizeFromEnv();
        $customer = self::createTestCustomer();

        InvoiceItem::create(array(
            'customer'  => $customer->id,
            'amount'    => 0,
            'currency'  => 'usd',
        ));

        $invoice = Invoice::upcoming(array(
            'customer' => $customer->id,
        ));
        $this->assertSame($invoice->customer, $customer->id);
        $this->assertSame($invoice->attempted, false);
    }

    public function testItemsAccessWithParameter()
    {
        self::authorizeFromEnv();
        $customer = self::createTestCustomer();

        InvoiceItem::create(array(
            'customer'  => $customer->id,
            'amount'    => 100,
            'currency'  => 'usd',
        ));

        $invoice = Invoice::upcoming(
            array(
            'customer' => $customer->id,
            )
        );

        $lines = $invoice->lines->all(array('limit' => 10));

        $this->assertSame(count($lines->data), 1);
        $this->assertSame($lines->data[0]->amount, 100);
    }

    // This is really just making sure that this operation does not trigger any
    // warnings, as it's highly nested.
    public function testAll()
    {
        self::authorizeFromEnv();
        $invoices = Invoice::all();
        $this->assertTrue(count($invoices) > 0);
    }
}