social_auth_vipps-8.x-2.1/tests/src/Unit/ResourceOwnerTest.php

tests/src/Unit/ResourceOwnerTest.php
<?php

namespace Drupal\Tests\social_auth_vipps\Unit;

use Drupal\social_auth_vipps\Provider\VippsResourceOwner;
use Drupal\Tests\UnitTestCase;

/**
 * Test methods of the resource owner.
 *
 * @group social_auth_vipps
 */
class ResourceOwnerTest extends UnitTestCase {

  /**
   * Test variations of response data.
   *
   * @dataProvider getResourceOwnerVariations
   */
  public function testResourceOwner($response) {
    $owner = new VippsResourceOwner($response);
    $address = $owner->getAddress();
    self::assertEquals('Testveien 1', $address->getStreetAddress());
  }

  /**
   * Dataprovider for the testResourceOwner test.
   */
  public function getResourceOwnerVariations() {
    return [
      [
        'response' => [
          'address' => [
            [
              'address_type' => 'home',
              'country' => 'NO',
              'formatted' => 'Testveien 1',
              'postal_code' => '1234',
              'region' => 'Oslo',
              'street_address' => 'Testveien 1',
            ],
          ],
        ],
      ],
      [
        'response' => [
          'address' => [
            'address_type' => 'home',
            'country' => 'NO',
            'formatted' => 'Testveien 1',
            'postal_code' => '1234',
            'region' => 'Oslo',
            'street_address' => 'Testveien 1',
          ],
        ],
      ],
    ];
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc