/**
  * @covers \Drupal\amazons3\S3Client::validateBucketExists
  */
 public function testValidateBucketExists()
 {
     // Instantiate the AWS service builder.
     $config = array('includes' => array(0 => '_aws'), 'services' => array('default_settings' => array('params' => array('region' => 'us-east-1')), 'cloudfront' => array('extends' => 'cloudfront', 'params' => array('private_key' => 'change_me', 'key_pair_id' => 'change_me'))), 'credentials' => array('key' => 'placeholder', 'secret' => 'placeholder'));
     $aws = \Aws\Common\Aws::factory($config);
     // Configure the tests to use the instantiated AWS service builder
     \Guzzle\Tests\GuzzleTestCase::setServiceBuilder($aws);
     $client = $this->getServiceBuilder()->get('s3', true);
     $this->setMockResponse($client, array(new Response(200)));
     $exception = NULL;
     try {
         DrupalS3Client::validateBucketExists('bucket', $client);
     } catch (\Exception $exception) {
     }
     $this->assertNull($exception, 'The bucket was validated to exist.');
 }
Beispiel #2
0
<?php

use Guzzle\Tests\GuzzleTestCase;
use Guzzle\Service\Builder\ServiceBuilder;
error_reporting(E_ALL | E_STRICT);
define('APPLICATION_ENV', 'testing');
// pull in composer autloader
require_once __DIR__ . '/../../vendor/autoload.php';
// pull in our test client to interact with the service
require_once __DIR__ . '/TestClient.php';
// private key for testing
$GLOBALS['key'] = 'fbdce19f94b158e72ae6020cc5126642a9d42d086419c015ad2b6dd429312410';
GuzzleTestCase::setServiceBuilder(ServiceBuilder::factory(array('test.api' => array('class' => 'TestClient', 'params' => array('base_url' => 'http://127.0.0.1/', 'api_id' => 1)))));
<?php

use Guzzle\Tests\GuzzleTestCase;
use Guzzle\Service\Builder\ServiceBuilder;
if (!file_exists(dirname(__DIR__) . '/composer.lock')) {
    die("Dependencies must be installed using composer:\n\nphp composer.phar install\n\n" . "See http://getcomposer.org for help with installing composer\n");
}
require dirname(__DIR__) . '/vendor/autoload.php';
GuzzleTestCase::setMockBasePath(__DIR__ . '/mock');
GuzzleTestCase::setServiceBuilder(ServiceBuilder::factory(array('ga_measurement_protocol' => array('class' => 'Krizon\\Google\\Analytics\\MeasurementProtocol\\MeasurementProtocolClient', 'params' => array()))));
Beispiel #4
0
 public function setup()
 {
     GuzzleTestCase::setServiceBuilder(\Guzzle\Service\Builder\ServiceBuilder::factory(array('test.twitter' => array('class' => "\\Parkji\\Twuzzle\\OAuth\\Client", 'params' => array('consumerKey' => 'foo', 'consumerSecret' => 'bar')))));
     $this->client = $this->getServiceBuilder()->get('test.twitter');
     $this->setMockResponse($this->client, 'tokenTest');
 }
Beispiel #5
0
<?php

include __DIR__ . '/../vendor/autoload.php';
use Guzzle\Service\Builder\ServiceBuilder;
use Guzzle\Tests\GuzzleTestCase;
$builder = ServiceBuilder::factory(array('test.campbx' => array('class' => '\\Matmar10\\CampBX\\CampBXClient', 'params' => array()), 'test.campbx_auth' => array('class' => '\\Matmar10\\CampBX\\CampBXAuthClient', 'params' => array('username' => 'testuser', 'password' => 'testpassword'))));
Guzzle\Tests\GuzzleTestCase::setServiceBuilder($builder);
<?php

use Guzzle\Tests\GuzzleTestCase;
use Guzzle\Service\Builder\ServiceBuilder;
error_reporting(E_ALL | E_STRICT);
// Ensure that composer has installed all dependencies
if (!file_exists(dirname(__DIR__) . '/composer.lock')) {
    die("Dependencies must be installed using composer:\n\nphp composer.phar install --dev\n\n" . "See http://getcomposer.org for help with installing composer\n");
}
// Include the composer autoloader
$autoloader = (require dirname(__DIR__) . '/vendor/autoload.php');
// Set mock directory for Tika command responses.
GuzzleTestCase::setMockBasePath(__DIR__ . DIRECTORY_SEPARATOR . 'mock');
// Add the services file to the default service builder
GuzzleTestCase::setServiceBuilder(ServiceBuilder::factory(array('base' => array('class' => 'Bangpound\\Tika\\Client'), 'test.tika' => array('extends' => 'base', 'params' => array('base_url' => $_SERVER['TIKA_URL'])), 'test.mock' => array('extends' => 'base', 'params' => array()))));
Beispiel #7
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
\Guzzle\Tests\GuzzleTestCase::setServiceBuilder(\Guzzle\Service\Builder\ServiceBuilder::factory(array('test.localbtc.auth' => array('class' => '\\LocalBtc\\Authenticator', 'params' => array('debug' => true)))));
Beispiel #8
0
<?php

