Skip to content

Commit

Permalink
Refactor test to no longer rely on deprecated assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Feb 15, 2023
1 parent dc2e2e8 commit 315904f
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions packages/framework/tests/Feature/Services/RssFeedServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function test_xml_root_element_is_set_to_rss_2_0()
public function test_xml_element_has_channel_element()
{
$service = new RssFeedGenerator();
$this->assertObjectHasAttribute('channel', $service->getXmlElement());
$this->assertTrue(property_exists($service->getXmlElement(), 'channel'));
}

public function test_xml_channel_element_has_required_elements()
Expand All @@ -40,9 +40,9 @@ public function test_xml_channel_element_has_required_elements()
config(['hyde.url' => 'https://example.com']);

$service = new RssFeedGenerator();
$this->assertObjectHasAttribute('title', $service->getXmlElement()->channel);
$this->assertObjectHasAttribute('link', $service->getXmlElement()->channel);
$this->assertObjectHasAttribute('description', $service->getXmlElement()->channel);
$this->assertTrue(property_exists($service->getXmlElement()->channel, 'title'));
$this->assertTrue(property_exists($service->getXmlElement()->channel, 'link'));
$this->assertTrue(property_exists($service->getXmlElement()->channel, 'description'));

$this->assertEquals('Test Blog', $service->getXmlElement()->channel->title);
$this->assertEquals('https://example.com', $service->getXmlElement()->channel->link);
Expand All @@ -54,14 +54,14 @@ public function test_xml_channel_element_has_additional_elements()
config(['hyde.url' => 'https://example.com']);

$service = new RssFeedGenerator();
$this->assertObjectHasAttribute('link', $service->getXmlElement()->channel);
$this->assertTrue(property_exists($service->getXmlElement()->channel, 'link'));
$this->assertEquals('https://example.com', $service->getXmlElement()->channel->link);
$this->assertEquals('https://example.com/feed.xml',
$service->getXmlElement()->channel->children('atom', true)->link->attributes()->href);

$this->assertObjectHasAttribute('language', $service->getXmlElement()->channel);
$this->assertObjectHasAttribute('generator', $service->getXmlElement()->channel);
$this->assertObjectHasAttribute('lastBuildDate', $service->getXmlElement()->channel);
$this->assertTrue(property_exists($service->getXmlElement()->channel, 'language'));
$this->assertTrue(property_exists($service->getXmlElement()->channel, 'generator'));
$this->assertTrue(property_exists($service->getXmlElement()->channel, 'lastBuildDate'));
}

public function test_xml_channel_data_can_be_customized()
Expand Down Expand Up @@ -110,7 +110,7 @@ public function test_markdown_blog_posts_are_added_to_rss_feed_through_autodisco
$this->assertEquals('Hyde', $item->children('dc', true)->creator);
$this->assertEquals('test', $item->category);

$this->assertObjectHasAttribute('enclosure', $item);
$this->assertTrue(property_exists($item, 'enclosure'));
$this->assertEquals('https://example.com/media/rss-test.jpg', $item->enclosure->attributes()->url);
$this->assertEquals('image/jpeg', $item->enclosure->attributes()->type);
$this->assertEquals('8', $item->enclosure->attributes()->length);
Expand Down

0 comments on commit 315904f

Please sign in to comment.