403Webshell
Server IP : 104.21.21.239  /  Your IP : 216.73.216.55
Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.7
System : Linux ip-172-31-69-123.ec2.internal 6.1.177-224.371.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 27 20:28:29 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/tgnewdev/admin/vendor/braintree_php/tests/integration/Error/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tgnewdev/admin/vendor/braintree_php/tests/integration/Error/ValidationErrorCollectionTest.php
<?php
namespace Test\Integration\Error;

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

use Test\Setup;
use Braintree;

class ValidationErrorCollectionTest extends Setup
{
    public function mapValidationErrorsToCodes($validationErrors)
    {
        $codes = array_map(create_function('$validationError', 'return $validationError->code;'), $validationErrors);
        sort($codes);
        return $codes;
    }

    public function test_shallowAll_givesAllErrorsShallowly()
    {
        $result = Braintree\Customer::create([
            'email' => 'invalid',
            'creditCard' => [
                'number' => '1234123412341234',
                'expirationDate' => 'invalid',
                'billingAddress' => [
                    'countryName' => 'invalid'
                ]
            ]
        ]);

        $this->assertEquals([], $result->errors->shallowAll());

        $expectedCustomerErrors = [Braintree\Error\Codes::CUSTOMER_EMAIL_IS_INVALID];
        $actualCustomerErrors = $result->errors->forKey('customer')->shallowAll();
        $this->assertEquals($expectedCustomerErrors, self::mapValidationErrorsToCodes($actualCustomerErrors));

        $expectedCreditCardErrors = [
            Braintree\Error\Codes::CREDIT_CARD_EXPIRATION_DATE_IS_INVALID,
            Braintree\Error\Codes::CREDIT_CARD_NUMBER_IS_INVALID,
        ];
        $actualCreditCardErrors = $result->errors->forKey('customer')->forKey('creditCard')->shallowAll();
        $this->assertEquals($expectedCreditCardErrors, self::mapValidationErrorsToCodes($actualCreditCardErrors));
    }

    public function test_deepAll_givesAllErrorsDeeply()
    {
        $result = Braintree\Customer::create([
            'email' => 'invalid',
            'creditCard' => [
                'number' => '1234123412341234',
                'expirationDate' => 'invalid',
                'billingAddress' => [
                    'countryName' => 'invalid'
                ]
            ]
        ]);

        $expectedErrors = [
            Braintree\Error\Codes::CUSTOMER_EMAIL_IS_INVALID,
            Braintree\Error\Codes::CREDIT_CARD_EXPIRATION_DATE_IS_INVALID,
            Braintree\Error\Codes::CREDIT_CARD_NUMBER_IS_INVALID,
            Braintree\Error\Codes::ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED,
        ];
        $actualErrors = $result->errors->deepAll();
        $this->assertEquals($expectedErrors, self::mapValidationErrorsToCodes($actualErrors));

        $expectedErrors = [
            Braintree\Error\Codes::CREDIT_CARD_EXPIRATION_DATE_IS_INVALID,
            Braintree\Error\Codes::CREDIT_CARD_NUMBER_IS_INVALID,
            Braintree\Error\Codes::ADDRESS_COUNTRY_NAME_IS_NOT_ACCEPTED,
        ];
        $actualErrors = $result->errors->forKey('customer')->forKey('creditCard')->deepAll();
        $this->assertEquals($expectedErrors, self::mapValidationErrorsToCodes($actualErrors));
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit