/** * @group factory * @expectedException \InvalidArgumentException */ public function test_that_it_only_accepts_integer_as_parameter() { $factory = new Factory($this->requestable); $factory->activity('butts'); }
$settings = $app['db']->fetchOne('SELECT `url`, `apikey`, `name`, `logo`, `userId` FROM `settings` LIMIT 1'); $people = $app['db']->fetchAll('SELECT * FROM `people` ORDER BY `companyName`=(select companyName from people where userId=' . ($settings['userId'] ?: 999) . ') DESC, `companyName` ASC, `name` ASC;'); $client = new Client(new Guzzle(), $settings['apikey'] ?: '', $settings['url'] ?: ''); $teamwork = new Teamwork($client); $app->post('/setapikey', function () use($app) { $apikey = $_POST['apikey']; // TODO: Get this from the request properly if (empty($apikey)) { return $app->redirect('/?setApiKey=emptyPleaseDoItProperly'); } $result = $app['db']->perform('INSERT INTO `settings` (apikey) VALUES (:apikey)', ['apikey' => $apikey]); if (empty($result)) { return $app->redirect('/?setApiKey=failedToInsertIntoSettings'); } $client = new Client(new Guzzle(), $apikey, ''); $teamwork = new Teamwork($client); $account = $teamwork->authenticate()->authenticate(); if (empty($account)) { return $app->redirect('/?setApiKey=rubbishApiKeySorry'); } $result = $app['db']->perform('UPDATE `settings` SET `url`=:url, `logo`=:logo, `name`=:name, `userId`=:userId', ['url' => $account['account']['URL'], 'logo' => $account['account']['logo'], 'name' => ucwords(trim($account['account']['firstname'] . ' ' . $account['account']['lastname'])), 'userId' => $account['account']['userId']]); if (empty($result)) { return $app->redirect('/?setApiKey=failedToUpdateSettingsWithUrlAndSuch'); } return $app->redirect('/?setApiKey=woo'); }); $app->get('/', function () use($app, $teamwork, $settings, $taskFile) { if (empty($settings) || empty($settings['apikey'])) { $form = <<<FORM <form action='/index.php/setapikey' method='POST'> <label for='apikey'>API Key:</label>