init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
38
lib/sc/tests/MetaCsrfTokenTest.php
Normal file
38
lib/sc/tests/MetaCsrfTokenTest.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace Spekulatius\PHPScraper\Tests;
|
||||
|
||||
class MetaCsrfTokenTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testMissingCsrfToken()
|
||||
{
|
||||
$web = new \Spekulatius\PHPScraper\PHPScraper;
|
||||
|
||||
// Navigate to the test page.
|
||||
$web->go('https://test-pages.phpscraper.de/meta/missing.html');
|
||||
|
||||
// Check the csrfToken as not given (null)
|
||||
$this->assertNull($web->csrfToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function testWithCsrfToken()
|
||||
{
|
||||
$web = new \Spekulatius\PHPScraper\PHPScraper;
|
||||
|
||||
// Navigate to the test page.
|
||||
// Contains: <meta name="csrf-token" content="token" />
|
||||
$web->go('https://test-pages.phpscraper.de/meta/lorem-ipsum.html');
|
||||
|
||||
// Check the csrfToken
|
||||
$this->assertSame(
|
||||
'token',
|
||||
$web->csrfToken
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue