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


PHP ModuleHandlerInterface::expects方法代码示例

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


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

示例1: testGetDefinitions

 /**
  * @covers ::getDefinitions
  */
 public function testGetDefinitions()
 {
     $definitions = array('foo' => array('label' => $this->randomMachineName()));
     $this->discovery->expects($this->once())->method('getDefinitions')->willReturn($definitions);
     $this->moduleHandler->expects($this->once())->method('alter')->with('payment_line_item');
     $this->assertSame($definitions, $this->sut->getDefinitions());
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:10,代码来源:PaymentLineItemManagerTest.php

示例2: testGetRegistryForModule

 /**
  * Tests getting the theme registry defined by a module.
  */
 public function testGetRegistryForModule()
 {
     $this->setupTheme('test_theme');
     $this->registry->setTheme(new ActiveTheme(['name' => 'test_theme', 'path' => 'core/modules/system/tests/themes/test_theme/test_theme.info.yml', 'engine' => 'twig', 'owner' => 'twig', 'stylesheets_remove' => [], 'stylesheets_override' => [], 'libraries' => [], 'extension' => '.twig', 'base_themes' => []]));
     // Include the module so that hook_theme can be called.
     include_once $this->root . '/core/modules/system/tests/modules/theme_test/theme_test.module';
     $this->moduleHandler->expects($this->once())->method('getImplementations')->with('theme')->will($this->returnValue(array('theme_test')));
     $registry = $this->registry->get();
     // Ensure that the registry entries from the module are found.
     $this->assertArrayHasKey('theme_test', $registry);
     $this->assertArrayHasKey('theme_test_template_test', $registry);
     $this->assertArrayHasKey('theme_test_template_test_2', $registry);
     $this->assertArrayHasKey('theme_test_suggestion_provided', $registry);
     $this->assertArrayHasKey('theme_test_specific_suggestions', $registry);
     $this->assertArrayHasKey('theme_test_suggestions', $registry);
     $this->assertArrayHasKey('theme_test_function_suggestions', $registry);
     $this->assertArrayHasKey('theme_test_foo', $registry);
     $this->assertArrayHasKey('theme_test_render_element', $registry);
     $this->assertArrayHasKey('theme_test_render_element_children', $registry);
     $this->assertArrayHasKey('theme_test_function_template_override', $registry);
     $this->assertArrayNotHasKey('test_theme_not_existing_function', $registry);
     $info = $registry['theme_test_function_suggestions'];
     $this->assertEquals('module', $info['type']);
     $this->assertEquals('core/modules/system/tests/modules/theme_test', $info['theme path']);
     $this->assertEquals('theme_theme_test_function_suggestions', $info['function']);
     $this->assertEquals(array(), $info['variables']);
 }
开发者ID:nstielau,项目名称:drops-8,代码行数:30,代码来源:RegistryTest.php

示例3: setUp

 /**
  * {@inheritdoc}
  */
 protected function setUp()
 {
     // Create a config mock which does not mock the clear(), set() and get() methods.
     $methods = get_class_methods('Drupal\\Core\\Config\\Config');
     unset($methods[array_search('set', $methods)]);
     unset($methods[array_search('get', $methods)]);
     unset($methods[array_search('clear', $methods)]);
     $config_mock = $this->getMockBuilder('Drupal\\Core\\Config\\Config')->disableOriginalConstructor()->setMethods($methods)->getMock();
     // Create the config factory we use in the submitForm() function.
     $this->configFactory = $this->getMock('Drupal\\Core\\Config\\ConfigFactoryInterface');
     $this->configFactory->expects($this->any())->method('getEditable')->will($this->returnValue($config_mock));
     // Create a MailsystemManager mock.
     $this->mailManager = $this->getMock('\\Drupal\\mailsystem\\MailsystemManager', array(), array(), '', FALSE);
     $this->mailManager->expects($this->any())->method('getDefinition')->will($this->returnValueMap(array(array('mailsystem_test', TRUE, array('label' => 'Test Mail-Plugin')), array('mailsystem_demo', TRUE, array('label' => 'Demo Mail-Plugin')))));
     $this->mailManager->expects($this->any())->method('getDefinitions')->will($this->returnValue(array(array('id' => 'mailsystem_test', 'label' => 'Test Mail-Plugin'), array('id' => 'mailsystem_demo', 'label' => 'Demo Mail-Plugin'))));
     // Create a module handler mock.
     $this->moduleHandler = $this->getMock('\\Drupal\\Core\\Extension\\ModuleHandlerInterface');
     $this->moduleHandler->expects($this->any())->method('getImplementations')->with('mail')->will($this->returnValue(array('mailsystem_test', 'mailsystem_demo')));
     $this->moduleHandler->expects($this->any())->method('moduleExists')->withAnyParameters()->will($this->returnValue(FALSE));
     // Create a theme handler mock.
     $this->themeHandler = $this->getMock('\\Drupal\\Core\\Extension\\ThemeHandlerInterface');
     $this->themeHandler->expects($this->any())->method('listInfo')->will($this->returnValue(array('test_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name')), 'demo_theme' => (object) array('status' => 1, 'info' => array('name' => 'test theme name demo')), 'inactive_theme' => (object) array('status' => 0, 'info' => array('name' => 'inactive test theme')))));
     // Inject a language-manager into \Drupal.
     $this->languageManager = $this->getMock('\\Drupal\\Core\\StringTranslation\\TranslationInterface');
     $this->languageManager->expects($this->any())->method('translate')->withAnyParameters()->will($this->returnArgument(0));
     $container = new ContainerBuilder();
     $container->set('string_translation', $this->languageManager);
     \Drupal::setContainer($container);
 }
