Browse files

Added the readme and the testsuite setup

  • Loading branch information...
0 parents commit 0b7d69a98c031ac55818431fa56c23286d311540 @stof committed Jul 13, 2012
Showing with 139 additions and 0 deletions.
  1. +5 −0 .gitignore
  2. +11 −0 .travis.yml
  3. +19 −0 LICENSE
  4. +50 −0 README.md
  5. +23 −0 composer.json
  6. +17 −0 phpunit.xml.dist
  7. +14 −0 tests/bootstrap.php
5 .gitignore
@@ -0,0 +1,5 @@
+vendor
+coverage
+composer.lock
+composer.phar
+phpunit.xml
11 .travis.yml
@@ -0,0 +1,11 @@
+language: php
+
+php:
+ - 5.3
+ - 5.4
+
+before_script:
+ - curl -s http://getcomposer.org/installer | php
+ - php composer.phar install --dev
+
+script: phpunit --coverage-text
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Christophe Coevoet
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
50 README.md
@@ -0,0 +1,50 @@
+# Stampie
+
+[![Build Status](https://secure.travis-ci.org/stof/StampieExtra.png)](http://travis-ci.org/stof/StampieExtra)
+
+StampieExtra provides an event-based extension point for [Stampie](https://github.com/henrikbjorn/Stampie).
+It uses the Symfony2 EventDispatcher component.
+
+## Usage
+
+the StampieExtra mailer wraps your Stampie mailer to provides extension points
+in the sendign process.
+
+``` php
+<?php
+
+// include the Composr autoloading
+require 'vendor/autoload.php';
+
+$adapter = new Stampie\Adapter\Buzz(new Buzz\Browser());
+$innerMailer = new Stampie\Mailer\SendGrid($adapter, 'username:password');
+
+$dispatcher = new Symfony\Component\EventDispatcher\EventDispatcher();
+$mailer = new Stampie\Extra\Mailer($innerMailer, $dispatcher);
+
+$message = // Create your Stampie message
+
+$mailer->send($message);
+```
+
+The mailer will then dispatch the `stampie.pre_send` event before sending
+the message, allowing you to apply some changes.
+
+## Built-in listeners
+
+### ImpersonateListener
+
+The ImpersonateListener allows you to replace the recipient of the mail during
+development to send all messages to a single email address. It will add a
+`X-Stampie-To` header containing the original recipient.
+
+
+``` php
+<?php
+$dispatcher->addEventSubscriber(new Stampie\Extra\EventListener\ImpersonateListener('stof@notk.org'));
+```
+
+## Testing
+
+StampieExtra is [Continuous Integration](http://en.wikipedia.org/wiki/Continuous_integration)
+tested with [Travis](http://travis-ci.org) and aims for a high coverage percentage.
23 composer.json
@@ -0,0 +1,23 @@
+{
+ "name" : "stof/stampie-extra",
+ "description" : "Event-based plugin for henrikbjorn/stampie",
+ "homepage" : "https://github.com/stof/StampieExtra",
+ "type" : "library",
+ "license" : "MIT",
+ "authors" : [
+ {
+ "name" : "Christophe Coevoet",
+ "email" : "stof@notk.org"
+ }
+ ],
+ "autoload" : {
+ "psr-0" : {
+ "Stampie\\Extra": "src/"
+ }
+ },
+ "require" : {
+ "php": ">=5.3.3",
+ "henrikbjorn/stampie": "*",
+ "symfony/event-dispatcher": ">=2.0,<2.2-dev"
+ }
+}
17 phpunit.xml.dist
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<phpunit colors="true" bootstrap="tests/bootstrap.php" >
+
+ <testsuites>
+ <testsuite name="StampieExtra Test Suite">
+ <directory>./tests/Stampie/Extra/Tests</directory>
+ </testsuite>
+ </testsuites>
+
+ <filter>
+ <whitelist>
+ <directory>./src</directory>
+ </whitelist>
+ </filter>
+
+</phpunit>
14 tests/bootstrap.php
@@ -0,0 +1,14 @@
+<?php
+
+if (!$loader = @include __DIR__ . '/../vendor/autoload.php') {
+ echo <<<'EOT'
+You must set up the project dependencies, run the following commands:
+wget http://getcomposer.org/composer.phar
+php composer.phar install
+EOT;
+
+ // Throw the correct error code, a build should fail if autoload isnt present.
+ exit(1);
+}
+
+$loader->add('Stampie\Extra\Test', __DIR__ . '/../tests');

0 comments on commit 0b7d69a

Please sign in to comment.