/** * Get projects * * @return array|\LaravelKeenIO\Options\Project[] */ protected function getProjects() { /** @var Project[]|array $projects */ $projects = []; foreach ($this->moduleOptions->get('projects') as $title => $project) { $projects[$title] = new Project($project); } return $projects; }
public function testClientUseDefault() { $project = 'defaultName'; $version = '3.0'; $projects = ['defaultName' => ['projectId' => 'projectId', 'masterKey' => 'masterKey', 'readKey' => 'readKey', 'writeKey' => 'writeKey', 'version' => $version]]; $this->moduleOptions->expects($this->at(0))->method('get')->with('default')->willReturn($project); $this->moduleOptions->expects($this->at(1))->method('get')->with('projects')->willReturn($projects); /** @var KeenIOClient $result */ $result = $this->service->client(); $this->assertInstanceOf(KeenIOClient::class, $result); $this->assertSame($projects[$project]['projectId'], $result->getProjectId()); $this->assertSame($projects[$project]['masterKey'], $result->getMasterKey()); $this->assertSame($projects[$project]['readKey'], $result->getReadKey()); $this->assertSame($projects[$project]['writeKey'], $result->getWriteKey()); $this->assertSame(KeenIOService::DEFAULT_VERSION, $result->getVersion()); }
public function testGet() { $key = 'a'; $result = $this->options->get($key); $this->assertSame($this->demoOptions[$key], $result); }