Skip to content

Commit

Permalink
init from base project
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightbr committed Aug 30, 2016
1 parent 324caba commit d3b1194
Show file tree
Hide file tree
Showing 25 changed files with 1,259 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bin
vendor
composer.lock
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
language: php
phpp:
- 5.4
- 5.5
- 5.6

before_script:
- composer install --dev -v --prefer-source

script:
- bin/phpspec run -fpretty --verbose
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

The MIT License (MIT)

Copyright (c) 2016 Titouan BENOIT
Copyright (c) 2016 Welpdev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# mailchimp-bundle

[![Build Status](https://travis-ci.org/welpdev/mailchimp-bundle.svg?branch=master)](https://travis-ci.org/welpdev/mailchimp-bundle)

This bundle will help you synchronise your project's newsletter subscribers into MailChimp.

You can [synchronize all your subscribers at once with a Symfony command](#full-synchronization-with-command) : new users will be added to MailChimp, existing users will be updated and user no longer in your project will be deleted from MailChimp.
Expand Down
29 changes: 29 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "welp/mailchimp-bundle",
"description": "MailChimp API V3 Symfony Bundle",
"license": "MIT",
"authors": [
{
"name": "Titouan BENOIT",
"email": "titouan@welp.today"
},
{
"name": "Gabriel Pillet",
"email": "contact@gabrielpillet.com"
}
],
"autoload": {
"psr-4": {
"Welp\\MailchimpBundle\\": "src/"
}
},
"require": {
"mailchimp/mailchimp": "^2.0",
"phpspec/phpspec": "~2@dev",
"psr/log": "^1.0",
"symfony/options-resolver": "~2@dev|~3@dev"
},
"config": {
"bin-dir": "bin"
}
}
4 changes: 4 additions & 0 deletions phpspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
suites:
default:
namespace: Welp\MailchimpBundle
psr4_prefix: Welp\MailchimpBundle
31 changes: 31 additions & 0 deletions spec/Event/SubscriberEventSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace spec\Welp\MailchimpBundle\Event;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Welp\MailchimpBundle\Subscriber\Subscriber;

class SubscriberEventSpec extends ObjectBehavior
{
function let(Subscriber $subscriber)
{
$this->beConstructedWith('listname', $subscriber);
}

function it_is_initializable()
{
$this->shouldHaveType('Welp\MailchimpBundle\Event\SubscriberEvent');
$this->shouldHaveType('Symfony\Component\EventDispatcher\Event');
}

function it_has_a_listname()
{
$this->getListName()->shouldReturn('listname');
}

function it_has_a_subscriber($subscriber)
{
$this->getSubscriber()->shouldReturn($subscriber);
}
}
39 changes: 39 additions & 0 deletions spec/Event/SubscriberListenerSpec.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace spec\Welp\MailchimpBundle\Event;

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Welp\MailchimpBundle\Subscriber\Subscriber;
use Welp\MailchimpBundle\Subscriber\ListRepository;
use Welp\MailchimpBundle\Event\SubscriberEvent;

class SubscriberListenerSpec extends ObjectBehavior
{
function let(ListRepository $listRepository, SubscriberEvent $event, Subscriber $subscriber)
{
$listRepository->findByName('foo')->willReturn(['id' => 123]);

$event->getListName()->willReturn('foo');
$event->getSubscriber()->willReturn($subscriber);

$this->beConstructedWith($listRepository);
}

function it_is_initializable()
{
$this->shouldHaveType('Welp\MailchimpBundle\Event\SubscriberListener');
}

function it_listen_to_subscribe_events($listRepository, $event, $subscriber)
{
$listRepository->subscribe(123, $subscriber)->shouldBeCalled();
$this->onSubscribe($event);
}

function it_listen_to_unsubscribe_events($listRepository, $event, $subscriber)
{
$listRepository->unsubscribe(123, $subscriber)->shouldBeCalled();
$this->onUnsubscribe($event);
}
}
Loading

0 comments on commit d3b1194

Please sign in to comment.