public function testBuild() { $type = 'history'; $userId = 1; $user = $this->getMockBuilder('stdClass')->setMethods(['getId'])->getMock(); $user->expects($this->once())->method('getId')->will($this->returnValue($userId)); $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface'); $token->expects($this->once())->method('getUser')->will($this->returnValue($user)); $this->tokenStorage->expects($this->once())->method('getToken')->will($this->returnValue($token)); $item = $this->getMock('Oro\\Bundle\\NavigationBundle\\Entity\\NavigationItemInterface'); $this->factory->expects($this->once())->method('createItem')->with($type, [])->will($this->returnValue($item)); $repository = $this->getMockBuilder('Oro\\Bundle\\NavigationBundle\\Entity\\Repository\\HistoryItemRepository')->disableOriginalConstructor()->getMock(); $items = [['id' => 1, 'title' => 'test1', 'url' => '/'], ['id' => 2, 'title' => 'test2', 'url' => '/home']]; $repository->expects($this->once())->method('getNavigationItems')->with($userId, $type)->will($this->returnValue($items)); $this->em->expects($this->once())->method('getRepository')->with(get_class($item))->will($this->returnValue($repository)); $menu = $this->getMockBuilder('Knp\\Menu\\MenuItem')->disableOriginalConstructor()->getMock(); $childMock = $this->getMock('Knp\\Menu\\ItemInterface'); $childMock2 = clone $childMock; $children = [$childMock, $childMock2]; $matcher = $this->getMock('\\Knp\\Menu\\Matcher\\Matcher'); $matcher->expects($this->once())->method('isCurrent')->will($this->returnValue(true)); $this->builder->setMatcher($matcher); $menu->expects($this->exactly(2))->method('addChild'); $menu->expects($this->once())->method('setExtra')->with('type', $type); $menu->expects($this->once())->method('getChildren')->will($this->returnValue($children)); $menu->expects($this->once())->method('removeChild'); $n = rand(1, 10); $configMock = $this->getMockBuilder('Oro\\Bundle\\ConfigBundle\\Config\\UserConfigManager')->disableOriginalConstructor()->getMock(); $configMock->expects($this->once())->method('get')->with($this->equalTo('oro_navigation.maxItems'))->will($this->returnValue($n)); $this->manipulator->expects($this->once())->method('slice')->with($menu, 0, $n); $this->builder->setOptions($configMock); $this->builder->build($menu, [], $type); }
function __construct() { parent::__construct(); epl_log('init', get_class() . " initialized", 1); $this->epl->load_config('global-discount-fields'); $this->ecm = $this->epl->load_model('epl-common-model'); global $epl_fields; $this->fields = $epl_fields; //$this->epl_fields = $this->epl_util->combine_array_keys( $this->fields ); $this->epl_fields = $epl_fields; $post_ID = ''; if (isset($_GET['post'])) { $post_ID = $_GET['post']; } elseif (isset($_POST['post_ID'])) { $post_ID = $_POST['post_ID']; } $this->data['values'] = $this->ecm->get_post_meta_all((int) $post_ID, false, true); $this->edit_mode = epl_get_element('post', $_GET) || epl_get_element('post_ID', $_REQUEST); if (isset($_REQUEST['epl_ajax']) && $_REQUEST['epl_ajax'] == 1) { $this->run(); } else { add_action('default_title', array($this, 'pre')); add_action('add_meta_boxes', array($this, 'epl_add_meta_boxes')); add_action('save_post', array($this, 'save_postdata')); add_filter('manage_edit-' . self::post_type . '_columns', array($this, 'add_new_columns')); add_action('manage_' . self::post_type . '_posts_custom_column', array($this, 'column_data'), 10, 2); } }
public function run() { //TODO: genericise this behaviour $cls_name = explode('\\', get_class($this)); $this->shortName = array_pop($cls_name); if (file_exists(dirname(__FILE__) . '/js/' . $this->shortName . '.js')) { $this->assetFolder = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/js/'); Yii::app()->getClientScript()->registerScriptFile($this->assetFolder . '/' . $this->shortName . '.js'); Yii::app()->getAssetManager()->registerCssFile('css/module.css', 'application.modules.PatientTicketing.assets', 10, \AssetManager::OUTPUT_ALL); } if ($this->ticket) { $this->event_types = $this->ticket->current_queue->getRelatedEventTypes(); $this->ticket_info = $this->ticket->getInfoData(false); $this->current_queue_name = $this->ticket->current_queue->name; $this->outcome_options = array(); $od = $this->ticket->current_queue->getOutcomeData(false); foreach ($od as $out) { $this->outcome_options[$out['id']] = $out['name']; } if (count($od) == 1) { $this->outcome_queue_id = $od[0]['id']; } } $this->render('TicketMove'); }
/** * Append any supported $content to $parent * * @param DOMNode $parent Node to append to * @param mixed $content Content to append * @return self */ protected function XMLAppend(\DOMNode &$parent = null, $content = null) { if (is_null($parent)) { $parent = $this->root; } if (is_string($content) or is_numeric($content) or is_object($content) and method_exists($content, '__toString')) { $parent->appendChild($this->createTextNode("{$content}")); } elseif (is_object($content) and is_subclass_of($content, '\\DOMNode')) { $parent->appendChild($content); } elseif (is_array($content) or is_object($content) and $content = get_object_vars($content)) { array_map(function ($node, $value) use(&$parent) { if (is_string($node)) { if (substr($node, 0, 1) === '@') { $parent->setAttribute(substr($node, 1), $value); } else { $node = $parent->appendChild($this->createElement($node)); if (is_string($value)) { $this->XMLAppend($node, $this->createTextNode($value)); } else { $this->XMLAppend($node, $value); } } } else { $this->XMLAppend($parent, $value); } }, array_keys($content), array_values($content)); } elseif (is_bool($content)) { $parent->appendChild($this->createTextNode($content ? 'true' : 'false')); } else { throw new \InvalidArgumentException(sprintf('Unable to append unknown content [%s] to %s', get_class($content), get_class($this))); } return $this; }
function Create($proto) { if ($this->debug) { e("SAMConnection.Create(proto={$proto})"); } $rc = false; /* search the PHP config for a factory to use... */ $x = get_cfg_var('sam.factory.' . $proto); if ($this->debug) { t('SAMConnection.Create() get_cfg_var() "' . $x . '"'); } /* If there is no configuration (php.ini) entry for this protocol, default it. */ if (strlen($x) == 0) { /* for every protocol other than MQTT assume we will use XMS */ if ($proto != 'mqtt') { $x = 'xms'; } else { $x = 'mqtt'; } } /* Invoke the chosen factory to create a real connection object... */ $x = 'sam_factory_' . $x . '.php'; if ($this->debug) { t("SAMConnection.Create() calling factory - {$x}"); } $rc = (include $x); if ($this->debug && $rc) { t('SAMConnection.Create() rc = ' . get_class($rc)); } if ($this->debug) { x('SAMConnection.Create()'); } return $rc; }
/** * Create the links for resources in the resource root * @return array the links, name => config */ protected function createLinks() { $app = \Yii::app(); /* @var \Restyii\Web\Application $app */ $controller = $this->getController(); $module = $controller->getModule(); if (!$module) { $module = $app; } $controllers = $app->getSchema()->getControllerInstances($module); /* @var \Restyii\Controller\Base[]|\CController[] $controllers */ $links = array('self' => array('title' => $module->name, 'href' => trim($app->getBaseUrl(), '/') . '/')); foreach ($controllers as $id => $controller) { if ($id === $module->defaultController) { continue; } $links[$id] = array('title' => method_exists($controller, 'classLabel') ? $controller->classLabel(true) : String::pluralize(String::humanize(substr(get_class($controller), 0, -10))), 'href' => $controller->createUrl('search')); if (method_exists($controller, 'classDescription')) { $links[$id]['description'] = $controller->classDescription(); } if (isset($controller->modelClass)) { $links[$id]['profile'] = array($controller->modelClass); } } return $links; }
private function createStorage($storageKey, array $storages, $urlResolver, Config $config) { if (!array_key_exists($storageKey, $storages)) { throw new InvalidArgumentException("{$storageKey} is not a valid fineuploader server storage"); } $storage = $storages[$storageKey]; if (!array_key_exists('class', $storage)) { throw new InvalidArgumentException("{$storageKey} does not have a valid storage class"); } $storageConfig = array_key_exists('config', $storage) ? $storage['config'] : []; if (is_array($urlResolver)) { if (!array_key_exists('class', $urlResolver)) { throw new InvalidArgumentException("urlResolver needs a class key"); } $resolverConfig = array_key_exists('config', $urlResolver) ? $urlResolver['config'] : []; $urlResolver = new $urlResolver['class']($resolverConfig); if (!$urlResolver instanceof UrlResolverInterface) { throw new InvalidArgumentException(get_class($urlResolver) . " does not implement " . "Optimus\\Http\\UrlResolverInterface"); } } elseif (!is_callable($urlResolver)) { throw new InvalidArgumentException("Url resolver is not a method."); } $storage = new $storage['class']($storageConfig, $config, $urlResolver); return $storage; }
/** * @param mixed $objects * @param string $as * @param array $configuration * @return string * @throws \UnexpectedValueException */ public function render($objects, $as, array $configuration = array('itemsPerPage' => 10, 'insertAbove' => false, 'insertBelow' => true, 'maximumNumberOfLinks' => 99)) { if (!($objects instanceof QueryResultInterface || $objects instanceof ObjectStorage || is_array($objects))) { throw new \UnexpectedValueException('Supplied file object type ' . get_class($objects) . ' must be QueryResultInterface or ObjectStorage or be an array.', 1454510731); } return $this->initiateSubRequest(); }
function __construct() { parent::__construct(); $this->module=strtolower(get_class()); $this->load->model('Mtintuc'); $this->load->library('pagination'); }
/** * {@inheritdoc} */ public function extract($command) { $className = substr(strrchr(get_class($command), '\\'), 1); return preg_replace_callback('/(^|[a-z])([A-Z])/', function ($s) { return strtolower(strlen($s[1]) ? "{$s['1']}_{$s['2']}" : "{$s['2']}"); }, $className); }
/** * Creates a new validation value for a validation set. * * @param string|IValidator $validator The validator to build be it a class name (fully qualified) * or a dummy validator object. * @param mixed ...$params The parameters to the validator. To use a field from the validated * object, set these as ValidationKey objects. */ public function __construct($validator) { if (is_object($validator)) { if (!$validator instanceof IValidator) { throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator')); } else { $this->validator = get_class($validator); } } elseif (is_string($validator)) { if (!is_subclass_of($validator, 'Flikore\\Validator\\Interfaces\\IValidator')) { throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator')); } else { $this->validator = $validator; } } else { throw new \InvalidArgumentException(Intl\GetText::_d('Flikore.Validator', 'The validator object must be a implementation of IValidator')); } $params = func_get_args(); array_shift($params); foreach ($params as $arg) { if ($arg instanceof ValidationKey) { $this->fields[] = $arg->getKey(); } } $this->args = $params; }
protected function renderEnctype(FormView $view) { if (!method_exists($form = $this->engine->get('form'), 'enctype')) { $this->markTestSkipped(sprintf('Deprecated method %s->enctype() is not implemented.', get_class($form))); } return (string) $form->enctype($view); }
/** * Validate the plugin * * Checks that the Model is an instance of ModelInterface * * @param mixed $plugin * @throws InvalidPluginException * @return void */ public function validatePlugin($plugin) { if ($plugin instanceof ModelInterface) { return; } throw new InvalidPluginException(sprintf('Plugin of type %s is invalid; must implement %s\\Model\\ModelInterface', is_object($plugin) ? get_class($plugin) : gettype($plugin), __NAMESPACE__)); }
function __construct() { parent::__construct(); $this->controller = strtolower(get_class($this)); $this->load->model('Algorithm_quality'); $this->load->model('Implementation'); }
public function remove(Publishing $pub) { if (!$pub instanceof \Trismegiste\Socialist\Picture) { throw new \InvalidArgumentException(get_class($pub) . ' is not a Picture'); } $this->storage->remove($pub->getStorageKey()); }
protected function dumpObject($obj, $hash) { if (isset($this->objectsDepth[$hash])) { if ($this->objectsDepth[$hash] < $this->depth) { $this->refPool[$this->counter]['ref_counter'] = $this->counter; $this->dumpRef(true, $this->counter, $obj, 'object'); return; } else { unset($this->objectsDepth[$hash]); } } $a = (array) $obj; $c = get_class($obj); $p = array($c => $c) + class_parents($obj) + class_implements($obj) + array('*' => '*'); foreach (array_reverse($p) as $p) { if (!empty($this->casters[$p = 'o:' . strtolower($p)])) { foreach ($this->casters[$p] as $p) { try { $a = call_user_func($p, $obj, $a); } catch (\Exception $e) { } } } } $this->walkHash($c, $a, count($a)); }
/** * @param DOMElement $element * @param mixed $data */ protected function buildXml($element, $data) { if (is_object($data)) { $child = new DOMElement(StringHelper::basename(get_class($data))); $element->appendChild($child); if ($data instanceof Arrayable) { $this->buildXml($child, $data->toArray()); } else { $array = []; foreach ($data as $name => $value) { $array[$name] = $value; } $this->buildXml($child, $array); } } elseif (is_array($data)) { foreach ($data as $name => $value) { if (is_int($name) && is_object($value)) { $this->buildXml($element, $value); } elseif (is_array($value) || is_object($value)) { $child = new DOMElement(is_int($name) ? $this->itemTag : $name); $element->appendChild($child); $this->buildXml($child, $value); } else { $child = new DOMElement(is_int($name) ? $this->itemTag : $name); $element->appendChild($child); $child->appendChild(new DOMText((string) $value)); } } } else { $element->appendChild(new DOMText((string) $data)); } }
/** * Checks whether specified environment corresponds the user's environment. * * @param int $envId The ID of the environment * @return boolean Returns true if user's environment equals to specified environment * @throws \Scalr_Exception_Core */ public function hasAccessEnvironment($envId) { if (is_null($this->envId)) { throw new \Scalr_Exception_Core('Identifier of the environment has not been defined for the ' . get_class($this)); } return $envId == $this->envId; }
protected function resetCustomLPDataForUserIds(array $a_user_ids, $a_recursive = true) { /* @var ilObjTest $testOBJ */ require_once 'Services/Object/classes/class.ilObjectFactory.php'; $testOBJ = ilObjectFactory::getInstanceByObjId($this->obj_id); $testOBJ->removeTestResults($a_user_ids); // :TODO: there has to be a better way $test_ref_id = (int) $_REQUEST["ref_id"]; if ($test_ref_id) { require_once "Modules/Course/classes/Objectives/class.ilLOSettings.php"; $course_obj_id = ilLOSettings::isObjectiveTest($test_ref_id); if ($course_obj_id) { // is test initial and/or qualified? $lo_settings = ilLOSettings::getInstanceByObjId($course_obj_id); $is_i = $lo_settings->getInitialTest() == $test_ref_id; $is_q = $lo_settings->getQualifiedTest() == $test_ref_id; // remove objective results data require_once "Modules/Course/classes/Objectives/class.ilLOUserResults.php"; ilLOUserResults::deleteResultsFromLP($course_obj_id, $a_user_ids, $is_i, $is_q); // refresh LP - see ilLPStatusWrapper::_updateStatus() require_once "Services/Tracking/classes/class.ilLPStatusFactory.php"; $lp_status = ilLPStatusFactory::_getInstance($course_obj_id); if (strtolower(get_class($lp_status)) != "illpstatus") { foreach ($a_user_ids as $user_id) { $lp_status->_updateStatus($course_obj_id, $user_id); } } } } }
/** * @param Doctrine\ODM\MongoDB\Document $value * @param Constraint $constraint * @return Boolean */ public function isValid($document, Constraint $constraint) { $class = get_class($document); $dm = $this->getDocumentManager($constraint); $metadata = $dm->getClassMetadata($class); if ($metadata->isEmbeddedDocument) { throw new \InvalidArgumentException(sprintf("Document '%s' is an embedded document, and cannot be validated", $class)); } $query = $this->getQueryArray($metadata, $document, $constraint->path); // check if document exists in mongodb if (null === ($doc = $dm->getRepository($class)->findOneBy($query))) { return true; } // check if document in mongodb is the same document as the checked one if ($doc === $document) { return true; } // check if returned document is proxy and initialize the minimum identifier if needed if ($doc instanceof Proxy) { $metadata->setIdentifierValue($doc, $doc->__identifier); } // check if document has the same identifier as the current one if ($metadata->getIdentifierValue($doc) === $metadata->getIdentifierValue($document)) { return true; } $this->context->setPropertyPath($this->context->getPropertyPath() . '.' . $constraint->path); $this->setMessage($constraint->message, array('{{ property }}' => $constraint->path)); return false; }
private function varToString($var) { if (is_object($var)) { return sprintf('Object(%s)', get_class($var)); } if (is_array($var)) { $a = array(); foreach ($var as $k => $v) { $a[] = sprintf('%s => %s', $k, $this->varToString($v)); } return sprintf("Array(%s)", implode(', ', $a)); } if (is_resource($var)) { return sprintf('Resource(%s)', get_resource_type($var)); } if (null === $var) { return 'null'; } if (false === $var) { return 'false'; } if (true === $var) { return 'true'; } return (string) $var; }
/** * @return void */ protected function updating() { if ($this->frozen) { $class = get_class($this); throw new InvalidStateException("Cannot modify a frozen object {$class}."); } }
/** * Test the getViaUri() and getViaScheme() methods and target functions. */ function testUriFunctions() { $config = $this->config('system.file'); $instance = \Drupal::service('stream_wrapper_manager')->getViaUri($this->scheme . '://foo'); $this->assertEqual($this->classname, get_class($instance), 'Got correct class type for dummy URI.'); $instance = \Drupal::service('stream_wrapper_manager')->getViaUri('public://foo'); $this->assertEqual('Drupal\\Core\\StreamWrapper\\PublicStream', get_class($instance), 'Got correct class type for public URI.'); // Test file_uri_target(). $this->assertEqual(file_uri_target('public://foo/bar.txt'), 'foo/bar.txt', 'Got a valid stream target from public://foo/bar.txt.'); $this->assertEqual(file_uri_target('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='), 'image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==', t('Got a valid stream target from a data URI.')); $this->assertFalse(file_uri_target('foo/bar.txt'), 'foo/bar.txt is not a valid stream.'); $this->assertFalse(file_uri_target('public://'), 'public:// has no target.'); $this->assertFalse(file_uri_target('data:'), 'data: has no target.'); // Test file_build_uri() and // Drupal\Core\StreamWrapper\LocalStream::getDirectoryPath(). $this->assertEqual(file_build_uri('foo/bar.txt'), 'public://foo/bar.txt', 'Expected scheme was added.'); $this->assertEqual(\Drupal::service('stream_wrapper_manager')->getViaScheme('public')->getDirectoryPath(), PublicStream::basePath(), 'Expected default directory path was returned.'); $this->assertEqual(\Drupal::service('stream_wrapper_manager')->getViaScheme('temporary')->getDirectoryPath(), $config->get('path.temporary'), 'Expected temporary directory path was returned.'); $config->set('default_scheme', 'private')->save(); $this->assertEqual(file_build_uri('foo/bar.txt'), 'private://foo/bar.txt', 'Got a valid URI from foo/bar.txt.'); // Test file_create_url() // TemporaryStream::getExternalUrl() uses Url::fromRoute(), which needs // route information to work. $this->container->get('router.builder')->rebuild(); $this->assertTrue(strpos(file_create_url('temporary://test.txt'), 'system/temporary?file=test.txt'), 'Temporary external URL correctly built.'); $this->assertTrue(strpos(file_create_url('public://test.txt'), Settings::get('file_public_path') . '/test.txt'), 'Public external URL correctly built.'); $this->assertTrue(strpos(file_create_url('private://test.txt'), 'system/files/test.txt'), 'Private external URL correctly built.'); }
/** * @param \stdClass $object */ function it_wraps_non_token_arguments_into_ExactValueToken($object) { $this->beConstructedWith(array(42, 'zet', $object)); $class = get_class($object->getWrappedObject()); $hash = spl_object_hash($object->getWrappedObject()); $this->__toString()->shouldReturn("exact(42), exact(\"zet\"), exact({$class}:{$hash} Object (\n 'objectProphecy' => Prophecy\\Prophecy\\ObjectProphecy Object (*Prophecy*)\n))"); }
public static function cmpSignature($a, $b) { $aArgs = []; $bArgs = []; foreach ($a->symTable->symbols as $symbol) { if (is_a($symbol, 'vendor\\SemanticParser\\Nodes\\SymArg')) { $aArgs[$symbol->index] = $symbol->type; } } foreach ($b->symTable->symbols as $symbol) { if (is_a($symbol, 'vendor\\SemanticParser\\Nodes\\SymArg')) { $bArgs[$symbol->index] = $symbol->type; } } if (count($aArgs) != count($bArgs)) { return false; } for ($i = 0; $i < count($aArgs); $i++) { $class = get_class($aArgs[$i]); if (!$class::equal($aArgs[$i], $bArgs[$i])) { return false; } } return true; }
public function __construct(array $collaborators) { foreach ($collaborators as $object) { $className = get_class($object); $this->_collaborators[$className] = $object; } }
protected function getValidatorFromClass($class) { $className = get_class($class); $validatorClassName = app()['config']['laracruds']['validators-path'] . '\\' . explode("\\", $className)[1] . app()['config']['laracruds']['validators-sufix']; $validatorClass = new $validatorClassName($class); return $validatorClass; }
/** * Generic getter/setter * * @param string $name Name of property * @param array $args Function arguments * * @throws \Exception * * @return void */ public function __call($name, $args = array()) { // This call method is only for accessors if (strlen($name) > 3) { // Get the property $property = substr($name, 3, strlen($name)); // All properties will be camelcase, make first, letter lowercase $property[0] = strtolower($property[0]); // Accessor method $accessor = substr($name, 0, 3); // Only run code for setters and getters if (in_array($accessor, array('set', 'get'))) { // Check if property is publically accessible if (property_exists($this, $property)) { // Only allow protected variables to be accessed $reflector = new \ReflectionClass(get_class($this)); $prop = $reflector->getProperty($property); if ($prop->isPrivate()) { throw new \Exception(sprintf('Unable to %s, property is private: %s:%s', $accessor, __CLASS__, $property)); } } else { throw new \Exception('Unknown method called: ' . __CLASS__ . ':' . $name); } switch ($accessor) { case 'set': $this->{$property} = $args[0]; return $this; case 'get': return $this->{$property}; } } } }
public function testSchedule() { $testIntegrationType = 'testIntegrationType'; $testConnectorType = 'testConnectorType'; $testId = 22; $integration = new Integration(); $integration->setType($testIntegrationType); $integration->setEnabled(true); $ref = new \ReflectionProperty(get_class($integration), 'id'); $ref->setAccessible(true); $ref->setValue($integration, $testId); $this->typesRegistry->addChannelType($testIntegrationType, new TestIntegrationType()); $this->typesRegistry->addConnectorType($testConnectorType, $testIntegrationType, new TestTwoWayConnector()); $that = $this; $uow = $this->getMockBuilder('Doctrine\\ORM\\UnitOfWork')->disableOriginalConstructor()->getMock(); $this->em->expects($this->once())->method('getUnitOfWork')->will($this->returnValue($uow)); $metadataFactory = $this->getMockBuilder('Doctrine\\ORM\\Mapping\\ClassMetadataFactory')->disableOriginalConstructor()->getMock(); $metadataFactory->expects($this->once())->method('getMetadataFor')->will($this->returnValue(new ClassMetadata('testEntity'))); $this->em->expects($this->once())->method('getMetadataFactory')->will($this->returnValue($metadataFactory)); $uow->expects($this->once())->method('persist')->with($this->isInstanceOf('JMS\\JobQueueBundle\\Entity\\Job'))->will($this->returnCallback(function (Job $job) use($that, $testId, $testConnectorType) { $expectedArgs = ['--integration=' . $testId, sprintf('--connector=testConnectorType', $testConnectorType), '--params=a:0:{}']; $that->assertEquals($expectedArgs, $job->getArgs()); })); $uow->expects($this->once())->method('computeChangeSet'); $this->scheduler->schedule($integration, $testConnectorType, [], false); }
public static function boot() { parent::boot(); static::creating(function ($model) { $model->effectivefrom = date('Y-m-d', strtotime($model->effectivefrom)); $model->effectiveto = date('Y-m-d', strtotime($model->effectiveto)); $model->createdby = Auth::user()->id; $model->createddate = date("Y-m-d H:i:s"); $model->modifiedby = Auth::user()->id; $model->modifieddate = date("Y-m-d H:i:s"); }); static::created(function ($model) { Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Add', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]); }); static::updating(function ($model) { $model->effectivefrom = date('Y-m-d', strtotime($model->effectivefrom)); $model->effectiveto = date('Y-m-d', strtotime($model->effectiveto)); $model->modifiedby = Auth::user()->id; $model->modifieddate = date("Y-m-d H:i:s"); }); static::updated(function ($model) { Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Update', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]); }); static::deleted(function ($model) { Log::create(['employeeid' => Auth::user()->id, 'operation' => 'Delete', 'date' => date("Y-m-d H:i:s"), 'model' => class_basename(get_class($model)), 'detail' => $model->toJson()]); }); }