예제 #1
0
 public function testGetManager()
 {
     $request = new Request('http://localhost/Aldo/test.html');
     $html = $request->fetch();
     $lexer = new Lexer();
     $elementManager = $lexer->transform($html);
     return $elementManager;
 }
예제 #2
0
파일: example.php 프로젝트: Tuccinator/Aldo
<?php

require 'vendor/autoload.php';
use Aldo\Http\Request;
use Aldo\Lexer\Lexer;
$request = new Request('http://www.digitalartsonline.co.uk/features/interactive-design/how-clearleft-redesigned-penguin-website/');
$html = $request->fetch();
$lexer = new Lexer();
$elementManager = $lexer->transform($html);
$source = $elementManager->getElement('#siteLogo')->source();
$imgContainer = $elementManager->getElement('#ultimediaswitch');
$secondImageSource = $imgContainer->getChildren()->source();
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>Digital Arts Example</title>
    </head>
    <body>
        <img src="<?php 
echo $source;
?>
" /></br>
        <img src="http://www.digitalartsonline.co.uk/<?php 
echo $secondImageSource;
?>
" />
    </body>
</html>
예제 #3
0
 /**
  * Assert that the fetch method of Request returns the correct response
  */
 public function testFetch()
 {
     $request = new Request('http://localhost/Aldo/test.html');
     $results = $request->fetch();
     $this->assertContains('bye', $results);
 }