当前位置: 首页>>代码示例>>PHP>>正文


PHP Object::shouldReceive方法代码示例

本文整理汇总了PHP中Object::shouldReceive方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::shouldReceive方法的具体用法?PHP Object::shouldReceive怎么用?PHP Object::shouldReceive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Object的用法示例。


在下文中一共展示了Object::shouldReceive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: test_deactivateFail

 /**
  * Test a failing deactivate
  *
  * @return void
  * @author Dan Cox
  */
 public function test_deactivateFail()
 {
     $this->modules->shouldReceive('deactivate')->with('test')->andThrow("Exception");
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName(), 'name' => 'test']);
     $this->assertContains('Failed to deactivate', $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:13,代码来源:ModuleDeactivateTest.php

示例2: test_updateProjectsFromScan

 /**
  * Test updating existing projects
  *
  * @return void
  * @author Dan Cox
  */
 public function test_updateProjectsFromScan()
 {
     $this->DI->addMock('finder', $this->finder);
     $this->DI->addMock('config', $this->config);
     $this->DI->addMock('database', $this->database);
     $this->finder->shouldReceive('files')->andReturn($this->finder);
     $this->finder->shouldReceive('in')->andReturn([$this->finder]);
     $this->finder->shouldReceive('getRealPath')->andReturn('/var/www/test/test.yml');
     $this->config->shouldReceive('load')->with('/var/www/test/test.yml')->andReturn($this->config);
     $this->config->shouldReceive('params')->andReturn($this->config);
     $this->config->name = 'project';
     $this->config->description = '';
     $this->config->root_development = '';
     $this->config->root_live = '';
     $this->config->repository = array('remote_url' => '');
     $this->database->shouldReceive('getEntity')->andReturn($this->database);
     $this->database->shouldReceive('setModel');
     $this->database->shouldReceive('count')->with(['name', '=', 'project'])->andReturn(1);
     $this->database->shouldReceive('first')->andReturn($this->database);
     $this->database->repository = $this->database;
     $this->database->shouldReceive('save');
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName()]);
     $this->assertContains('Successfully saved project: project', $CT->getDisplay());
     $this->assertContains('Finished processing project file changes', $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:32,代码来源:ProjectScanTest.php

示例3: test_fail

 /**
  * Test a fail to make a config file for whatever reason
  *
  * @return void
  * @author Dan Cox
  */
 public function test_fail()
 {
     $this->setExpectedException('RuntimeException');
     $this->fs->shouldReceive('mkdir')->with(WORKBENCH . 'test')->andThrow(new Exception());
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName(), 'name' => 'test']);
     $this->assertContains('Failed', $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:14,代码来源:ModuleMakeTest.php

示例4: __construct

 /**
  * Creates the Mockery based on the service name
  *
  * @param string $service
  * @return void
  * @author Dan Cox
  */
 public function __construct($service)
 {
     $service = str_replace('.', '_', $service);
     $this->mockery = \Mockery::mock($service);
     // Add a call for the DI
     $this->mockery->shouldReceive('getDI')->andReturn($this->mockery);
     $this->mockery->shouldReceive('setDI')->andReturn($this->mockery);
 }
开发者ID:antoligy,项目名称:Framework,代码行数:15,代码来源:ServiceMockeryDecorator.php

示例5: test_invalidCron

 /**
  * Test when a cron cannot be found
  *
  * @return void
  * @author Dan Cox
  */
 public function test_invalidCron()
 {
     $this->setExpectedException('RuntimeException');
     $this->database->shouldReceive('setModel')->with('Alice\\Entity\\Cron')->andReturn($this->database);
     $this->database->shouldReceive('count')->andReturn(0);
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName(), 'name' => 'test']);
 }
开发者ID:danzabar,项目名称:alice,代码行数:14,代码来源:CronRemoveTest.php

