Beispiel #1
0
 public function testEight()
 {
     // Record two entries at an interval.
     $database = Database_Navigation::getInstance();
     $time = time();
     $database->record($time, "phpunit", 1, 2, 3);
     $time += 6;
     $database->record($time, "phpunit", 4, 5, 6);
     // Next entry is not there.
     $passage = $database->getNext("phpunit");
     $this->assertEquals(NULL, $passage);
     // Previous entry should be there.
     $passage = $database->getPrevious("phpunit");
     $this->assertEquals(array(1, 2, 3), $passage);
     // Next entry should be there since we moved to the previous one.
     $passage = $database->getNext("phpunit");
     $this->assertEquals(array(4, 5, 6), $passage);
     // Previous entry should be there.
     $passage = $database->getPrevious("phpunit");
     $this->assertEquals(array(1, 2, 3), $passage);
     // Previous entry before previous entry should not be there.
     $passage = $database->getPrevious("phpunit");
     $this->assertEquals(NULL, $passage);
     // Next entry should be there since we moved to the previous one.
     $passage = $database->getNext("phpunit");
     $this->assertEquals(array(4, 5, 6), $passage);
     // The entry next to the next entry should not be there.
     $passage = $database->getNext("phpunit");
     $this->assertEquals(NULL, $passage);
 }
Beispiel #2
0
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
include "utils.php";
ob_start();
require_once "../database/sqlite.php";
require_once "../database/navigation.php";
$database_navigation = Database_Navigation::getInstance();
$database_navigation->create();
$okay = !ob_get_flush();
display_header($okay);
if ($okay) {
    display_okay();
    display_paragraph("Navigation database okay.");
} else {
    display_paragraph("Errors creating or upgrading the navigation database");
    open_paragraph();
    display_link("navigation1.php", "Retry");
    close_paragraph();
}
display_footer();
Beispiel #3
0
 public static function goForward()
 {
     $database_navigation = Database_Navigation::getInstance();
     $session_logic = Session_Logic::getInstance();
     $user = $session_logic->currentUser();
     $passage = $database_navigation->getNext($user);
     if ($passage) {
         $ipc_focus = Ipc_Focus::getInstance();
         $ipc_focus->set($passage[0], $passage[1], $passage[2]);
     }
 }