Permalink
Browse files

add travis config and cilex GuzzleServiceProvider test

  • Loading branch information...
1 parent b6c5b7f commit 6d2c9dfddf89a41e43673fefbcc77b63c53ce51f @gimler committed Jun 26, 2012
Showing with 83 additions and 0 deletions.
  1. +10 −0 .travis.yml
  2. +46 −0 tests/Cilex/Tests/Provider/GuzzleServiceProviderTest.php
  3. +27 −0 tests/bootstrap.php
View
@@ -0,0 +1,10 @@
+language: php
+
+php:
+ - 5.3.3
+ - 5.3
+ - 5.4
+
+before_script:
+ - curl -s http://getcomposer.org/installer | php
+ - COMPOSER_ROOT_VERSION=dev-master php composer.phar --dev install
@@ -0,0 +1,46 @@
+<?php
+/**
+ * This file is part of the Cilex framework.
+ *
+ * (c) Mike van Riel <mike.vanriel@naenius.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ *
+ * @author Ben Selby <benmatselby@gmail.com>
+ */
+
+namespace Cilex\Tests\Provider;
+
+use Cilex\Application;
+use Cilex\Provider\GuzzleServiceProvider;
+
+/**
+ * Test file for GuzzleProvider
+ *
+ * @author Gordon Franke <info@nevalon.de>
+ */
+class GuzzleServiceProviderTest extends \PHPUnit_Framework_TestCase
+{
+ /**
+ * Test that an exception is thrown if the config is not present
+ *
+ * @return void
+ */
+ public function testRegisterWillThrowExceptionIfConfigIsNotThere()
+ {
+ $this->setExpectedException(
+ 'InvalidArgumentException',
+ 'Identifier "guzzle.configs" is not defined.'
+ );
+
+ $app = new Application('Test');
+
+ $app->register(
+ new GuzzleServiceProvider(),
+ array()
+ );
+
+ $config = $app['guzzle'];
+ }
+}
View
@@ -0,0 +1,27 @@
+<?php
+
+error_reporting(E_ALL | E_STRICT);
+
+// Ensure that composer has installed all dependencies
+if (!file_exists(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'composer.lock')) {
+ die("Dependencies must be installed using composer:\n\ncomposer.phar install\n\n"
+ . "See https://github.com/composer/composer/blob/master/README.md for help with installing composer\n");
+}
+
+require_once 'PHPUnit/TextUI/TestRunner.php';
+
+// Include the composer autoloader
+$loader = require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
+
+// Register services with the GuzzleTestCase
+Guzzle\Tests\GuzzleTestCase::setMockBasePath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'pazure/guzzle-azure' . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'mock');
+
+Guzzle\Tests\GuzzleTestCase::setServiceBuilder(Guzzle\Service\Builder\ServiceBuilder::factory(array(
+ 'azure' => array(
+ 'class' => 'Guzzle\Azure\AzureClient',
+ 'params' => array(
+ 'subscription_id' => '123abc',
+ 'key_path' => 'path-to-key.pem'
+ )
+ )
+)));

0 comments on commit 6d2c9df

Please sign in to comment.