示例6: test_addFail

 /**
  * Test a fail case
  *
  * @return void
  * @author Dan Cox
  */
 public function test_addFail()
 {
     $this->database->shouldReceive('setModel')->with('Alice\\Entity\\Contact')->andReturn($this->database);
     $this->database->shouldReceive('getEntity')->andThrow('Exception');
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName(), 'first' => 'test', 'last' => 'test', 'email' => 'test@test.com', '--phone' => '12345678910']);
     $this->assertContains('There was an issue', $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:14,代码来源:ContactAddTest.php

示例7: test_createFileFirst

 /**
  * Test Creating the file first
  *
  * @return void
  * @author Dan Cox
  */
 public function test_createFileFirst()
 {
     $this->fs->shouldReceive('exists')->andReturn(FALSE);
     $this->config->shouldReceive('create')->andReturn($this->config);
     $this->config->shouldReceive('params')->andReturn($this->config);
     $this->config->shouldReceive('save');
     $this->log->write('file.yml', 'logname', array('data' => array()));
 }
开发者ID:danzabar,项目名称:alice,代码行数:14,代码来源:LogTest.php

示例8: test_createConfigurationFiles

 /**
  * Test creating config files for the mod
  *
  * @return void
  * @author Dan Cox
  */
 public function test_createConfigurationFiles()
 {
     $this->config->shouldReceive('create')->andReturn($this->config);
     $this->config->shouldReceive('params')->andReturn($this->config);
     $this->config->shouldReceive('save');
     $tool = new ModuleTool();
     $tool->config(['test' => 'value']);
     $this->assertEquals('value', $this->config->test);
 }
开发者ID:danzabar,项目名称:alice,代码行数:15,代码来源:ModuleToolTest.php

示例9: test_update

 /**
  * Basic test
  *
  * @return void
  * @author Dan Cox
  */
 public function test_update()
 {
     $this->cron->shouldReceive('updateFromDB');
     $this->process->shouldReceive('build')->andReturn($this->process);
     $this->process->shouldReceive('getProcess')->andReturn($this->process);
     $this->process->shouldReceive('mustRun');
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName()]);
     $this->assertContains('Updated', $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:16,代码来源:CronUpdateTest.php

示例10: test_runThroughFailDoctrine

 /**
  * Test a run through that fails on dctrine
  *
  * @return void
  * @author Dan Cox
  */
 public function test_runThroughFailDoctrine()
 {
     $this->DI->addMock('doctrineprocess', $this->doctrine);
     $this->doctrine->shouldReceive('build')->with(['force' => true])->andReturn($this->doctrine);
     $this->doctrine->shouldReceive('getProcess')->andReturn($this->doctrine);
     $this->doctrine->shouldReceive('mustRun')->andThrow('Exception');
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName()]);
     $this->assertContains('Failed updating schema...', $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:16,代码来源:UpdateTest.php

示例11: test_runThrough

 /**
  * Command is simple, lets just test a run through
  *
  * @return void
  * @author Dan Cox
  */
 public function test_runThrough()
 {
     $this->DI->addMock('config', $this->config);
     $this->config->shouldReceive('create');
     $this->config->shouldReceive('params')->andReturn($this->config);
     $this->config->shouldReceive('save');
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName(), 'name' => 'test']);
     $this->assertContains("Saved project file", $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:16,代码来源:ProjectCreateTest.php

示例12: test_runThrough

 /**
  * Test a run through with a mocked process
  *
  * @return void
  * @author Dan Cox
  */
 public function test_runThrough()
 {
     $this->DI->addMock('doctrineprocess', $this->doctrine);
     $this->doctrine->shouldReceive('build')->with(['force' => true])->andReturn($this->doctrine);
     $this->doctrine->shouldReceive('getProcess')->andReturn($this->doctrine);
     $this->doctrine->shouldReceive('run');
     $this->doctrine->shouldReceive('isSuccessful')->andReturn(TRUE);
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName()]);
     $this->assertContains('Successfully updated the database schema', $CT->getDisplay());
 }
开发者ID:danzabar,项目名称:alice,代码行数:17,代码来源:DoctrineSchemaTest.php

示例13: test_deactivate

 /**
  * Test deactivating a mod
  *
  * @return void
  * @author Dan Cox
  */
 public function test_deactivate()
 {
     $this->config->shouldReceive('load');
     $this->probe->shouldReceive('load')->with('/var/www/');
     $this->probe->shouldReceive('deactivateModule');
     $this->config->shouldReceive('params')->andReturn($this->config);
     $this->config->modules = array('mod' => '/var/www');
     $mod = new Modules();
     $mod->library()->availableModules = array('mod' => '/var/www/');
     $mod->deactivate('mod');
 }
开发者ID:danzabar,项目名称:alice,代码行数:17,代码来源:ModulesTest.php

示例14: test_updateCronTabText

 /**
  * Test updating crontab text file
  *
  * @return void
  * @author Dan Cox
  */
 public function test_updateCronTabText()
 {
     $this->database->shouldReceive('setModel')->with('Alice\\Entity\\Cron')->andReturn($this->database);
     $this->database->shouldReceive('get')->andReturn([$this->database]);
     // 1 Result.
     $this->database->jobdate = '* * * * *';
     $this->database->id = 1;
     $this->fs->shouldReceive('dumpFile')->with('/tmp/crontab.txt', "* * * * * /usr/bin/php " . ROOT . "alice cron:run 1\n");
     $cron = new Cron();
     $cron->updateFromDB();
 }
开发者ID:danzabar,项目名称:alice,代码行数:17,代码来源:CronTest.php

示例15: test_runThroughCommand

 /**
  * Test a working run through of the command
  *
  * @return void
  * @author Dan Cox
  */
 public function test_runThroughCommand()
 {
     $this->command->getHelper('question')->setInputStream($this->inputStream("git init, touch readme.md\nvalue = test, foo = bar\n"));
     // Database expectations
     $this->database->shouldReceive('getEntity')->andReturn($this->database);
     $this->database->shouldReceive('persist');
     $this->database->shouldReceive('flush');
     // Mock the config class
     $this->DI->addMock('config', $this->config);
     $this->config->shouldReceive('create')->with(CONFIG . 'commands/test.command.yml');
     $this->config->shouldReceive('params')->andReturn($this->config);
     $this->config->shouldReceive('save');
     $CT = new CommandTester($this->command);
     $CT->execute(['command' => $this->command->getName(), 'name' => 'test.command']);
 }
开发者ID:danzabar,项目名称:alice,代码行数:21,代码来源:CommandCreateTest.php


注:本文中的Object::shouldReceive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。