本文整理汇总了PHP中Manager类的典型用法代码示例。如果您正苦于以下问题:PHP Manager类的具体用法?PHP Manager怎么用?PHP Manager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Manager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testRemove
/**
* Tests Manager->remove()
*/
public function testRemove()
{
$this->Manager->set(__NAMESPACE__ . __CLASS__ . __FUNCTION__ . 'MyVar', true);
$this->assertTrue($this->Manager->has(__NAMESPACE__ . __CLASS__ . __FUNCTION__ . 'MyVar'));
$this->Manager->remove(__NAMESPACE__ . __CLASS__ . __FUNCTION__ . 'MyVar');
$this->assertFalse($this->Manager->has(__NAMESPACE__ . __CLASS__ . __FUNCTION__ . 'MyVar'));
}
示例2: __construct
/**
* @param string $class
* @param string $method
*/
function __construct(Manager $manager, $class, $method)
{
$this->class = $class;
$this->method = $method;
$inspector = $manager->get('Cti\\Di\\Inspector');
$this->arguments = $inspector->getMethodArguments($class, $method);
$this->requiredCount = $inspector->getMethodRequiredCount($class, $method);
}
示例3: testGeneral
public function testGeneral()
{
$sass = new Manager();
$sass->compile('body{background-color: $red}', ['red' => '#ff0000'], [], []);
$tempFile = KENDO_TEMP_DIR . '/test/unitest.css';
$sass->compileToFile($tempFile, 'default', 'default', ['red' => '#ff0000'], 'body{background: $red;}');
$this->assertNotEmpty(file_get_contents($tempFile));
}
示例4: testInitInvalidHandler
public function testInitInvalidHandler()
{
$handlerConfig = ['class' => 'Migration\\Migration', 'params' => ['value' => '12']];
$invalidHandler = $this->getMock('Migration\\Migration', [], [], '', false);
$this->objectManager->expects($this->once())->method('create')->will($this->returnValue($invalidHandler));
$this->setExpectedException('\\Exception', "'Migration\\Migration' is not correct handler.");
$this->manager->initHandler('somefield', $handlerConfig);
}
示例5: setPassword
function setPassword()
{
$bef = new Manager();
$ant = $bef->Find($this->id);
if ($bef->password != $this->password) {
$this->password = md5($this->password);
}
}
示例6: postRenderTemplate
public function postRenderTemplate(Twig_Template $template, $result)
{
$this->templateRenderingDepth--;
if ($this->templateRenderingDepth == 0) {
$result = str_replace((string) $this->assetBag, implode("\n", $this->assetManager->getHtmTags($this->assetBag->clear())), $result);
}
return $result;
}
示例7: testSetLanguage
public function testSetLanguage()
{
$variable = 'en';
$manager = new Manager();
$manager->setLanguage($variable);
$result = $manager->getLanguage();
$this->assertEquals($variable, $result);
}
示例8: testGenerateResponse
public function testGenerateResponse()
{
$context = $this->getMock('GFG\\DTOContext\\Context\\ContextInterface');
$factory = $this->getMock('GFG\\DTOError\\FactoryInterface');
$factory->expects($this->once())->method('generateCode')->with($context)->willReturn([['name' => 'test', 'code' => 'my code']]);
$manager = new Manager();
$manager->setFactory($factory);
$this->assertSame('my code', (string) $manager->generateCode($context));
}
示例9: requestCrop
/**
* Request a crop
*
* @param $input
* @return mixed
*/
public function requestCrop($input)
{
if ($newImage = $this->ImageManager->cropAndSaveFile($input)) {
$keepers = array_except($input, array('_token', 'cropper'));
$keepers['images'][] = $newImage;
return $this->Redirect->to($this->URL->route('dvs-media-manager') . '?' . http_build_query($keepers));
}
return $this->Redirect->back();
}
示例10: testProductPlane
public function testProductPlane()
{
$builder = new Builder\Plane();
$manager = new Manager($builder);
$manager->buildProduct();
$product = $manager->getProduct();
$this->assertEquals("plane", $product->getName());
$this->assertEquals(100500, $product->getPrice());
}
示例11: migrate
/**
*
*/
public function migrate()
{
InputOutput::display(_("Executes all migrations"));
$migrationManager = new Manager($module, 'production');
$cmd = $this->getPhinxCallLine() . 'migrate ';
$cmd .= '-c ' . $migrationManager->getPhinxConfigurationFile();
$cmd .= '-e ' . $this->module;
shell_exec($cmd);
}
示例12: testShouldDispatchEventWithArgumentUsingMagicMethods
public function testShouldDispatchEventWithArgumentUsingMagicMethods()
{
$callback = function (array $params) {
echo json_encode($params);
};
$this->expectOutputString('[1,2]');
$manager = new Manager();
$manager->foo = $callback;
$manager->foo(array(1, 2));
}
示例13: constructReturnOne
public function constructReturnOne($res)
{
if ($row = mysql_fetch_assoc($res)) {
$user = new Manager();
$user->setName($row['name']);
$user->setPassword($row['password']);
}
$this->getConnection()->releaseRes($res);
return $user;
}
示例14: addschool
public function addschool($filename)
{
PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip);
$files = scandir("./upload");
array_shift($files);
array_shift($files);
$errors = array();
$j = 0;
$this->db->begin();
foreach ($files as $file) {
if (strstr($file, $filename)) {
$objexcel = PHPExcel_IOFactory::load("./upload/" . $file);
$sheet = $objexcel->getSheet(0);
try {
$higestrow = $sheet->getHighestRow();
$i = 2;
while ($i <= $higestrow) {
$k = $sheet->getCell("A" . $i)->getValue();
if (is_null($k) || $k == "") {
break;
}
$username = (string) $sheet->getCell($this->excel_col[0] . $i)->getValue();
$password = (string) $sheet->getCell($this->excel_col[1] . $i)->getValue();
$district = (string) $sheet->getCell($this->excel_col[2] . $i)->getValue();
$schoolname = (string) $sheet->getCell($this->excel_col[3] . $i)->getValue();
$realname = (string) $sheet->getCell($this->excel_col[4] . $i)->getValue();
$phone = (string) $sheet->getCell($this->excel_col[5] . $i)->getValue();
$email = (string) $sheet->getCell($this->excel_col[6] . $i)->getValue();
$ID_number = (string) $sheet->getCell($this->excel_col[7] . $i)->getValue();
$manager = new Manager();
if ($manager->signup($username, $password, $phone, $email, $realname, $ID_number)) {
$this->newschool($schoolname, $district, $manager);
} else {
throw new PDOException();
}
$i++;
}
} catch (PDOException $ex) {
$errors['PDOException'] = $ex->getMessage();
$this->db->rollback();
$objexcel->disconnectWorksheets();
unlink("./upload/" . $file);
// throw $ex;
return $errors;
}
}
}
$objexcel->disconnectWorksheets();
unlink("./upload/" . $file);
$this->db->commit();
return $errors;
}
示例15: getInstance
/**
* Get manager instance
*
* @return Manager
*/
public static function getInstance()
{
// Check whether manager has been set
if (!isset(self::$instance)) {
// Manager not set
// Create new manager and load it's configuration
$manager = new Manager();
$manager->loadConfiguration();
// Set manager
self::$instance = $manager;
}
// Return manager instance
return self::$instance;
}