Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

upgrade composer #1

Merged
merged 2 commits into from

1 participant

@mikey179
Owner

No description provided.

@mikey179 mikey179 merged commit 05337e2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 9, 2012
  1. @mikey179
Commits on Apr 21, 2012
  1. @mikey179

    upgrade composer

    mikey179 authored
This page is out of date. Refresh to see the latest.
View
4 .travis.yml
@@ -2,10 +2,10 @@ language: php
php:
- 5.3
+ - 5.4
before_script:
- wget -nc http://getcomposer.org/composer.phar
- - php composer.phar update
- - php vendor/bin/bootstrap
+ - php composer.phar install --dev
script: phpunit
View
4 LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2007-2010, stubbles Development Team
+Copyright (c) 2007-2012, stubbles Development Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -11,7 +11,7 @@ met:
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Stubbles nor the names of its
- contributors may be used to endorse or promote products derived
+ contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
View
5 composer.json
@@ -3,10 +3,11 @@
"type": "library",
"homepage": "http://stubbles.net/",
"version": "2.0.0",
- "license": "BSD",
+ "license": "BSD-3",
+ "description": "Base classes for Stubbles based web applications.",
"require": {
"php": ">=5.3.0",
- "stubbles/core": "2.0.*",
+ "stubbles/core": "dev-master",
"stubbles/input": "dev-master"
},
"autoload": {
View
15 composer.lock
@@ -1,23 +1,22 @@
{
- "hash": "bfc6160f8d2e2d584f29eb34094bc948",
+ "hash": "91538a7406697ad6dc93c97d50450559",
"packages": [
{
- "package": "mikey179/vfsStream",
- "version": "1.0.0-beta2"
- },
- {
"package": "stubbles/core",
- "version": "2.0.0-beta7"
+ "version": "dev-master",
+ "source-reference": "c62c079f64efabe61471375e16c195d08153b72b"
},
{
"package": "stubbles/input",
"version": "dev-master",
- "source-reference": "3746bcea20d0d0ddc3985bea55d75bb7e52992ab"
+ "source-reference": "53766e69c7b1d8d3cc870d50b667df7cb5d559c7"
},
{
"package": "stubbles/scripts",
- "version": "1.0.0-beta7"
+ "version": "dev-master",
+ "source-reference": "432da2be37a0e71e929a98a14b4b0926be578898"
}
],
+ "packages-dev": null,
"aliases": []
}
View
2  nbproject/project.properties
@@ -6,7 +6,7 @@ ignore.path=\
include.path=\
${php.global.include.path}
php.version=PHP_53
-phpunit.bootstrap=vendor/.composer/autoload.php
+phpunit.bootstrap=vendor/autoload.php
phpunit.bootstrap.create.tests=false
phpunit.configuration=phpunit.xml.dist
phpunit.run.test.files=false
View
2  phpunit.xml.dist
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
- bootstrap="vendor/.composer/autoload.php"
+ bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
View
35 src/main/php/net/stubbles/webapp/UriConfigurator.php
@@ -28,25 +28,31 @@ class UriConfigurator extends BaseObject
*
* @type array
*/
- private $preInterceptors = array();
+ private $preInterceptors = array();
/**
* list of processor names with their uri condition
*
* @type array
*/
- private $processors = array();
+ private $processors = array();
/**
* list of post interceptors with their uri condition
*
* @type array
*/
- private $postInterceptors = array();
+ private $postInterceptors = array();
/**
* list of rest uri conditions and handlers
*
* @type array
*/
- private $resourceHandler = array();
+ private $resourceHandler = array();
+ /**
+ * list of allowed mime types for given uri condition
+ *
+ * @type array
+ */
+ private $resourceMimeTypes = array();
/**
* constructor
@@ -151,19 +157,21 @@ public function provideXml()
* adds resource handler for given uri condition
*
* @api
- * @param string $handlerClass rest handler class to add for this uri pattern
- * @param string $uriCondition uri pattern under which handler should be executed
+ * @param string $handlerClass rest handler class to add for this uri pattern
+ * @param string $uriCondition uri pattern under which handler should be executed
+ * @param string[] $allowedMimeTypes list of allowed mime types, if not set all configured are allowed
* @return UriConfigurator
* @throws IllegalArgumentException
*/
- public function addResourceHandler($handlerClass, $uriCondition)
+ public function addResourceHandler($handlerClass, $uriCondition, array $allowedMimeTypes = array())
{
if (empty($uriCondition)) {
throw new IllegalArgumentException('$uriCondition can not be empty.');
}
$this->process('net\\stubbles\\webapp\\rest\\RestProcessor', $uriCondition);
- $this->resourceHandler[$uriCondition] = $handlerClass;
+ $this->resourceHandler[$uriCondition] = $handlerClass;
+ $this->resourceMimeTypes[$uriCondition] = $allowedMimeTypes;
return $this;
}
@@ -178,6 +186,17 @@ public function getResourceHandler()
}
/**
+ * returns list of rest uri conditions and handlers
+ *
+ * @return array
+ * @since 2.0.0
+ */
+ public function getResourceMimeTypes()
+ {
+ return $this->resourceMimeTypes;
+ }
+
+ /**
* post intercept request with given post interceptor
*
* Adding the same post interceptor class twice will overwrite the uri
View
2  src/main/php/net/stubbles/webapp/ioc/WebAppBindingModule.php
@@ -81,6 +81,8 @@ public function configure(Binder $binder)
->toInstance($this->uriConfigurator->getConfig());
$binder->bindConstant('net.stubbles.webapp.resource.handler')
->to($this->uriConfigurator->getResourceHandler());
+ $binder->bindConstant('net.stubbles.webapp.resource.mime.types')
+ ->to($this->uriConfigurator->getResourceMimeTypes());
}
}
?>
View
16 src/test/php/net/stubbles/webapp/UriConfiguratorTestCase.php
@@ -183,10 +183,24 @@ public function returnsAddedResourceHandlers()
'^/users' => 'example\\UserResourceHandler'
),
$this->uriConfigurator->addResourceHandler('example\\ExampleResourceHandler', '^/examples')
- ->addResourceHandler('example\\UserResourceHandler', '^/users')
+ ->addResourceHandler('example\\UserResourceHandler', '^/users', array('text/plain', 'application/xml'))
->getResourceHandler()
);
}
+ /**
+ * @since 2.0.0
+ * @test
+ */
+ public function returnsAddedMimeTypes()
+ {
+ $this->assertEquals(array('^/examples' => array(),
+ '^/users' => array('text/plain', 'application/xml')
+ ),
+ $this->uriConfigurator->addResourceHandler('example\\ExampleResourceHandler', '^/examples')
+ ->addResourceHandler('example\\UserResourceHandler', '^/users', array('text/plain', 'application/xml'))
+ ->getResourceMimeTypes()
+ );
+ }
}
?>
View
22 src/test/php/net/stubbles/webapp/ioc/WebAppBindingModuleTestCase.php
@@ -71,6 +71,16 @@ public function bindsResourceHandlers()
}
/**
+ * @since 2.0.0
+ * @test
+ */
+ public function bindsResourceMimeTypes()
+ {
+ $this->uriConfigurator->addResourceHandler('example\\ExampleResourceHandler', '^/examples', array('text/plain'));
+ $this->assertTrue($this->createInjector()->hasConstant('net.stubbles.webapp.resource.mime.types'));
+ }
+
+ /**
* @test
*/
public function bindsConfiguredResourceHandlers()
@@ -82,6 +92,18 @@ public function bindsConfiguredResourceHandlers()
}
/**
+ * @since 2.0.0
+ * @test
+ */
+ public function bindsConfiguredResourceMimeTypes()
+ {
+ $this->uriConfigurator->addResourceHandler('example\\ExampleResourceHandler', '^/examples', array('text/plain'));
+ $this->assertEquals(array('^/examples' => array('text/plain')),
+ $this->createInjector()->getConstant('net.stubbles.webapp.resource.mime.types')
+ );
+ }
+
+ /**
* @test
*/
public function doesNotBindAuthConfigIfNotEnabled()
Something went wrong with that request. Please try again.