Bake\Shell\Task\TestTask::generateFixtureList PHP Метод

generateFixtureList() публичный Метод

Generate the list of fixtures that will be required to run this test based on loaded models.
public generateFixtureList ( object $subject ) : array
$subject object The object you want to generate fixtures for.
Результат array Array of fixtures to be included in the test.
    public function generateFixtureList($subject)
    {
        $this->_fixtures = [];
        if ($subject instanceof Table) {
            $this->_processModel($subject);
        } elseif ($subject instanceof Controller) {
            $this->_processController($subject);
        }
        return array_values($this->_fixtures);
    }

Usage Example

Пример #1
0
 /**
  * test that the generation of fixtures works correctly.
  *
  * @return void
  */
 public function testFixtureArrayGenerationFromController()
 {
     $subject = new PostsController(new Request(), new Response());
     $result = $this->Task->generateFixtureList($subject);
     $expected = ['app.posts'];
     $this->assertEquals($expected, $result);
 }