Cakephp 3测试:如何从数据库加载记录?

Tei*_*raz 3 php testing cakephp cakephp-3.0

我需要测试一些报告,这些报告具有复杂的数据结构和大量数据影响,因此为此目的创建固定装置将是非常繁琐的工作。我想使用现有的数据库(实际上是数据库的副本)来测试报告。

我如何在cakephp 3测试中实现这一目标?是否可以从cakephp 3中的数据库加载灯具的记录(不是表的结构)?

aho*_*ner 5

您可以使用Bake实用程序从表中的现有记录创建固定装置:

    --records, -r     Generate a fixture with records from the non-test
                      database. Used with --count and --conditions to limit
                      which records are added to the fixture.
    --count, -n       When using generated data, the number of records to
                      include in the fixture(s). (default:
                      1)
Run Code Online (Sandbox Code Playgroud)

例如:

    --records, -r     Generate a fixture with records from the non-test
                      database. Used with --count and --conditions to limit
                      which records are added to the fixture.
    --count, -n       When using generated data, the number of records to
                      include in the fixture(s). (default:
                      1)
Run Code Online (Sandbox Code Playgroud)