AcControllerResourceTest::testShouldLoadResourceUsingCustomFindByAttribute PHP Метод

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

Should load resource using custom findByAttribute
    public function testShouldLoadResourceUsingCustomFindByAttribute()
    {
        $projectAttributes = ['id' => 2, 'name' => 'foo'];
        $project = $this->buildModel('Project', $projectAttributes);
        $project->shouldReceive('findByName')->with($project->name)->once()->andReturn($project);
        $this->params = array_merge($this->params, array_merge(['action' => 'show', 'id' => 'foo']));
        $resource = new Efficiently\AuthorityController\ControllerResource($this->controller, ['findBy' => 'name']);
        $resource->loadResource();
        $this->assertEquals($this->getProperty($this->controller, 'project'), $project);
    }
AcControllerResourceTest