本文整理汇总了PHP中Object::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::getName方法的具体用法?PHP Object::getName怎么用?PHP Object::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::getName方法的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());
}
示例2: 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());
}
示例3: 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());
}
示例4: 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']);
}
示例5: 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());
}
示例6: 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());
}
示例7: 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());
}
示例8: test_failbyexception
/**
* Fail by exception
*
* @return void
* @author Dan Cox
*/
public function test_failbyexception()
{
$this->database->shouldReceive('setModel')->with('Alice\\Entity\\Contact')->andReturn($this->database);
$this->database->shouldReceive('getEntity')->andReturn($this->database);
$this->database->shouldReceive('count')->andReturn(1);
$this->database->shouldReceive('first')->andThrow('Exception');
$CT = new CommandTester($this->command);
$CT->execute(['command' => $this->command->getName(), 'email' => 'test@test.com']);
$this->assertContains("Failed removing contact from database", $CT->getDisplay());
}
示例9: 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());
}
示例10: 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']);
}
示例11: 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());
}
示例12: UserDataLog
/**
* Construtor
* @param string $serviceName
* @param Object $userData
*/
function UserDataLog($serviceName, $userData)
{
$this->serviceName = $serviceName;
$this->setDirectory();
// Definindo dados do usuário
$this->fields['ip'] = $userData->getIp();
$this->fields['language'] = $userData->getLanguage();
$this->fields['nameHost'] = $userData->getName();
$this->fields['OS'] = $userData->getOS();
$this->fields['port'] = $userData->getPort();
$this->fields['resolution'] = $userData->getResolution();
$this->fields['title'] = $userData->getTitle();
$this->fields['url'] = $userData->getURL();
$browser = array();
$support = array();
$browser = $userData->getBrowser();
$support = $userData->getSupport();
$i = 0;
for ($i = 0; $i < count($browser) - 1; $i++) {
$this->fields['browser'] .= $browser[$i] . " , ";
}
$this->fields['browser'] .= $browser[$i];
for ($i = 0; $i < count($support) - 1; $i++) {
$this->fields['support'] .= $support[$i] . " , ";
}
$this->fields['support'] .= $support[$i];
}
示例13: test_runBasicSkeletonCommands
/**
* Using a test skeleton, run a basic skeleton command list
*
* @return void
* @author Dan Cox
*/
public function test_runBasicSkeletonCommands()
{
$sp = m::mock('skeletonprocess');
$collection = m::mock('collection');
$this->DI->addMock('skeletonprocess', $sp);
$this->DI->addMock('collection', $collection);
$this->DI->addMock('fs', $this->filesystem);
// Collection Mocks
$collection->shouldReceive('create')->andReturn($collection);
$collection->build_script = array('mkdir [directory]', 'composer install');
// FS Mocks
$this->filesystem->shouldReceive('exists')->andReturn(TRUE);
// Skeleton Mocks
$sp->shouldReceive('build')->with(['directory' => __DIR__, 'verbose' => false])->andReturn($sp);
$sp->shouldReceive('getProcess')->andReturn($sp);
$sp->shouldReceive('setArguments')->with(array('mkdir', __DIR__))->andReturn($sp);
$sp->shouldReceive('setArguments')->with(array('composer', 'install'))->andReturn($sp);
$sp->shouldReceive('mustRun');
$sp->shouldReceive('getCommandLine')->andReturn("'mkdir' '" . __DIR__ . "'");
$CT = new CommandTester($this->command);
$CT->execute(['command' => $this->command->getName(), 'config' => 'test.yml', 'directory' => __DIR__]);
// The skeleton process passes, but the composer process fails
$this->assertContains("Successfully ran command: 'mkdir'", $CT->getDisplay());
$this->assertContains("The command \"'composer'", $CT->getDisplay());
}
示例14: test_runtimeExceptionOnMissingCommandList
/**
* Test that a run time exception fires when the command list does not exist
*
* @return void
* @author Dan Cox
*/
public function test_runtimeExceptionOnMissingCommandList()
{
$this->database->shouldReceive('setModel')->with('Alice\\Entity\\Command')->andReturn($this->database);
$this->database->shouldReceive('getEntity')->andReturn($this->database);
$this->database->shouldReceive('count')->andReturn(0);
$this->setExpectedException('RuntimeException');
$CT = new CommandTester($this->command);
$CT->execute(["command" => $this->command->getName(), "name" => 'test', "time" => '* * * * *', "--commandlist" => 'test']);
}
示例15: test_commandDoesntExist
/**
* Test the runtime exception fires when a command does not exist
*
* @return void
* @author Dan Cox
*/
public function test_commandDoesntExist()
{
$this->setExpectedException('RuntimeException');
$this->database->shouldReceive('setModel')->with('Alice\\Entity\\Command')->andReturn($this->database);
$this->database->shouldReceive('getEntity')->andReturn($this->database);
$this->database->shouldReceive('count')->andReturn(0);
$CT = new CommandTester($this->command);
$CT->execute(['command' => $this->command->getName(), 'name' => 'testFail', 'directory' => __DIR__]);
}