/**
 * This file is part of the ImboClient package
 *
 * (c) Christer Edvartsen <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE file that was
 * distributed with this source code.
 */
namespace ImboClientTest;

use Guzzle\Tests\GuzzleTestCase, Guzzle\Service\Builder\ServiceBuilder;
require __DIR__ . '/../vendor/autoload.php';
// Set a default service builder for the tests
$serviceDescription = (require __DIR__ . '/../src/ImboClient/service.php');
GuzzleTestCase::setServiceBuilder(ServiceBuilder::factory($serviceDescription['operations']));
// Set the base path for respones mocks
GuzzleTestCase::setMockBasePath(__DIR__ . '/response_mocks');
Beispiel #9
0
<?php

use Guzzle\Tests\GuzzleTestCase;
include __DIR__ . '/../vendor/autoload.php';
// Mocks path
$mock_basepath = __DIR__ . '/Mock/';
GuzzleTestCase::setMockBasePath($mock_basepath);
// Service Builder for tests
Guzzle\Tests\GuzzleTestCase::setServiceBuilder(Guzzle\Service\Builder\ServiceBuilder::factory(['semantria.auth' => ['class' => 'Semantria.SemantriaAuthClient', 'params' => ['consumer_key' => 'foo', 'consumer_secret' => 'bar']]]));
 /**
  * @covers \Drupal\amazons3\StreamWrapper::stream_open
  * @covers \Drupal\amazons3\StreamWrapper::mkdir
  * @covers \Drupal\amazons3\StreamWrapper::url_stat
  */
 public function testAutomaticUri()
 {
     $wrapper = new StreamWrapper();
     $path = NULL;
     $uri = 's3://bucket.example.com/image.jpg';
     $wrapper->stream_open($uri, 'r', 0, $path);
     $this->assertEquals($uri, $wrapper->getUri());
     // Instantiate the AWS service builder.
     $config = array('includes' => array(0 => '_aws'), 'services' => array('default_settings' => array('params' => array('region' => 'us-east-1')), 'cloudfront' => array('extends' => 'cloudfront', 'params' => array('private_key' => 'change_me', 'key_pair_id' => 'change_me'))), 'credentials' => array('key' => 'placeholder', 'secret' => 'placeholder'));
     $aws = \Aws\Common\Aws::factory($config);
     // Configure the tests to use the instantiated AWS service builder
     \Guzzle\Tests\GuzzleTestCase::setServiceBuilder($aws);
     $client = $this->getServiceBuilder()->get('s3', true);
     // The 404 is for the first check to mkdir() that checks to see if a
     // directory exists.
     $this->setMockResponse($client, array(new Response(200), new Response(404), new Response(200)));
     $wrapper = new StreamWrapper();
     $wrapper->setClient($client);
     $wrapper->url_stat($uri, 0);
     $this->assertEquals($uri, $wrapper->getUri());
     $wrapper->mkdir('s3://bucket.example.com/directory', 0, 0);
     $this->assertEquals('s3://bucket.example.com/directory', $wrapper->getUri());
 }
Beispiel #11
0
<?php

use Guzzle\Tests\GuzzleTestCase;
include __DIR__ . '/../vendor/autoload.php';
Guzzle\Tests\GuzzleTestCase::setServiceBuilder(Guzzle\Service\Builder\ServiceBuilder::factory(array('test.meetup.key' => array('class' => 'DMS.Service.Meetup.MeetupKeyAuthClient', 'params' => array('key' => 'mykey')), 'test.meetup.oauth' => array('class' => 'DMS.Service.Meetup.MeetupOauthAuthClient', 'params' => array('consumer_key' => 'key', 'consumer_secret' => 'secret', 'token' => 'token', 'token_secret' => 'token_secret')))));
$basePath = __DIR__ . '/mock/';
GuzzleTestCase::setMockBasePath($basePath);
Beispiel #12
0
<?php

/**
 * User: Joe Linn
 * Date: 7/9/13
 * Time: 11:25 AM
 */
error_reporting(E_ALL | E_STRICT);
require_once 'PHPUnit/TextUI/TestRunner.php';
//composer autoloader
$autoloader = (require dirname(__DIR__) . '/vendor/autoload.php');
$config = json_decode(file_get_contents($_SERVER['CONFIG']), true);
\Guzzle\Tests\GuzzleTestCase::setServiceBuilder(Guzzle\Service\Builder\ServiceBuilder::factory(array('test.mixpanel' => array('class' => 'MixGuzzle\\MixGuzzleClient', 'params' => $config))));
Beispiel #13
0
<?php

use Guzzle\Tests\GuzzleTestCase;
include __DIR__ . '/../vendor/autoload.php';
// Mocks path
$mock_basepath = __DIR__ . '/Mock/';
GuzzleTestCase::setMockBasePath($mock_basepath);
// Service Builder for tests
Guzzle\Tests\GuzzleTestCase::setServiceBuilder(Guzzle\Service\Builder\ServiceBuilder::factory(['intercom.basicauth' => ['class' => 'Intercom.IntercomBasicAuthClient', 'params' => ['api_key' => $_SERVER['INTERCOM_API_KEY'], 'app_id' => $_SERVER['INTERCOM_APP_ID']]]]));