AngularJS和QUnit:未知提供者:LocalDataProvider< - LocalData< - FileLogger

时间:2017-05-09 06:31:18

标签: angularjs unit-testing qunit

有谁可以帮我解决这个问题?我是单元测试脚本的初学者。

这是我的HTML代码。

$query = "SELECT Name, CountryCode FROM City ORDER by ID LIMIT 3";
$result = $mysqli->query($query);

/* numeric array */
$row = $result->fetch_array(MYSQLI_NUM);
printf ("%s (%s)\n", $row[0], $row[1]);

/* associative array */
$row = $result->fetch_array(MYSQLI_ASSOC);
printf ("%s (%s)\n", $row["Name"], $row["CountryCode"]);

/* associative and numeric array */
$row = $result->fetch_array(MYSQLI_BOTH);
printf ("%s (%s)\n", $row[0], $row["CountryCode"]);

/* free result set */
$result->free();

这是qunit js。

<html>
   <head>
      <meta charset = "utf-8">
      <title>QUnit and AngularJS</title>
      <link rel = "stylesheet" href = "https://code.jquery.com/qunit/qunit-1.22.0.css">
  <script src = "https://code.angularjs.org/1.1.0/angular.js"></script>
  <script src = "https://code.angularjs.org/1.1.0/angular-mocks.js"></script>
  <script src = "https://code.jquery.com/qunit/qunit-1.22.0.js"></script>
  <script src = "OfflineStorage/local-storage.service.js"></script>
  <script src = "AppLogging/file-logger.service.js"></script>
  <script src = "basic.js"></script>
  <script src = "qunit.js"></script>
   </head>

  <body>
      <div id = "qunit"></div>
      <div id = "qunit-fixture"></div> 
   </body>
</html>

这是需要测试的那个。

var injector = angular.injector(['ng', 'FileLoggerManager']);

module("File Logger Test", function () {
    var svc = injector.get('FileLogger');
});

然而,在编写QUnit测试时会发生错误。 “未知提供者:LocalDataProvider&lt; - LocalData&lt; - FileLogger”。

提前致谢!

0 个答案:

没有答案