-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor test helpers and test files (#104)
* Add Format as an optional constructor dependency to TestRender Add Format as an optional constructor dependency to TestRender. Check format's methods conditionally. Refactor tests to inject formats. * Add Config as a constructor dependency to TestRender Add Config as a constructor dependency to TestRender. Refactor tests to inject Config. * Add Index as an optional constructor dependency to TestRender * TestRender to extend Render * Config to allow calling instance methods * Refactor test helpers and test directory structure Refactor TestRender to use only constructor injected objects. Rename test format helper classes to indicate which package they belong to. Move TestRender and all format helper classes into the phpdotnet phd directory to enable autoloading. Remove all unnecessary lines from setup.php. Restructure test directory to follow the structure of the tested classes. --------- Co-authored-by: haszi <haszika80@gmail.com>
- Loading branch information
Showing
40 changed files
with
149 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -527,6 +527,3 @@ public function setMembership($membership) { | |
} | ||
|
||
} | ||
|
||
|
||
|
2 changes: 1 addition & 1 deletion
2
tests/xhtml/TestChunkedXHTML.php → phpdotnet/phd/TestGenericChunkedXHTML.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
namespace phpdotnet\phd; | ||
|
||
class TestRender extends Render { | ||
public function __construct( | ||
protected Reader $reader, | ||
protected Config $config, | ||
protected ?Format $format = null, | ||
protected ?Index $index = null, | ||
) {} | ||
|
||
public function run() { | ||
if ($this->index && $this->index::requireIndexing()) { | ||
if (!file_exists($this->config->output_dir())) { | ||
mkdir($this->config->output_dir(), 0755); | ||
} | ||
$this->attach($this->index); | ||
$this->reader->open($this->config->xml_file()); | ||
$this->execute($this->reader); | ||
$this->detach($this->index); | ||
} | ||
|
||
if ($this->format !== null) { | ||
$this->attach($this->format); | ||
$this->reader->open($this->config->xml_file()); | ||
$this->execute($this->reader); | ||
} | ||
} | ||
|
||
public function getIndex(): ?Index { | ||
return $this->index; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.