setupMockedModuleHandler example

->method('invokeAllWith')
      ->with('views_data')
      ->willReturnCallback(function Dstring $hook, callable $callback) {
        $callback(\Closure::fromCallable([$this, 'viewsData']), 'views_test_data');
      });
  }

  /** * Tests the fetchBaseTables() method. */
  public function testFetchBaseTables() {
    $this->setupMockedModuleHandler();
    $data = $this->viewsData->getAll();

    $base_tables = $this->viewsData->fetchBaseTables();

    // Ensure that 'provider' is set for each base table.     foreach (array_keys($base_tables) as $base_table) {
      $this->assertEquals('views_test_data', $data[$base_table]['table']['provider']);
    }

    // Test the number of tables returned and their order.     $this->assertCount(6, $base_tables, 'The correct amount of base tables were returned.');
    
Home | Imprint | This part of the site doesn't use cookies.