PHP Classes

File: tests/UrlExtractorTest/UrlExtractorTest.php

Recommend this page to a friend!
  Classes of Joćo Ribeiro   PHP URL Extractor   tests/UrlExtractorTest/UrlExtractorTest.php   Download  
File: tests/UrlExtractorTest/UrlExtractorTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test script
Class: PHP URL Extractor
Extract URLs of images and metadata from Web pages
Author: By
Last change: Updated class namespace and created a composer.json file.
Date: 8 years ago
Size: 768 bytes
 

Contents

Class file image Download
<?php

class UrlExtractorTest extends PHPUnit_Framework_TestCase
{
    public function
testExtractAll()
    {

       
$expectedData = array(
           
"title" => "rollbackpt (Joao Ribeiro)",
           
"description" =>
           
"rollbackpt has 11 repositories written in JavaScript, PHP, and Cuda. Follow their code on GitHub.",
           
"keywords" => array("rollbackpt", "github", "urlextractor", "demo"),
           
"images" => array(0 => "https://avatars0.githubusercontent.com/u/2725826?v=3&amp;s=400")
        );

       
$urlExtractor = new \rollbackpt\UrlExtractor\UrlExtractor();
       
$urlData = $urlExtractor->extractAll("file://" . dirname(__FILE__) . "/test_website.html", false);
       
$this->assertEquals($urlData, $expectedData);
    }
}