public function testFindSum()
 {
     $json = Scraper::start();
     $array = json_decode($json, true);
     //print_r($array['total']);
     $input = $array['results'];
     $total = $array['total'];
     $sumFinder = new SumFinderClass($input);
     $this->assertEquals($total, $sumFinder->findSum());
 }
Ejemplo n.º 2
0
<?php

require_once 'Scraper.php';
print_r(Scraper::start());
    public function reportHttpActivity($url)
    {
        usleep(1000000);
        echo $url . PHP_EOL;
    }
}

date_default_timezone_set('America/New_York');

// Initialize the application and bootstrap the database adapter
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', 'development');
require_once 'Zend/Application.php';
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
$bootstrap = $application->getBootstrap();
$bootstrap->bootstrap('db');
$dbAdapter = $bootstrap->getResource('db');

$scraper = new Scraper($dbAdapter->getConnection(), 'http://n4.nabble.com/Zend-Framework-Community-f634137.html');
$scraper->getUserId('Alex');

$scraper->start();

// generally speaking, this script will be run from the command line
return true;