Skip to content

Commit

Permalink
Rename WP_WXR_Processor to WP_WXR_Reader
Browse files Browse the repository at this point in the history
adamziel committed Nov 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent f79e80d commit 6041871
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/playground/data-liberation/bootstrap.php
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@
require_once __DIR__ . '/src/xml-api/WP_XML_Decoder.php';
require_once __DIR__ . '/src/xml-api/WP_XML_Processor.php';
require_once __DIR__ . '/src/WP_WXR_URL_Rewrite_Processor.php';
require_once __DIR__ . '/src/WP_WXR_Processor.php';
require_once __DIR__ . '/src/WP_WXR_Reader.php';
require_once __DIR__ . '/src/utf8_decoder.php';
require_once __DIR__ . '/vendor/autoload.php';

2 changes: 1 addition & 1 deletion packages/playground/data-liberation/phpunit.xml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Application Test Suite">
<file>tests/WPWXRProcessorTests.php</file>
<file>tests/WPWXRReaderTests.php</file>
<file>tests/WPWXRURLRewriterTests.php</file>
<file>tests/WPRewriteUrlsTests.php</file>
<file>tests/WPURLInTextProcessorTests.php</file>
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
* instructions on how to fix the problem.
*/

class WP_WXR_Processor {
class WP_WXR_Reader {

/**
* @var WP_XML_Processor
@@ -130,11 +130,11 @@ class WP_WXR_Processor {
);

public static function from_string( $wxr_bytes = '' ) {
return new WP_WXR_Processor( WP_XML_Processor::from_string( $wxr_bytes ) );
return new WP_WXR_Reader( WP_XML_Processor::from_string( $wxr_bytes ) );
}

public static function from_stream( $wxr_bytes = '' ) {
return new WP_WXR_Processor( WP_XML_Processor::from_stream( $wxr_bytes ) );
return new WP_WXR_Reader( WP_XML_Processor::from_stream( $wxr_bytes ) );
}

protected function __construct( $xml ) {
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@

use PHPUnit\Framework\TestCase;

class WPWXRProcessorTests extends TestCase {
class WPWXRReaderTests extends TestCase {

/**
* @dataProvider preexisting_wxr_files_provider
*/
public function test_does_not_crash_when_parsing_preexisting_wxr_files_as_string($path, $expected_entitys) {
$wxr = WP_WXR_Processor::from_string(file_get_contents($path));
$wxr = WP_WXR_Reader::from_string(file_get_contents($path));

$found_entities = 0;
while( $wxr->next_entity() ) {
@@ -23,7 +23,7 @@ public function test_does_not_crash_when_parsing_preexisting_wxr_files_as_string
*/
public function test_does_not_crash_when_parsing_preexisting_wxr_files_as_stream($path, $expected_entitys) {
$stream = fopen($path, 'r');
$wxr = WP_WXR_Processor::from_stream();
$wxr = WP_WXR_Reader::from_stream();
$found_entities = 0;
while(true) {
$chunk = fread($stream, 100);
@@ -61,7 +61,7 @@ public function preexisting_wxr_files_provider() {


public function test_simple_wxr() {
$importer = WP_WXR_Processor::from_string(file_get_contents(__DIR__ . '/fixtures/wxr-simple.xml'));
$importer = WP_WXR_Reader::from_string(file_get_contents(__DIR__ . '/fixtures/wxr-simple.xml'));
$this->assertTrue( $importer->next_entity() );
$this->assertEquals(
'site_option',
@@ -175,7 +175,7 @@ public function test_simple_wxr() {
}

public function test_attachments() {
$importer = WP_WXR_Processor::from_string(<<<XML
$importer = WP_WXR_Reader::from_string(<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<rss>
<channel>
@@ -255,7 +255,7 @@ public function test_attachments() {
}

public function test_terms() {
$importer = WP_WXR_Processor::from_string(<<<XML
$importer = WP_WXR_Reader::from_string(<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<rss>
<channel>
@@ -288,7 +288,7 @@ public function test_terms() {
}

public function test_category() {
$importer = WP_WXR_Processor::from_string(<<<XML
$importer = WP_WXR_Reader::from_string(<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<rss>
<channel>
@@ -317,7 +317,7 @@ public function test_category() {
}

public function test_tag_string() {
$wxr = WP_WXR_Processor::from_string(
$wxr = WP_WXR_Reader::from_string(
<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<rss>
@@ -364,7 +364,7 @@ public function test_tag_streaming() {
XML;
$chunks = str_split($wxr, 10);

$wxr = WP_WXR_Processor::from_stream();
$wxr = WP_WXR_Reader::from_stream();
while(true) {
if(true === $wxr->next_entity()) {
break;
@@ -395,7 +395,7 @@ public function test_tag_streaming() {
}

public function test_parse_comment() {
$wxr = WP_WXR_Processor::from_string(<<<XML
$wxr = WP_WXR_Reader::from_string(<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<rss>
<channel>
@@ -474,7 +474,7 @@ public function test_parse_comment() {
}

public function test_retains_last_ids() {
$wxr = WP_WXR_Processor::from_string(<<<XML
$wxr = WP_WXR_Reader::from_string(<<<XML
<?xml version="1.0" encoding="UTF-8"?>
<rss>
<channel>

0 comments on commit 6041871

Please sign in to comment.