public function testAll() { $rubrics = $this->rubric->all(); $this->assertTrue(is_array($rubrics), 'Rubrics is array'); $this->assertNotEmpty($rubrics, 'Rubrics not empty'); foreach ($rubrics as $rubric) { $this->assertTrue($rubric instanceof \consultnn\api\mappers\Rubric, 'Each value must be instance of Rubric'); } }
public function testByRubrics() { $rubrics = array_map(function ($rubric) { return $rubric->id; }, $this->rubric->all()); $companies = $this->company->byRubricIds($rubrics, ['not_filial' => 1]); $this->assertTrue(is_array($companies)); foreach ($companies as $company) { $this->assertTrue($company instanceof \consultnn\api\mappers\Company); $this->assertNotEmpty(array_intersect($rubrics, $company->rubrics)); if (isset($company->branch->headOfficeId)) { $this->assertEquals($company->id, $company->branch->headOfficeId); } } }