public function testCompile() { $this->_mockLogger->shouldReceive('error')->once()->with('Failed to inspect <code>bogus class</code>: <code>Class bogus class does not exist</code>'); $this->_mockLogger->shouldReceive('error')->once()->with('Failed to inspect <code>Hello</code>: <code>Class Hello does not exist</code>'); $this->_mockLogger->shouldReceive('error')->once()->with('Failed to inspect <code>There</code>: <code>Class There does not exist</code>'); $this->_mockLogger->shouldReceive('error')->once()->with('(Add-on <code>1</code> of <code>2</code>: <code>mock add-on 1</code>) Failed to load <code>bogus class</code> as a container extension: <code>Class bogus class does not exist</code>'); $this->_mockLogger->shouldReceive('error')->once()->with('(Add-on <code>2</code> of <code>2</code>: <code>mock add-on 2</code>) Failed to load <code>Hello</code> as a container extension: <code>Class Hello does not exist</code>'); $this->_mockLogger->shouldReceive('error')->once()->with('(Add-on <code>2</code> of <code>2</code>: <code>mock add-on 2</code>) Failed to load <code>There</code> as a container extension: <code>Class There does not exist</code>'); $this->_mockLogger->shouldReceive('error')->once()->with('Failed to load <code>no such class</code> as a compiler pass: <code>Class no such class does not exist</code>'); $mockAddon1 = $this->mock(tubepress_api_contrib_AddonInterface::_); $mockAddon2 = $this->mock(tubepress_api_contrib_AddonInterface::_); $mockAddon1->shouldReceive('getName')->andReturn('mock add-on 1'); $mockAddon2->shouldReceive('getName')->andReturn('mock add-on 2'); $mockAddon1IocContainerExtensions = array('FakeExtension', 'bogus class'); $mockAddon2IocContainerExtensions = array('Hello', 'There'); $mockAddon2IocCompilerPasses = array('FakeCompilerPass' => 5, 'no such class' => 4); $mockAddon1->shouldReceive('getExtensionClassNames')->once()->andReturn($mockAddon1IocContainerExtensions); $mockAddon1->shouldReceive('getMapOfCompilerPassClassNamesToPriorities')->once()->andReturn(array()); $mockAddon2->shouldReceive('getExtensionClassNames')->once()->andReturn($mockAddon2IocContainerExtensions); $mockAddon2->shouldReceive('getMapOfCompilerPassClassNamesToPriorities')->once()->andReturn($mockAddon2IocCompilerPasses); $mockAddons = array($mockAddon1, $mockAddon2); $this->_mockIocContainer->shouldReceive('compile')->once(); $this->_mockIocContainer->shouldReceive('addCompilerPass')->once()->with(Mockery::any('FakeCompilerPass')); $this->_mockIocContainer->shouldReceive('registerExtension')->once()->with(Mockery::any('FakeExtension')); $this->_sut->compile($this->_mockIocContainer, $mockAddons); $this->assertTrue(true); }
/** @test */ public function it_uses_query_builder_to_filter_choices() { $mdl = new DummyModel(); $options = [ 'class' => 'DummyModel', 'property' => 'short_name', 'query_builder' => function (DummyModel $model) { return $model->getData()->filter(function($val) { return $val['id'] > 1; }); } ]; $this->fieldExpetations('select', Mockery::any()); $this->fieldExpetations('choice', Mockery::any()); $choice = new EntityType('entity_choice', 'entity', $this->plainForm, $options); $choice->render(); $expected = [ 2 => 'Fr', 3 => 'Rs' ]; $this->assertEquals($expected, $choice->getOption('choices')); }
/** @test */ public function friendship_is_cancelled() { $this->sender->befriend($this->recipient); $this->recipient->acceptFriendRequest($this->sender); Event::shouldReceive('fire')->once()->withArgs(['friendships.cancelled', Mockery::any()]); $this->recipient->unfriend($this->sender); }
public function testGetURIWithIndex() { $uri = '/testIndex/_analyze'; $mockTransport = m::mock('\\Elasticsearch\\Transport')->shouldReceive('performRequest')->once()->with('GET', $uri, array(), m::any())->getMock(); $action = new Analyze($mockTransport); $action->setIndex('testIndex')->performRequest(); }
public function testShouldRunSniffer() { /* |------------------------------------------------------------ | Set |------------------------------------------------------------ */ $command = m::mock('LeroyMerlin\\LaraSniffer\\SniffCommand[getPHPSnifferInstance]'); $command->shouldAllowMockingProtectedMethods(); $command->app = m::mock('LaravelApp'); $command->config = m::mock('Config'); $phpcs = m::mock("PHP_CodeSniffer_CLI"); $options = ['standard' => "PSRX", 'files' => "path/to/files", 'ignored' => array('*blade.php'), 'extensions' => array("php")]; /* |------------------------------------------------------------ | Expectation |------------------------------------------------------------ */ $command->shouldReceive('getPHPSnifferInstance')->once()->andReturn($phpcs); $phpcs->shouldReceive('checkRequirements')->once(); $command->config->shouldReceive('get')->with('larasniffer::standard', m::any())->andReturn('PSRX'); $command->config->shouldReceive('get')->with('larasniffer::files', m::any())->andReturn('path/to/files'); $command->config->shouldReceive('get')->with('larasniffer::ignored', m::any())->andReturn(array('*blade.php')); $phpcs->shouldReceive('process')->with($options)->once()->andReturnUsing(function () { echo 'Something'; return 1; }); /* |------------------------------------------------------------ | Assertion |------------------------------------------------------------ */ $this->assertEquals('Something', $command->runSniffer()); }
public function testUpdate() { $this->transport->shouldReceive('performRequest')->once()->withArgs(['PATCH', 'subscriptions/10/', [], ['event_name' => 'order_unit_new', 'callback_url' => 'http://localhost/v2', 'fallback_email' => '*****@*****.**', 'is_active' => false], \Mockery::any()])->andReturn(['status' => 204]); $namespace = new SubscriptionsNamespace($this->transport); $result = $namespace->update(10, 'order_unit_new', 'http://localhost/v2', '*****@*****.**', false); $this->assertTrue($result); }
public function testGetValuesFromTo() { $expectedValues = [60 => 1.0]; $this->_query->shouldReceive('run')->with(m::any(), ['dataset' => 'mock-dataset', 'from' => new DateTimeImmutable(date('c', 60)), 'to' => new DateTimeImmutable(date('c', 120))])->andReturn([(object) ['value' => 1, 'period' => 60]]); $returnedValues = $this->_range->getValues(60, 120); $this->assertSame($returnedValues, $expectedValues); }
public function test_install() { /** === Test Data === */ /** === Setup Mocks === */ // $setup->startSetup(); $this->mSetup->shouldReceive('startSetup')->once(); // $demPackage = $this->_toolDem->readDemPackage($pathToFile, $pathToNode); $mDemPackage = $this->_mock(DataObject::class); $this->mToolDem->shouldReceive('readDemPackage')->once()->withArgs([\Mockery::any(), '/dBEAR/package/Praxigento/package/Bonus/package/Base'])->andReturn($mDemPackage); // $demEntity = $demPackage->getData('package/Type/entity/Asset'); $mDemPackage->shouldReceive('getData'); // // $this->_toolDem->createEntity($entityAlias, $demEntity); // $this->mToolDem->shouldReceive('createEntity')->withArgs([TypeCalc::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Period::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Calculation::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Compress::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Level::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Rank::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([CfgGeneration::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([LogCustomers::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([LogOpers::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([LogRank::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([LogSales::ENTITY_NAME, \Mockery::any()]); // $setup->endSetup(); $this->mSetup->shouldReceive('endSetup')->once(); /** === Call and asserts === */ $this->obj->install($this->mSetup, $this->mContext); }
public function testProcessMessage() { $amqpChannel = $this->getMockBuilder('AMQPChannel')->disableOriginalConstructor()->getMock(); $amqpChannel->expects($this->once())->method('getPrefetchCount')->willReturn(3); $message = $this->getMockBuilder('AMQPEnvelope')->disableOriginalConstructor()->getMock(); $amqpQueue = $this->getMockBuilder('AMQPQueue')->disableOriginalConstructor()->getMock(); $amqpExchange = $this->getMockBuilder('AMQPExchange')->disableOriginalConstructor()->getMock(); $eventResponse = $this->getMock('Zend\\EventManager\\ResponseCollection'); $eventManager = m::mock('Zend\\EventManager\\EventManager'); $eventManager->shouldReceive('setIdentifiers'); $message->expects($this->once())->method('getDeliveryTag')->willReturn('delivery-tag'); $message->expects($this->once())->method('getCorrelationId')->willReturn('correlation-id'); $message->expects($this->once())->method('getReplyTo')->willReturn('reply-to'); $amqpQueue->expects($this->once())->method('getChannel')->willReturn($amqpChannel); $amqpQueue->expects($this->any())->method('get')->willReturn($message); $reponse = json_encode(array('success' => true, 'result' => 'response-result')); $amqpExchange->expects($this->once())->method('publish')->with($this->equalTo($reponse), $this->equalTo('reply-to'), $this->equalTo(AMQP_NOPARAM), $this->callback(function ($param) { return is_array($param); })); $rpcServer = new RpcServer($amqpQueue, 1, 1 * 1000 * 500); $rpcServer->setEventManager($eventManager); $rpcServer->setExchange($amqpExchange); $eventResponse->expects($this->atLeast(1))->method('last')->willReturn('response-result'); $eventManager->shouldReceive('trigger')->once()->with('delivery', $rpcServer, ['message' => $message, 'queue' => $amqpQueue])->andReturn($eventResponse); $eventManager->shouldReceive('trigger')->once()->with('ack', $rpcServer, m::any()); $amqpQueue->expects($this->once())->method('ack'); $rpcServer->consume(1); }
/** * Tests the <code>run()</code> method. * * @covers Braincrafted\Mq\Server::__construct() * @covers Braincrafted\Mq\Server::run() */ public function testRun() { $this->socket->shouldReceive('on')->with('connection', m::any())->once(); $this->socket->shouldReceive('listen')->with(4000)->once(); $this->loop->shouldReceive('run')->withNoArgs()->once(); $this->server->run('php consumer.php', 4000); }
public function testUpdate() { $this->transport->shouldReceive('performRequest')->once()->withArgs(['PATCH', 'product-data/1231231231232/', [], ['category' => ['alpin-skier']], \Mockery::any()])->andReturn(['status' => 204]); $namespace = new ProductDataNamespace($this->transport); $result = $namespace->update("1231231231232", ProductDataTransfer::make(['category' => ['alpin-skier']])); $this->assertTrue($result); }
public function testGetViewReturnsDefaultViewWithNoView() { $template = new Template(); View::shouldReceive('exists')->with(\Mockery::any())->andReturn(false); View::shouldReceive('make')->with('boomcms::templates.default'); $template->getView(); }
/** @test */ public function it_creates_choice_as_radio_buttons() { $options = [ 'attr' => ['class' => 'choice-class-something'], 'choices' => [1 => 'yes', 2 => 'no'], 'selected' => 'no', 'expanded' => true ]; $this->fieldExpetations('radio', Mockery::any()); $this->fieldExpetations('radio', Mockery::any()); $this->fieldExpetations('choice', Mockery::any()); $choice = new ChoiceType('some_choice', 'choice', $this->plainForm, $options); $choice->render(); $this->assertEquals(2, count($choice->getChildren())); $this->assertInstanceOf( 'Kris\LaravelFormBuilder\Fields\CheckableType', $choice->getChild(1) ); $this->assertEquals('no', $choice->getOption('selected')); $this->assertContainsOnlyInstancesOf('Kris\LaravelFormBuilder\Fields\CheckableType', $choice->getChildren()); }
public function test_install() { /** === Test Data === */ /** === Setup Mocks === */ // $setup->startSetup(); $this->mSetup->shouldReceive('startSetup')->once(); // $demPackage = $this->_toolDem->readDemPackage($pathToFile, $pathToNode); $mDemPackage = $this->_mock(DataObject::class); $this->mToolDem->shouldReceive('readDemPackage')->once()->withArgs([\Mockery::any(), '/dBEAR/package/Praxigento/package/Odoo'])->andReturn($mDemPackage); // $demEntity = $demPackage->getData('package/Type/entity/Asset'); $mDemPackage->shouldReceive('getData'); // // $this->_toolDem->createEntity($entityAlias, $demEntity); // $this->mToolDem->shouldReceive('createEntity')->withArgs([Category::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Customer::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Lot::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Product::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([SaleOrder::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Warehouse::ENTITY_NAME, \Mockery::any()]); // $setup->endSetup(); $this->mSetup->shouldReceive('endSetup')->once(); /** === Call and asserts === */ $this->obj->install($this->mSetup, $this->mContext); }
public function testBuildView() { $optionsBoth = array('attr' => array('input_group' => array('button_prepend' => array('name' => 'prepend', 'type' => 'submit', 'options' => array()), 'button_append' => array('name' => 'append', 'type' => 'submit', 'options' => array())))); $buttonPrepend = m::mock('Symfony\\Component\\Form\\Button'); $buttonPrepend->shouldReceive('createView')->andReturn('prepend'); $buttonAppend = m::mock('Symfony\\Component\\Form\\Button'); $buttonAppend->shouldReceive('createView')->andReturn('append'); $buttonBuilderPrepend = m::mock('Symfony\\Component\\Form\\ButtonBuilder'); $buttonBuilderPrepend->shouldReceive('getForm')->andReturn($buttonPrepend); $buttonBuilderAppend = m::mock('Symfony\\Component\\Form\\ButtonBuilder'); $buttonBuilderAppend->shouldReceive('getForm')->andReturn($buttonAppend); $builder = m::mock('Symfony\\Component\\Form\\FormBuilderInterface'); $builder->shouldReceive('create')->with('prepend', m::any(), m::any())->andReturn($buttonBuilderPrepend); $builder->shouldReceive('create')->with('append', m::any(), m::any())->andReturn($buttonBuilderAppend); $builder->shouldReceive('getName')->andReturn('input_name'); $this->extension->buildForm($builder, $optionsBoth); $view = new FormView(); $type = m::mock('Symfony\\Component\\Form\\FormInterface'); $type->shouldReceive('getName')->andReturn('input_name'); $this->extension->buildView($view, $type, array()); $this->assertArrayHasKey('input_group_button_prepend', $view->vars); $this->assertArrayHasKey('input_group_button_append', $view->vars); $this->assertEquals('prepend', $view->vars['input_group_button_prepend']); $this->assertEquals('append', $view->vars['input_group_button_append']); }
public function testScreenshotLogsTheHtmlImageItem() { $w = self::writer(); $w->shouldReceive('log')->once()->with(m::any(), '/<img src=".*\\.png/'); $j = new WebDriverJournal\Journal($w); $j->screenshot(''); }
public function testCreateResourceInCollection() { $this->connection->shouldReceive('get')->never(); $this->connection->shouldReceive('post')->with('things', \Mockery::any())->andReturn((object) array('id' => '5', 'key' => 'value'))->once(); $newThing = $this->model->things()->create(array('key' => 'value')); $this->assertEquals($newThing->key, 'value'); }
public function test_install() { /** === Test Data === */ /** === Setup Mocks === */ // $setup->startSetup(); $this->mSetup->shouldReceive('startSetup')->once(); // $demPackage = $this->_toolDem->readDemPackage($pathToFile, $pathToNode); $mDemPackage = $this->_mock(DataObject::class); $this->mToolDem->shouldReceive('readDemPackage')->once()->withArgs([\Mockery::any(), '/dBEAR/package/Praxigento/package/Accounting'])->andReturn($mDemPackage); // $demEntity = $demPackage->getData('package/Type/entity/Asset'); $mDemPackage->shouldReceive('getData'); // // $this->_toolDem->createEntity($entityAlias, $demEntity); // $this->mToolDem->shouldReceive('createEntity')->withArgs([TypeAsset::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([TypeOperation::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Account::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Operation::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Transaction::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([Balance::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([LogChangeAdmin::ENTITY_NAME, \Mockery::any()]); $this->mToolDem->shouldReceive('createEntity')->withArgs([LogChangeCustomer::ENTITY_NAME, \Mockery::any()]); // $setup->endSetup(); $this->mSetup->shouldReceive('endSetup')->once(); /** === Call and asserts === */ $this->obj->install($this->mSetup, $this->mContext); }
/** * @test */ public function it_should_bind_index() { /** * Set */ App::clearResolvedInstances(); App::shouldReceive('make')->with('menthol.flexible.index', m::any())->once()->andReturn('mock'); App::shouldReceive('make')->with('Elasticsearch')->twice()->andReturn('mock'); $config = m::mock('Menthol\\Flexible\\Config'); App::shouldReceive('make')->with('Menthol\\Flexible\\Config')->once()->andReturn($config); $config->shouldReceive('get')->with('elasticsearch.index_prefix', '')->andReturn(''); $model = m::mock('Illuminate\\Database\\Eloquent\\Model'); $model->shouldReceive('getTable')->once()->andReturn('mockType'); $app = m::mock('LaravelApp'); $proxy = m::mock('Menthol\\Flexible\\Proxy', [$model]); $sp = m::mock('Menthol\\Flexible\\FlexibleServiceProvider[bindIndex]', [$app]); /** * Expectation */ $app->shouldReceive('bind')->once()->andReturnUsing(function ($name, $closure) use($app, $proxy) { $this->assertEquals('menthol.flexible.index', $name); $this->assertInstanceOf('Menthol\\Flexible\\Index', $closure($app, ['proxy' => $proxy, 'name' => 'name'])); }); /** * Assertion */ $sp->bindIndex(); }
public function testSetBody() { $query['docs'] = '1'; $mockTransport = m::mock('\\Elasticsearch\\Transport')->shouldReceive('performRequest')->once()->with(m::any(), m::any(), array(), $query)->getMock(); $action = new Put($mockTransport); $action->setBody($query)->performRequest(); }
public function testMakeShould() { $fs = m::mock('Illuminate\\Filesystem\\Filesystem')->shouldIgnoreMissing(); $me = m::mock('Mustache_Engine')->shouldDeferMissing(); $fp = m::mock('Parsers\\FieldParser'); $or = m::mock('Console\\OptionReader'); $or->shouldReceive('getFields')->times(3)->andReturn([]); $entity = 'order'; $sourceTemplate = '/foo/bar/template.txt'; $destinationDir = '/some/dir'; $fileName = 'SomeFileName.php'; $instance = m::mock('Generators\\Seed[updateDatabaseSeederRunMethod,getFileName]', [$fs, $me, $fp, $or]); $instance->shouldReceive('getFileName')->times(5)->andReturn($fileName); $instance->shouldReceive('updateDatabaseSeederRunMethod')->times(2)->with(basename($fileName, ".php"), m::any()); //test pass $result = $instance->make($entity, $sourceTemplate, $destinationDir, $fileName, $or); $this->assertTrue($result); $fs->shouldReceive('exists')->with(implode(DIRECTORY_SEPARATOR, [$destinationDir, $fileName]))->andReturn(true); $or->shouldReceive('isGenerationForced')->once()->andReturn(false); //test fail $result = $instance->make($entity, $sourceTemplate, $destinationDir, $fileName, $or); $this->assertFalse($result); //test force make $or->shouldReceive('isGenerationForced')->once()->andReturn(true); $result = $instance->make($entity, $sourceTemplate, $destinationDir, $fileName, $or); $this->assertTrue($result); }
public function testGetURIWithBothTypeAndIndex() { $uri = '/testIndex/testType/_count'; $mockTransport = m::mock('\\Elasticsearch\\Transport')->shouldReceive('performRequest')->once()->with(m::any(), $uri, array(), m::any())->getMock(); $action = new Count($mockTransport); $action->setIndex('testIndex')->setType('testType')->performRequest(); }
/** @test */ public function it_can_handle_object_with_getters_and_setters() { $expectedOptions = $this->getDefaults(['type' => 'submit'], 'save', 'Save'); $expectedOptions['wrapperAttrs'] = null; $expectedOptions['wrapper'] = false; /* $expectedOptions['wrapperAttrs'] = null; */ $this->fieldExpetations('button', Mockery::any()); $button = new ButtonType('save', 'submit', $this->plainForm); $this->assertEquals('save', $button->getName()); $this->assertEquals('submit', $button->getType()); $this->assertEquals($expectedOptions, $button->getOptions()); $this->assertFalse($button->isRendered()); $button->setName('cancel'); $button->setType('reset'); $button->setOptions(['attr' => ['id' => 'button-id'], 'label' => 'Cancel it']); $expectedOptions = $this->getDefaults(['type' => 'submit', 'id' => 'button-id'], 'save', 'Cancel it'); $expectedOptions['wrapperAttrs'] = null; $expectedOptions['wrapper'] = false; $this->assertEquals('cancel', $button->getName()); $this->assertEquals('reset', $button->getType()); $this->assertEquals($expectedOptions, $button->getOptions()); $button->render(); $this->assertTrue($button->isRendered()); }
/** * @return m\MockInterface */ protected function mockFileUploader() { $file = m::mock('\\Symfony\\Component\\HttpFoundation\\File\\UploadedFile'); $file->shouldReceive('move')->withArgs(['target/directory', m::any()])->once()->andReturn(true); $file->shouldReceive('getClientOriginalExtension')->once()->andReturn('txt'); return $file; }
public function testShouldSave() { $prod = new _stubProduct(); $prod->name = 'Something'; $this->productsCollection->shouldReceive('save')->with(m::any(), ['w' => 1])->once()->andReturn(['ok' => 1]); $this->assertTrue($prod->save()); }
public function testSendReturnsCountFromTransport() { $transport = $this->_createTransport(); $message = $this->_createMessage(); $transport->shouldReceive('send')->once()->with($message, \Mockery::any())->andReturn(57); $mailer = $this->_createMailer($transport); $this->assertEquals(57, $mailer->send($message)); }
public function testAuthenticationFailureSendRsetAndReturnFalse() { $cram = $this->_getAuthenticator(); $this->_agent->shouldReceive('executeCommand')->once()->with("AUTH CRAM-MD5\r\n", array(334))->andReturn('334 ' . base64_encode('<foo@bar>') . "\r\n"); $this->_agent->shouldReceive('executeCommand')->once()->with(\Mockery::any(), array(235))->andThrow(new Swift_TransportException('')); $this->_agent->shouldReceive('executeCommand')->once()->with("RSET\r\n", array(250)); $this->assertFalse($cram->authenticate($this->_agent, 'jack', 'pass'), '%s: Authentication fails, so RSET should be sent'); }
public function testRepositoriesAreRegistered() { $app = m::mock(Application::class); $app->shouldReceive('singleton')->with('boomcms.repositories.person', m::any()); $app->shouldReceive('singleton')->with('boomcms.repositories.group', m::any()); $sp = new PersonServiceProvider($app); $sp->register(); }
function testPost() { $http = m::mock(new Services_Twilio_TinyHttp()); $http->shouldReceive('post')->once()->with('/2010-04-01/Accounts/AC123/Applications.json', m::any(), 'FriendlyName=foo&VoiceUrl=bar')->andReturn(array(200, array('Content-Type' => 'application/json'), json_encode(array('sid' => 'AP123')))); $client = new Services_Twilio('AC123', '123', '2010-04-01', $http); $app = $client->account->applications->create('foo', array('VoiceUrl' => 'bar')); $this->assertEquals('AP123', $app->sid); }
public function testCanAcceptCustomPathToModelsDirectory() { $gen = m::mock('Way\\Generators\\Generators\\ModelGenerator'); $gen->shouldReceive('make')->once()->with(app_path() . '/foo/models/Foo.php', m::any()); $command = new ModelGeneratorCommand($gen); $tester = new CommandTester($command); $tester->execute(['name' => 'foo', '--path' => app_path() . '/foo/models']); }