Skip to content

Commit

Permalink
Upgrade PHPUnit.
Browse files Browse the repository at this point in the history
  • Loading branch information
suin committed Nov 4, 2017
1 parent 523db39 commit a12796d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"php": ">=5.4.0"
},
"require-dev": {
"EHER/PHPUnit": ">=1.6",
"mockery/mockery": ">=0.7.2",
"phpunit/phpunit": ">=4.8.36 <6.0",
"mockery/mockery": ">=0.9 <1.0",
"suin/xoopsunit": ">=1.2"
},
"autoload": {
Expand Down
2 changes: 2 additions & 0 deletions tests/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@
set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__DIR__) . '/src');

date_default_timezone_set('UTC');

class_exists('PHPUnit_Framework_TestCase') || class_alias('PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase');
10 changes: 5 additions & 5 deletions tests/Suin/RSSWriter/ChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testPubsubhubbub()

public function testAddItem()
{
$item = $this->getMock($this->itemInterface);
$item = $this->createMock($this->itemInterface);
$channel = new Channel();
$this->assertSame($channel, $channel->addItem($item));
$this->assertAttributeSame([$item], 'items', $channel);
Expand All @@ -99,7 +99,7 @@ public function testAddItem()
public function testAppendTo()
{
$channel = new Channel();
$feed = $this->getMock($this->feedInterface);
$feed = $this->createMock($this->feedInterface);
$feed->expects($this->once())->method('addChannel')->with($channel);
$this->assertSame($channel, $channel->appendTo($feed));
}
Expand Down Expand Up @@ -232,11 +232,11 @@ public function testAppendTo_with_items()
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item2</title></item>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><item><title>item3</title></item>');

$item1 = $this->getMock($this->itemInterface);
$item1 = $this->createMock($this->itemInterface);
$item1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$item2 = $this->getMock($this->itemInterface);
$item2 = $this->createMock($this->itemInterface);
$item2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$item3 = $this->getMock($this->itemInterface);
$item3 = $this->createMock($this->itemInterface);
$item3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));

$this->reveal($channel)
Expand Down
18 changes: 9 additions & 9 deletions tests/Suin/RSSWriter/FeedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ public function testRender()
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
$channel1 = $this->getMock($this->channelInterface);
$channel1 = $this->createMock($this->channelInterface);
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$channel2 = $this->getMock($this->channelInterface);
$channel2 = $this->createMock($this->channelInterface);
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$channel3 = $this->getMock($this->channelInterface);
$channel3 = $this->createMock($this->channelInterface);
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
$this->reveal($feed)->attr('channels', [$channel1, $channel2, $channel3]);
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
Expand All @@ -45,11 +45,11 @@ public function testRender_with_japanese()
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語1</title></channel>');
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語2</title></channel>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>日本語3</title></channel>');
$channel1 = $this->getMock($this->channelInterface);
$channel1 = $this->createMock($this->channelInterface);
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$channel2 = $this->getMock($this->channelInterface);
$channel2 = $this->createMock($this->channelInterface);
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$channel3 = $this->getMock($this->channelInterface);
$channel3 = $this->createMock($this->channelInterface);
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
$this->reveal($feed)->attr('channels', [$channel1, $channel2, $channel3]);
$expect = <<< 'XML'
Expand Down Expand Up @@ -77,11 +77,11 @@ public function test__toString()
$xml1 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel1</title></channel>');
$xml2 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel2</title></channel>');
$xml3 = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8" ?><channel><title>channel3</title></channel>');
$channel1 = $this->getMock($this->channelInterface);
$channel1 = $this->createMock($this->channelInterface);
$channel1->expects($this->once())->method('asXML')->will($this->returnValue($xml1));
$channel2 = $this->getMock($this->channelInterface);
$channel2 = $this->createMock($this->channelInterface);
$channel2->expects($this->once())->method('asXML')->will($this->returnValue($xml2));
$channel3 = $this->getMock($this->channelInterface);
$channel3 = $this->createMock($this->channelInterface);
$channel3->expects($this->once())->method('asXML')->will($this->returnValue($xml3));
$this->reveal($feed)->attr('channels', [$channel1, $channel2, $channel3]);
$expect = '<?xml version="1.0" encoding="UTF-8" ?>
Expand Down
2 changes: 1 addition & 1 deletion tests/Suin/RSSWriter/ItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function testPubDate()
public function testAppendTo()
{
$item = new Item();
$channel = $this->getMock($this->channelInterface);
$channel = $this->createMock($this->channelInterface);
$channel->expects($this->once())->method('addItem')->with($item);
$this->assertSame($item, $item->appendTo($channel));
}
Expand Down

0 comments on commit a12796d

Please sign in to comment.