New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.x Cleanup todo in code #2757
2.x Cleanup todo in code #2757
Conversation
@@ -564,7 +564,6 @@ protected function avatar_host($email_hash) | |||
|
|||
/** | |||
* @internal | |||
* @todo what if it's relative? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is an issue in the future, it will pop up as an issue.
@@ -145,7 +145,6 @@ protected function fetch_meta($field_name = '', $args = [], $apply_filters = tru | |||
$args | |||
); | |||
|
|||
// @todo Remove when deprecated filters will be gone |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove all apply_filters_deprecated()
calls with the next major release.
@@ -86,7 +86,6 @@ protected function from_user_object($obj): CoreInterface | |||
)); | |||
} | |||
|
|||
// @todo return a UserCollection instance? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not at the moment. We discussed somewhere that user collections or collections for other types of content are not needed at the moment (#1689). We can add it if we really need it.
@@ -587,7 +587,6 @@ public function clear_cache_twig() | |||
$twig = $this->get_twig(); | |||
|
|||
// Get the configured cache location. | |||
// @todo What if this is a custom caching implementation? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will pop up as an issue in case it becomes a problem.
@@ -596,7 +595,6 @@ public function clear_cache_twig() | |||
} | |||
|
|||
if (is_string($cache_location) && is_dir($cache_location)) { | |||
// @todo What if not all files could be deleted? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be improved when we introduce better and streamlined error handling, see #2210.
@@ -47,7 +47,6 @@ | |||
* </div> | |||
* </article> | |||
* ``` | |||
* @todo implement JsonSerializable? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Serialization can be added if needed. It’s documented in https://timber.github.io/docs/v2/guides/posts/#serialization.
@@ -35,7 +35,6 @@ public function current() | |||
*/ | |||
$wp_post = parent::current(); | |||
// Lazily instantiate a Timber\Post instance exactly once. | |||
// @todo maybe improve performance by caching the instantiated post. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performance and caching is an area where we could improve in a lot of places. In case we want to improve post performance, we’ll find the right place to do it.
@@ -318,7 +313,6 @@ public static function get_attachment($query = false, $options = []) | |||
{ | |||
$post = static::get_post($query, $options); | |||
|
|||
// @todo make this determination at the Factory level. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might improve this in the future. For the moment, it seems to work.
@@ -457,9 +450,6 @@ public static function get_posts($query = false, $options = []) | |||
); | |||
} | |||
|
|||
/** | |||
* @todo Are there any more default options to support? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We’ll figure them out if needed.
@@ -863,7 +853,7 @@ public static function get_term_by(string $field, $value, string $taxonomy = '') | |||
public static function get_users(array $query = [], array $options = []): iterable | |||
{ | |||
$factory = new UserFactory(); | |||
// TODO return a Collection type? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #1689.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file didn’t really do anything.
@@ -178,25 +178,20 @@ public function testNextCategory() | |||
|
|||
public function testNextCustomTax() | |||
{ | |||
$v = get_bloginfo('version'); | |||
if (version_compare($v, '3.8', '<')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don’t need to support WordPress < 3.8.
'post_title' => 'Timmy', | ||
]); | ||
|
||
update_option('show_on_front', 'page'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line was missing to get the test working.
@@ -396,39 +390,6 @@ public function testGetPostWithClassMap() | |||
$this->assertInstanceOf(TimberAlert::class, Timber::get_post($alert_id)); | |||
} | |||
|
|||
|
|||
|
|||
/* Terms API */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the coverage report, getting terms with different parameters is already covered in the factory tests.
/** | ||
* @expectedDeprecated Timber\Timber::query_post() | ||
*/ | ||
public function testQueryPost() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this somehow tests whether Timber::query_post()
would change the post global so that get_the_ID()
returns the queried post. This logic is not supported anymore.
{ | ||
// We don't actually test this directly in TestTimberPostGetter::testGettingWithFalse(); | ||
// that test directly instantiates a collection. | ||
$this->markTestSkipped('@todo what should this be?'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the newest version, when using false
with Timber::get_posts()
, the default query will be used. This test would test a deprecated functionality then. That’s why I removed it.
@@ -901,48 +833,6 @@ public function testThePostHook() | |||
$this->assertSame(3, $the_post_count); | |||
} | |||
|
|||
public function testGetAttachment() | |||
{ | |||
$this->markTestSkipped('@todo seems like a lot of what gets tested here is core WP file mgmt. Is that what we want?'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like a lot of what gets tested here is core WP file mgmt. Is that what we want?
I agree. Doesn’t seem to test anything worth testing that isn’t covered in other tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! That are a lot less todos!
I feel a fresh smell. |
Related:
Issue
Source code contains a lot of todos.
Solution
I worked through the todos in code as well as some skipped tests. I left the todos that are only about documentation.
I will add separate comments with the changes.
Impact
Make sure we didn’t forget anything important for 2.x
Usage Changes
None.
Considerations
None.
Testing
Yes.