开发者ID:augustpascual-mse,项目名称:job-searching-network,代码行数:32,代码来源:AdminFormTest.php

示例4: testGetOperations

 /**
  * @covers ::getOperations
  */
 public function testGetOperations()
 {
     $operation_name = $this->randomMachineName();
     $operations = array($operation_name => array('title' => $this->randomMachineName()));
     $this->moduleHandler->expects($this->once())->method('invokeAll')->with('entity_operation', array($this->role))->will($this->returnValue($operations));
     $this->moduleHandler->expects($this->once())->method('alter')->with('entity_operation');
     $this->container->set('module_handler', $this->moduleHandler);
     $this->role->expects($this->any())->method('access')->will($this->returnValue(AccessResult::allowed()));
     $this->role->expects($this->any())->method('hasLinkTemplate')->will($this->returnValue(TRUE));
     $url = $this->getMockBuilder('\\Drupal\\Core\\Url')->disableOriginalConstructor()->getMock();
     $url->expects($this->any())->method('toArray')->will($this->returnValue(array()));
     $this->role->expects($this->any())->method('urlInfo')->will($this->returnValue($url));
     $list = new EntityListBuilder($this->entityType, $this->roleStorage, $this->moduleHandler);
     $list->setStringTranslation($this->translationManager);
     $operations = $list->getOperations($this->role);
     $this->assertInternalType('array', $operations);
     $this->assertArrayHasKey('edit', $operations);
     $this->assertInternalType('array', $operations['edit']);
     $this->assertArrayHasKey('title', $operations['edit']);
     $this->assertArrayHasKey('delete', $operations);
     $this->assertInternalType('array', $operations['delete']);
     $this->assertArrayHasKey('title', $operations['delete']);
     $this->assertArrayHasKey($operation_name, $operations);
     $this->assertInternalType('array', $operations[$operation_name]);
     $this->assertArrayHasKey('title', $operations[$operation_name]);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:29,代码来源:EntityListBuilderTest.php

示例5: testGetInfoElementPlugin

 /**
  * Tests the getInfo() method when render element plugins are used.
  *
  * @covers ::getInfo
  * @covers ::buildInfo
  *
  * @dataProvider providerTestGetInfoElementPlugin
  */
 public function testGetInfoElementPlugin($plugin_class, $expected_info)
 {
     $this->moduleHandler->expects($this->once())->method('alter')->with('element_info', $this->anything())->will($this->returnArgument(0));
     $plugin = $this->getMock($plugin_class);
     $plugin->expects($this->once())->method('getInfo')->willReturn(array('#theme' => 'page'));
     $element_info = $this->getMockBuilder('Drupal\\Core\\Render\\ElementInfoManager')->setConstructorArgs(array(new \ArrayObject(), $this->cache, $this->cacheTagsInvalidator, $this->moduleHandler, $this->themeManager))->setMethods(array('getDefinitions', 'createInstance'))->getMock();
     $this->themeManager->expects($this->any())->method('getActiveTheme')->willReturn(new ActiveTheme(['name' => 'test']));
     $element_info->expects($this->once())->method('createInstance')->with('page')->willReturn($plugin);
     $element_info->expects($this->once())->method('getDefinitions')->willReturn(array('page' => array('class' => 'TestElementPlugin')));
     $this->assertEquals($expected_info, $element_info->getInfo('page'));
 }
开发者ID:sgtsaughter,项目名称:d8portfolio,代码行数:19,代码来源:ElementInfoManagerTest.php

示例6: setUp

 /**
  * {@inheritdoc}
  */
 public function setUp()
 {
     $cache_context_manager = $this->getMockBuilder(CacheContextsManager::class)->disableOriginalConstructor()->getMock();
     $cache_context_manager->expects($this->any())->method('assertValidTokens')->willReturn(TRUE);
     $container = new Container();
     $container->set('cache_contexts_manager', $cache_context_manager);
     \Drupal::setContainer($container);
     $entity_type = $this->getMock(EntityTypeInterface::class);
     $this->moduleHandler = $this->getMock(ModuleHandlerInterface::class);
     $this->moduleHandler->expects($this->any())->method('invokeAll')->willReturn([]);
     $this->sut = new PaymentMethodConfigurationAccessControlHandler($entity_type, $this->moduleHandler);
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:15,代码来源:PaymentMethodConfigurationAccessControlHandlerTest.php

示例7: testGetLibrariesByExtension

 /**
  * @covers ::getLibrariesByExtension
  */
 public function testGetLibrariesByExtension()
 {
     $this->libraryDiscoveryCollector->expects($this->once())->method('get')->with('test')->willReturn($this->libraryData);
     $this->moduleHandler->expects($this->exactly(2))->method('alter')->with('library', $this->logicalOr($this->libraryData['test_1'], $this->libraryData['test_2']), $this->logicalOr('test/test_1', 'test/test_2'));
     $this->libraryDiscovery->getLibrariesbyExtension('test');
     // Verify that subsequent calls don't trigger hook_library_info_alter()
     // and hook_js_settings_alter() invocations, nor do they talk to the
     // collector again. This ensures that the alterations made by
     // hook_library_info_alter() and hook_js_settings_alter() implementations
     // are statically cached, as desired.
     $this->libraryDiscovery->getLibraryByName('test', 'test_1');
     $this->libraryDiscovery->getLibrariesbyExtension('test');
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:16,代码来源:LibraryDiscoveryTest.php

示例8: testCommentLinkBuilder

 /**
  * Test the buildCommentedEntityLinks method.
  *
  * @param \Drupal\node\NodeInterface|\PHPUnit_Framework_MockObject_MockObject $node
  *   Mock node.
  * @param array $context
  *   Context for the links.
  * @param bool $has_access_comments
  *   TRUE if the user has 'access comments' permission.
  * @param bool $history_exists
  *   TRUE if the history module exists.
  * @param bool $has_post_comments
  *   TRUE if the use has 'post comments' permission.
  * @param bool $is_anonymous
  *   TRUE if the user is anonymous.
  * @param array $expected
  *   Array of expected links keyed by link ID. Can be either string (link
  *   title) or array of link properties.
  *
  * @dataProvider getLinkCombinations
  *
  * @covers ::buildCommentedEntityLinks
  */
 public function testCommentLinkBuilder(NodeInterface $node, $context, $has_access_comments, $history_exists, $has_post_comments, $is_anonymous, $expected)
 {
     $this->moduleHandler->expects($this->any())->method('moduleExists')->with('history')->willReturn($history_exists);
     $this->currentUser->expects($this->any())->method('hasPermission')->willReturnMap(array(array('access comments', $has_access_comments), array('post comments', $has_post_comments)));
     $this->currentUser->expects($this->any())->method('isAuthenticated')->willReturn(!$is_anonymous);
     $this->currentUser->expects($this->any())->method('isAnonymous')->willReturn($is_anonymous);
     $links = $this->commentLinkBuilder->buildCommentedEntityLinks($node, $context);
     if (!empty($expected)) {
         if (!empty($links)) {
             foreach ($expected as $link => $detail) {
                 if (is_array($detail)) {
                     // Array of link attributes.
                     foreach ($detail as $key => $value) {
                         $this->assertEquals($value, $links['comment__comment']['#links'][$link][$key]);
                     }
                 } else {
                     // Just the title.
                     $this->assertEquals($detail, $links['comment__comment']['#links'][$link]['title']);
                 }
             }
         } else {
             $this->fail('Expected links but found none.');
         }
     } else {
         $this->assertSame($links, $expected);
     }
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:50,代码来源:CommentLinkBuilderTest.php

示例9: testGetFieldMap

 /**
  * @covers ::getFieldMap
  */
 public function testGetFieldMap()
 {
     // Set up a content entity type.
     $entity_type = $this->getMock('Drupal\\Core\\Entity\\ContentEntityTypeInterface');
     $entity = $this->getMockBuilder('Drupal\\Tests\\Core\\Entity\\EntityManagerTestEntity')->disableOriginalConstructor()->getMockForAbstractClass();
     $entity_class = get_class($entity);
     $entity_type->expects($this->any())->method('getClass')->will($this->returnValue($entity_class));
     $entity_type->expects($this->any())->method('getKeys')->will($this->returnValue(array()));
     $entity_type->expects($this->any())->method('id')->will($this->returnValue('test_entity_type'));
     $entity_type->expects($this->any())->method('isSubclassOf')->with('\\Drupal\\Core\\Entity\\ContentEntityInterface')->will($this->returnValue(TRUE));
     // Set up the module handler to return two bundles for the fieldable entity
     // type.
     $this->moduleHandler = $this->getMock('Drupal\\Core\\Extension\\ModuleHandlerInterface');
     $this->moduleHandler->expects($this->any())->method('alter');
     $this->moduleHandler->expects($this->any())->method('getImplementations')->will($this->returnValue(array()));
     $module_implements_value_map = array(array('entity_bundle_info', array(), array('test_entity_type' => array('first_bundle' => array(), 'second_bundle' => array()))));
     $this->moduleHandler->expects($this->any())->method('invokeAll')->will($this->returnValueMap($module_implements_value_map));
     // Define an ID field definition as a base field.
     $id_definition = $this->getMockBuilder('Drupal\\Core\\Field\\FieldDefinition')->disableOriginalConstructor()->getMock();
     $id_definition->expects($this->exactly(2))->method('getType')->will($this->returnValue('integer'));
     $base_field_definitions = array('id' => $id_definition);
     $entity_class::$baseFieldDefinitions = $base_field_definitions;
     // Set up a by bundle field definition that only exists on one bundle.
     $bundle_definition = $this->getMockBuilder('Drupal\\Core\\Field\\FieldDefinition')->disableOriginalConstructor()->getMock();
     $bundle_definition->expects($this->once())->method('getType')->will($this->returnValue('string'));
     $entity_class::$bundleFieldDefinitions = array('test_entity_type' => array('first_bundle' => array(), 'second_bundle' => array('by_bundle' => $bundle_definition)));
     // Set up a non-content entity type.
     $non_content_entity_type = $this->getMock('Drupal\\Core\\Entity\\EntityTypeInterface');
     $entity_type->expects($this->any())->method('isSubclassOf')->with('\\Drupal\\Core\\Entity\\ContentEntityInterface')->will($this->returnValue(FALSE));
     $this->setUpEntityManager(array('test_entity_type' => $entity_type, 'non_fieldable' => $non_content_entity_type));
     $expected = array('test_entity_type' => array('id' => array('type' => 'integer', 'bundles' => array('first_bundle', 'second_bundle')), 'by_bundle' => array('type' => 'string', 'bundles' => array('second_bundle'))));
     $this->assertEquals($expected, $this->entityManager->getFieldMap());
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:36,代码来源:EntityManagerTest.php

示例10: testBuildWithOneNotApplyingBuilders

  /**
   * Tests multiple breadcrumb builders of which one returns NULL.
   */
  public function testBuildWithOneNotApplyingBuilders() {
    $builder1 = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
    $builder1->expects($this->once())
      ->method('applies')
      ->will($this->returnValue(FALSE));
    $builder1->expects($this->never())
      ->method('build');

    $builder2 = $this->getMock('Drupal\Core\Breadcrumb\BreadcrumbBuilderInterface');
    $links2 = ['<a href="/example2">Test2</a>'];
    $this->breadcrumb->setLinks($links2);
    $this->breadcrumb->addCacheContexts(['baz'])->addCacheTags(['qux']);
    $builder2->expects($this->once())
      ->method('applies')
      ->will($this->returnValue(TRUE));
    $builder2->expects($this->once())
      ->method('build')
      ->willReturn($this->breadcrumb);

    $route_match = $this->getMock('Drupal\Core\Routing\RouteMatchInterface');

    $this->moduleHandler->expects($this->once())
      ->method('alter')
      ->with('system_breadcrumb', $this->breadcrumb, $route_match, array('builder' => $builder2));

    $this->breadcrumbManager->addBuilder($builder1, 10);
    $this->breadcrumbManager->addBuilder($builder2, 0);

    $breadcrumb = $this->breadcrumbManager->build($route_match);
    $this->assertEquals($links2, $breadcrumb->getLinks());
    $this->assertEquals(['baz'], $breadcrumb->getCacheContexts());
    $this->assertEquals(['qux'], $breadcrumb->getCacheTags());
    $this->assertEquals(Cache::PERMANENT, $breadcrumb->getCacheMaxAge());
  }
开发者ID:komejo,项目名称:article-test,代码行数:37,代码来源:BreadcrumbManagerTest.php

示例11: testInitPackageWithExistingPackage

    public function testInitPackageWithExistingPackage()
    {
        $bundle = new FeaturesBundle(['machine_name' => 'default'], 'features_bundle');
        $features_manager = new TestFeaturesManager('vfs://drupal', $this->entityManager, $this->configFactory, $this->configStorage, $this->configManager, $this->moduleHandler);
        vfsStream::setup('drupal');
        \Drupal::getContainer()->set('app.root', 'vfs://drupal');
        vfsStream::create(['modules' => ['test_feature' => ['test_feature.info.yml' => <<<EOT
name: Test feature 2
type: module
core: 8.x
description: test description 2
EOT
, 'test_feature.features.yml' => <<<EOT
true
EOT
]]]);
        $extension = new Extension('vfs://drupal', 'module', 'modules/test_feature/test_feature.info.yml');
        $features_manager->setAllModules(['test_feature' => $extension]);
        $this->moduleHandler->expects($this->any())->method('exists')->with('test_feature')->willReturn(TRUE);
        $info_parser = new InfoParser();
        \Drupal::getContainer()->set('info_parser', $info_parser);
        $package = $features_manager->initPackage('test_feature', 'test name', 'test description', 'module', $bundle);
        $this->assertInstanceOf(Package::class, $package);
        $this->assertEquals(TRUE, $package->getFeaturesInfo());
    }
开发者ID:dropdog,项目名称:play,代码行数:25,代码来源:FeaturesManagerTest.php

示例12: testPluginDefinitionAlter

 /**
  * Tests the plugins alter hook.
  */
 public function testPluginDefinitionAlter()
 {
     $definitions['test_plugin'] = array('id' => 'test_plugin', 'class' => '\\Drupal\\Core\\Menu\\ContextualLinkDefault', 'title' => 'Plugin', 'weight' => 2, 'group' => 'group1', 'route_name' => 'test_route', 'options' => array('key' => 'value'));
     $this->pluginDiscovery->expects($this->once())->method('getDefinitions')->will($this->returnValue($definitions));
     $this->moduleHandler->expects($this->once())->method('alter')->with('contextual_links_plugins', $definitions);
     $this->contextualLinkManager->getDefinition('test_plugin');
 }
开发者ID:sarahwillem,项目名称:OD8,代码行数:10,代码来源:ContextualLinkManagerTest.php

示例13: testRebuildThemeDataWithThemeParents

 /**
  * Tests rebuild the theme data with theme parents.
  */
 public function testRebuildThemeDataWithThemeParents()
 {
     $this->extensionDiscovery->expects($this->at(0))->method('scan')->with('theme')->will($this->returnValue(array('test_subtheme' => new Extension($this->root, 'theme', $this->root . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml', 'test_subtheme.info.yml'), 'test_basetheme' => new Extension($this->root, 'theme', $this->root . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml', 'test_basetheme.info.yml'))));
     $this->extensionDiscovery->expects($this->at(1))->method('scan')->with('theme_engine')->will($this->returnValue(array('twig' => new Extension($this->root, 'theme_engine', $this->root . '/core/themes/engines/twig/twig.info.yml', 'twig.engine'))));
     $this->infoParser->expects($this->at(0))->method('parse')->with($this->root . '/core/modules/system/tests/themes/test_subtheme/test_subtheme.info.yml')->will($this->returnCallback(function ($file) {
         $info_parser = new InfoParser();
         return $info_parser->parse($file);
     }));
     $this->infoParser->expects($this->at(1))->method('parse')->with($this->root . '/core/modules/system/tests/themes/test_basetheme/test_basetheme.info.yml')->will($this->returnCallback(function ($file) {
         $info_parser = new InfoParser();
         return $info_parser->parse($file);
     }));
     $this->moduleHandler->expects($this->once())->method('buildModuleDependencies')->will($this->returnArgument(0));
     $theme_data = $this->themeHandler->rebuildThemeData();
     $this->assertCount(2, $theme_data);
     $info_basetheme = $theme_data['test_basetheme'];
     $info_subtheme = $theme_data['test_subtheme'];
     // Ensure some basic properties.
     $this->assertInstanceOf('Drupal\\Core\\Extension\\Extension', $info_basetheme);
     $this->assertEquals('test_basetheme', $info_basetheme->getName());
     $this->assertInstanceOf('Drupal\\Core\\Extension\\Extension', $info_subtheme);
     $this->assertEquals('test_subtheme', $info_subtheme->getName());
     // Test the parent/child-theme properties.
     $info_subtheme->info['base theme'] = 'test_basetheme';
     $info_basetheme->sub_themes = array('test_subtheme');
     $this->assertEquals($this->root . '/core/themes/engines/twig/twig.engine', $info_basetheme->owner);
     $this->assertEquals('twig', $info_basetheme->prefix);
     $this->assertEquals($this->root . '/core/themes/engines/twig/twig.engine', $info_subtheme->owner);
     $this->assertEquals('twig', $info_subtheme->prefix);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:33,代码来源:ThemeHandlerTest.php

示例14: testBuildRow

 /**
  * @covers ::buildRow
  *
  * @dataProvider providerTestBuildRow
  *
  * @depends testBuildOperations
  */
 function testBuildRow($payment_currency_exists)
 {
     $payment_changed_time = time();
     $payment_changed_time_formatted = $this->randomMachineName();
     $payment_currency_code = $this->randomMachineName();
     $payment_amount = mt_rand();
     $payment_amount_formatted = $this->randomMachineName();
     $payment_status_definition = array('label' => $this->randomMachineName());
     $payment_status = $this->getMock(PaymentStatusInterface::class);
     $payment_status->expects($this->any())->method('getPluginDefinition')->willReturn($payment_status_definition);
     $owner = $this->getMock(UserInterface::class);
     $payment_method_label = $this->randomMachineName();
     $payment_method_definition = ['label' => $payment_method_label];
     $payment_method = $this->getMock(PaymentMethodInterface::class);
     $payment_method->expects($this->atLeastOnce())->method('getPluginDefinition')->willReturn($payment_method_definition);
     $payment = $this->getMock(PaymentInterface::class);
     $payment->expects($this->any())->method('getAmount')->willReturn($payment_amount);
     $payment->expects($this->any())->method('getChangedTime')->willReturn($payment_changed_time);
     $payment->expects($this->any())->method('getCurrencyCode')->willReturn($payment_currency_code);
     $payment->expects($this->any())->method('getOwner')->willReturn($owner);
     $payment->expects($this->any())->method('getPaymentMethod')->willReturn($payment_method);
     $payment->expects($this->any())->method('getPaymentStatus')->willReturn($payment_status);
     $currency = $this->getMock(CurrencyInterface::class);
     $currency->expects($this->once())->method('formatAmount')->with($payment_amount)->willReturn($payment_amount_formatted);
     $map = array(array($payment_currency_code, $payment_currency_exists ? $currency : NULL), array('XXX', $payment_currency_exists ? NULL : $currency));
     $this->currencyStorage->expects($this->atLeastOnce())->method('load')->willReturnMap($map);
     $this->dateFormatter->expects($this->once())->method('format')->with($payment_changed_time)->willReturn($payment_changed_time_formatted);
     $this->moduleHandler->expects($this->any())->method('invokeAll')->willReturn([]);
     $build = $this->sut->buildRow($payment);
     unset($build['data']['operations']['data']['#attached']);
     $expected_build = array('data' => array('updated' => $payment_changed_time_formatted, 'status' => $payment_status_definition['label'], 'amount' => $payment_amount_formatted, 'payment_method' => $payment_method_label, 'owner' => array('data' => array('#theme' => 'username', '#account' => $owner)), 'operations' => array('data' => array('#type' => 'operations', '#links' => []))));
     $this->assertSame($expected_build, $build);
 }
开发者ID:nishantkumar155,项目名称:drupal8.crackle,代码行数:40,代码来源:PaymentListBuilderTest.php

示例15: testDeleteNothing

 /**
  * @covers ::delete
  * @covers ::doDelete
  */
 public function testDeleteNothing()
 {
     $this->moduleHandler->expects($this->never())->method($this->anything());
     $this->configFactory->expects($this->never())->method('get');
     $this->cacheTagsInvalidator->expects($this->never())->method('invalidateTags');
     $this->entityStorage->delete(array());
 }
开发者ID:318io,项目名称:318-io,代码行数:11,代码来源:ConfigEntityStorageTest.php


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