PHP 7.4.33
Preview: TextNodeTest.php Size: 5.40 KB
/home/godevadmin/www/admin/braintree/final/braintree/tests/integration/TextNodeTest.php

<?php
namespace Test\Integration;

require_once dirname(__DIR__) . '/Setup.php';

use Test;
use Test\Setup;
use Braintree;

class TextNodeTest extends Setup
{
    public function testIs()
    {
        $creditCard = SubscriptionHelper::createCreditCard();
        $triallessPlan = SubscriptionHelper::triallessPlan();
        $trialPlan = SubscriptionHelper::trialPlan();

        $trialSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $trialPlan['id'],
            'price' => '5',
        ])->subscription;

        $triallessSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $triallessPlan['id'],
            'price' => '5',
        ])->subscription;

        $collection = Braintree\Subscription::search([
            Braintree\SubscriptionSearch::planId()->is("integration_trial_plan"),
            Braintree\SubscriptionSearch::price()->is('5')
        ]);

        $this->assertTrue(Test\Helper::includes($collection, $trialSubscription));
        $this->assertFalse(Test\Helper::includes($collection, $triallessSubscription));
    }

    public function testIsNot()
    {
        $creditCard = SubscriptionHelper::createCreditCard();
        $triallessPlan = SubscriptionHelper::triallessPlan();
        $trialPlan = SubscriptionHelper::trialPlan();

        $trialSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $trialPlan['id'],
            'price' => '6',
        ])->subscription;

        $triallessSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $triallessPlan['id'],
            'price' => '6'
        ])->subscription;

        $collection = Braintree\Subscription::search([
            Braintree\SubscriptionSearch::planId()->isNot("integration_trialless_plan"),
            Braintree\SubscriptionSearch::price()->is("6")
        ]);

        $this->assertTrue(Test\Helper::includes($collection, $trialSubscription));
        $this->assertFalse(Test\Helper::includes($collection, $triallessSubscription));
    }

    public function testStartsWith()
    {
        $creditCard = SubscriptionHelper::createCreditCard();
        $triallessPlan = SubscriptionHelper::triallessPlan();
        $trialPlan = SubscriptionHelper::trialPlan();

        $trialSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $trialPlan['id'],
            'price' => '7',
        ])->subscription;

        $triallessSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $triallessPlan['id'],
            'price' => '7',
        ])->subscription;

        $collection = Braintree\Subscription::search([
            Braintree\SubscriptionSearch::planId()->startsWith("integration_trial_pl"),
            Braintree\SubscriptionSearch::price()->is('7')
        ]);

        $this->assertTrue(Test\Helper::includes($collection, $trialSubscription));
        $this->assertFalse(Test\Helper::includes($collection, $triallessSubscription));
    }

    public function testEndsWith()
    {
        $creditCard = SubscriptionHelper::createCreditCard();
        $triallessPlan = SubscriptionHelper::triallessPlan();
        $trialPlan = SubscriptionHelper::trialPlan();

        $trialSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $trialPlan['id'],
            'price' => '8'
        ])->subscription;

        $triallessSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $triallessPlan['id'],
            'price' => '8'
        ])->subscription;

        $collection = Braintree\Subscription::search([
            Braintree\SubscriptionSearch::planId()->endsWith("rial_plan"),
            Braintree\SubscriptionSearch::price()->is("8")
        ]);

        $this->assertTrue(Test\Helper::includes($collection, $trialSubscription));
        $this->assertFalse(Test\Helper::includes($collection, $triallessSubscription));
    }


    public function testContains()
    {
        $creditCard = SubscriptionHelper::createCreditCard();
        $triallessPlan = SubscriptionHelper::triallessPlan();
        $trialPlan = SubscriptionHelper::trialPlan();

        $trialSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $trialPlan['id'],
            'price' => '9'
        ])->subscription;

        $triallessSubscription = Braintree\Subscription::create([
            'paymentMethodToken' => $creditCard->token,
            'planId' => $triallessPlan['id'],
            'price' => '9'
        ])->subscription;

        $collection = Braintree\Subscription::search([
            Braintree\SubscriptionSearch::planId()->contains("ration_trial_pl"),
            Braintree\SubscriptionSearch::price()->is("9")
        ]);

        $this->assertTrue(Test\Helper::includes($collection, $trialSubscription));
        $this->assertFalse(Test\Helper::includes($collection, $triallessSubscription));
    }
}

Directory Contents

Dirs: 2 × Files: 34

Name Size Perms Modified Actions
Error DIR
- drwxrwxr-x 2023-11-07 19:59:44
Edit Download
Result DIR
- drwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.97 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
12.84 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
7.04 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
56.07 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
11.20 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
1.84 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
7.68 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
62.86 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
1.22 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
3.09 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
1.93 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
5.09 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
5.63 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
4.13 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
6.01 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
29.95 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
10.17 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
3.35 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
13.75 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.60 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
67.92 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
11.34 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
4.77 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
3.51 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.49 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
17.89 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
50.99 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
2.92 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
5.40 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
65.59 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
173.21 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
12.51 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
4.28 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download
7.06 KB lrwxrwxr-x 2023-11-07 19:59:44
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).