Skip to content

Commit

Permalink
Fix the build
Browse files Browse the repository at this point in the history
  • Loading branch information
umpirsky committed Feb 18, 2016
1 parent d6a36a4 commit f8b5462
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 22 deletions.
13 changes: 7 additions & 6 deletions spec/Extraload/Extractor/QueuedExtractorSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PhpAmqpLib\Channel\AMQPChannel;
use Ko\AmqpBroker;
use Ko\RabbitMq\Producer;
use Extraload\Extractor\ExtractorInterface;
use Extraload\Extractor\ExtractorIteratorInterface;

class QueuedExtractorSpec extends ObjectBehavior
{
function let(ExtractorIteratorInterface $extractor, AMQPChannel $channel)
function let(ExtractorIteratorInterface $extractor, AmqpBroker $broker)
{
$this->beConstructedWith($extractor, $channel, 'extracted');
$this->beConstructedWith($extractor, $broker, 'extracted');
}

function it_is_initializable()
Expand All @@ -25,11 +26,11 @@ function it_implements_extractor_interface()
$this->shouldHaveType('Extraload\Extractor\ExtractorInterface');
}

function it_publihes_messages_to_given_channel(ExtractorIteratorInterface $extractor, AMQPChannel $channel)
function it_publihes_messages_to_given_channel(ExtractorIteratorInterface $extractor, AmqpBroker $broker, Producer $producer)
{
$extractor->extract()->shouldBeCalled()->willReturn(['foo' => 'bar'], null);
$channel->basic_publish(Argument::any(), null, 'extracted')->shouldBeCalled();
$channel->close()->shouldBeCalled();
$broker->getProducer('extracted')->shouldBeCalled()->willReturn($producer);
$producer->publish(serialize(['foo' => 'bar']));

$this->extract();
}
Expand Down
1 change: 1 addition & 0 deletions spec/Extraload/Loader/ConsoleLoaderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function it_loads_data_in_console_using_table_helper(Table $table)
function it_renders_data_in_console_on_flush(Table $table)
{
$table->render()->shouldBeCalled();
$table->setRows([])->shouldBeCalled();

$this->flush();
}
Expand Down
8 changes: 4 additions & 4 deletions spec/Extraload/Loader/MessageLoaderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Extraload\Loader\LoaderInterface;
use PhpAmqpLib\Message\AMQPMessage;

class MessageLoaderSpec extends ObjectBehavior
{
Expand All @@ -29,11 +28,12 @@ function it_throws_exception_if_not_loading_message()
$this->shouldThrow('InvalidArgumentException')->duringLoad(['foo' => 'bar']);
}

function it_loads_data_from_message_using_given_loader(LoaderInterface $loader)
function it_loads_data_from_message_using_given_loader(LoaderInterface $loader, \AMQPEnvelope $envelope)
{
$message = new AMQPMessage(serialize(['foo' => 'bar']));
$envelope->getBody()->shouldBeCalled()->willReturn(serialize(['foo' => 'bar']));
$loader->load(['foo' => 'bar'])->shouldBeCalled();
$loader->flush()->shouldBeCalled();

$this->load($message);
$this->load($envelope);
}
}
14 changes: 9 additions & 5 deletions spec/Extraload/Loader/QueuedLoaderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use Extraload\Loader\LoaderInterface;
use PhpAmqpLib\Channel\AMQPChannel;
use Ko\AmqpBroker;
use Ko\RabbitMq\Consumer;

class QueuedLoaderSpec extends ObjectBehavior
{
function let(LoaderInterface $loader, AMQPChannel $channel)
function let(LoaderInterface $loader, AmqpBroker $broker)
{
$this->beConstructedWith($loader, $channel, 'transformed');
$this->beConstructedWith($loader, $broker, 'transformed');
}

function it_is_initializable()
Expand All @@ -24,8 +25,11 @@ function it_implements_loader_interface()
$this->shouldImplement('Extraload\Loader\LoaderInterface');
}

function it_publihes_messages_from_given_channel(LoaderInterface $loader, AMQPChannel $channel)
function it_publihes_messages_from_given_channel(LoaderInterface $loader, AmqpBroker $broker, Consumer $consumer)
{
$channel->basic_consume('transformed', '', false, false, false, false, [$loader, 'load']);
$broker->getConsumer('transformed')->shouldBeCalled()->willReturn($consumer);
$consumer->consume([$loader, 'load'], AMQP_AUTOACK);

$this->load();
}
}
6 changes: 2 additions & 4 deletions spec/Extraload/Pipeline/QueuedPipelineSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Extraload\Extractor\QueuedExtractor;
use Extraload\Transformer\TransformerInterface;;
use Extraload\Loader\QueuedLoader;
use PhpAmqpLib\Connection\AbstractConnection;
use Ko\ProcessManager;

class QueuedPipelineSpec extends ObjectBehavior
Expand All @@ -16,11 +15,10 @@ function let(
QueuedExtractor $extractor,
TransformerInterface $transformer,
QueuedLoader $loader,
ProcessManager $processManager,
AbstractConnection $connection
ProcessManager $processManager
)
{
$this->beConstructedWith($extractor, $transformer, $loader, $processManager, $connection);
$this->beConstructedWith($extractor, $transformer, $loader, $processManager);
}

function it_is_initializable()
Expand Down
2 changes: 0 additions & 2 deletions src/Extraload/Extractor/QueuedExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace Extraload\Extractor;

use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Message\AMQPMessage;
use Ko\AmqpBroker;

class QueuedExtractor implements ExtractorInterface
Expand Down
1 change: 0 additions & 1 deletion src/Extraload/Loader/QueuedLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Extraload\Loader;

use PhpAmqpLib\Channel\AMQPChannel;
use Ko\AmqpBroker;

class QueuedLoader extends AutoFlushLoader implements LoaderInterface
Expand Down

0 comments on commit f8b5462

Please sign in to comment.