function it_inserts_properties(File $file, Property $property, InsertPropertyHandler $insertPropertyHandler)
 {
     $properties = [$property->getWrappedObject()];
     $insertProperties = new InsertProperties($file->getWrappedObject(), $properties);
     $insertProperty = Argument::Type(InsertProperty::class);
     $insertPropertyHandler->handle($insertProperty)->shouldBeCalled();
     $this->handle($insertProperties);
 }
 public function it_should_not_create_pdf_document_already_created(PdfDocument $doc)
 {
     $this->intent->getPaymentMethod()->willReturn(SepaOfflinePaymentMethod::ID);
     $this->event->getDocument()->willReturn($doc);
     $this->event->setDocument(Argument::Type('ZendPdf\\PdfDocument'))->shouldNotBeCalled();
     $this->event->stopPropagation()->shouldNotBeCalled();
     $this->generate($this->event);
 }
 function it_does_not_insert_the_same_use_statement_twice(Editor $editor, File $file, FullyQualifiedName $fullyQualifiedName, InsertUseStatementHandler $insertUseStatementHandler)
 {
     $fullyQualifiedNames = [$fullyQualifiedName->getWrappedObject()];
     $insertUseStatements = new InsertUseStatements($file->getWrappedObject(), $fullyQualifiedNames);
     $fullyQualifiedName->getFullyQualifiedName()->willReturn('Vendor\\Project\\MyDependency');
     $editor->hasBelow($file, '/^use Vendor\\\\Project\\\\MyDependency;$/', 0)->willReturn(true);
     $insertUseStatement = Argument::Type(InsertUseStatement::class);
     $insertUseStatementHandler->handle($insertUseStatement)->shouldNotBeCalled();
     $this->handle($insertUseStatements);
 }
Example #4
0
 public function testSendException()
 {
     if (!class_exists('\\HipChat\\HipChat')) {
         $this->markTestSkipped('The HipChat bundle is not installed.');
     }
     $hipchatMock = $this->prophesize('\\HipChat\\HipChat');
     $hipchatMock->message_room(Argument::Type('string'), Argument::Type('string'), Argument::Type('string'), Argument::Type('bool'), Argument::Type('string'))->willThrow(new \HipChat\HipChat_Exception('400', 'Curl Error', 'http://api.hipchat.com/room'))->shouldBeCalled();
     $hipchatNotifier = new HipchatNotifier($hipchatMock->reveal(), new NullLogger(), 'room', 'Hogosha Bot');
     $this->assertFalse($hipchatNotifier->send('my message', array('color' => 'yellow')));
 }
 function it_gets_available_updates($client)
 {
     $fakeResponse = '{"_items":{"core":[{"version":"0.2.1","changelog":["commit1"]},{"version":"0.2.0"}]}}';
     $client->call(Argument::Any(), Argument::Type('array'))->willReturn($fakeResponse);
     $result = $this->getAvailableUpdates();
     $result->shouldHaveCount(1);
     $result->shouldBeArray();
     foreach ($result['core'] as $package) {
         $package->shouldHaveType('SWP\\UpdaterBundle\\Model\\UpdatePackage');
     }
 }