Esempio n. 1
0
 /**
  * Handle GET requests.
  *
  * @param Alpha\Util\Http\Request $request
  *
  * @return Alpha\Util\Http\Response
  *
  * @since 1.0
  */
 public function doGET($request)
 {
     self::$logger->debug('>>doGET($request=[' . var_export($request, true) . '])');
     $params = $request->getParams();
     $body = View::displayPageHead($this);
     $sequence = new Sequence();
     // make sure that the Sequence tables exist
     if (!$sequence->checkTableExists()) {
         $body .= View::displayErrorMessage('Warning! The Sequence table do not exist, attempting to create it now...');
         $sequence->makeTable();
     }
     // set the start point for the list pagination
     if (isset($params['start']) ? $this->startPoint = $params['start'] : ($this->startPoint = 1)) {
     }
     $records = $sequence->loadAll($this->startPoint);
     ActiveRecord::disconnect();
     $this->BOCount = $sequence->getCount();
     $body .= View::renderDeleteForm($this->request->getURI());
     foreach ($records as $record) {
         $view = View::getInstance($record);
         $body .= $view->listView(array('URI' => $request->getURI()));
     }
     $body .= View::displayPageFoot($this);
     self::$logger->debug('<<doGET');
     return new Response(200, $body, array('Content-Type' => 'text/html'));
 }
Esempio n. 2
0
 /**
  * Testing the toString method.
  *
  * @since 1.0
  */
 public function testToString()
 {
     $this->assertEquals('TEST-1', $this->sequence->__toString(), 'Testing the toString method');
 }
Esempio n. 3
0
 /**
  * Testing the detailedView() method.
  *
  * @since 2.0
  */
 public function testDetailedView()
 {
     $sequence = new Sequence();
     $sequence->load(1);
     $view = View::getInstance($sequence);
     $this->assertNotEmpty($view->detailedView(), 'Testing the detailedView() method');
     $this->assertTrue(strpos($view->detailedView(), 'TEST') !== false, 'Testing the detailedView() method');
 }