setMockClassName example


    protected function getBundle($dir = null, $parent = null, $className = null, $bundleName = null): BundleInterface
    {
        $bundle = $this
            ->getMockBuilder(BundleInterface::class)
            ->onlyMethods(['getPath', 'getName'])
            ->disableOriginalConstructor()
        ;

        if ($className) {
            $bundle->setMockClassName($className);
        }

        $bundle = $bundle->getMockForAbstractClass();

        $bundle
            ->expects($this->any())
            ->method('getName')
            ->willReturn($bundleName ?? $bundle::class)
        ;

        $bundle
            
$data[] = ["IS NOT NULL) UNION ALL SELECT name FROM {TEST_UPPERCASE} -- "];
    $data[] = ["= 1 UNION ALL SELECT password FROM user WHERE uid ="];

    return $data;
  }

  /** * Tests that the core Condition can be overridden. */
  public function testContribCondition() {
    $mockCondition = $this->getMockBuilder(Condition::class)
      ->setMockClassName('MockCondition')
      ->setConstructorArgs([NULL])
      ->disableOriginalConstructor()
      ->getMock();
    $contrib_namespace = 'Drupal\mock\Driver\Database\mock';
    $mocked_namespace = $contrib_namespace . '\\Condition';
    class_alias('MockCondition', $mocked_namespace);

    $options['namespace'] = $contrib_namespace;
    $options['prefix'] = '';

    $mockPdo = $this->createMock(StubPDO::class);

    


  /** * Tests \Drupal\Core\ParamConverter\ParamConverterManager::getConverter(). * * @dataProvider providerTestGetConverter * * @covers ::getConverter */
  public function testGetConverter($name$class) {
    $converter = $this->getMockBuilder('Drupal\Core\ParamConverter\ParamConverterInterface')
      ->setMockClassName($class)
      ->getMock();

    $this->manager->addConverter($converter$name);

    $this->assertInstanceOf($class$this->manager->getConverter($name));
    // Assert that a second call to getConverter() does not use the container.     $this->assertInstanceOf($class$this->manager->getConverter($name));
  }

  /** * Tests \Drupal\Core\ParamConverter\ParamConverterManager::getConverter(). * * @covers ::getConverter */
Home | Imprint | This part of the site doesn't use cookies.