PHP Classes

File: tests/LinkCheckProviderTest.php

Recommend this page to a friend!
  Classes of Maik Greubel   PHP Link Checker   tests/LinkCheckProviderTest.php   Download  
File: tests/LinkCheckProviderTest.php
Role: Unit test script
Content type: text/plain
Description: Class source
Class: PHP Link Checker
Extract and check links on a page
Author: By
Last change:
Date: 6 years ago
Size: 807 bytes
 

Contents

Class file image Download
<?php
namespace Nkey\LinkCheck\Tests;

use
PHPUnit\Framework\TestCase;
use
Nkey\LinkCheck\LinkCheckProvider;
use
Generics\Util\UrlParser;
use
Generics\Streams\StandardOutputStream;
use
Generics\Streams\Interceptor\CachedStreamInterceptor;

class
LinkCheckProviderTest extends TestCase
{
   
/**
     * @test
     */
   
public function testSimple()
    {
       
$provider = new LinkCheckProvider(UrlParser::parseUrl("https://letsencrypt.org/getting-started/"));
       
       
$stream = new StandardOutputStream();
       
$interceptor = new CachedStreamInterceptor();
       
$stream->setInterceptor($interceptor);
       
$provider->setOutput($stream);
       
       
$provider->check();
       
       
$this->assertContains("https://letsencrypt.org/privacy/ OK", $interceptor->getCache());
    }
}