diff --git a/composer.json b/composer.json index 29e6f3c..28f30f3 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/tests/Bootstrap.php b/tests/Bootstrap.php index 8b38007..72014d8 100644 --- a/tests/Bootstrap.php +++ b/tests/Bootstrap.php @@ -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'); diff --git a/tests/Suin/RSSWriter/ChannelTest.php b/tests/Suin/RSSWriter/ChannelTest.php index 65b4131..39e9947 100644 --- a/tests/Suin/RSSWriter/ChannelTest.php +++ b/tests/Suin/RSSWriter/ChannelTest.php @@ -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); @@ -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)); } @@ -232,11 +232,11 @@ public function testAppendTo_with_items() $xml2 = new SimpleXMLElement('item2'); $xml3 = new SimpleXMLElement('item3'); - $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) diff --git a/tests/Suin/RSSWriter/FeedTest.php b/tests/Suin/RSSWriter/FeedTest.php index 97203f1..0897bbe 100644 --- a/tests/Suin/RSSWriter/FeedTest.php +++ b/tests/Suin/RSSWriter/FeedTest.php @@ -22,11 +22,11 @@ public function testRender() $xml1 = new SimpleXMLElement('channel1'); $xml2 = new SimpleXMLElement('channel2'); $xml3 = new SimpleXMLElement('channel3'); - $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 = ' @@ -45,11 +45,11 @@ public function testRender_with_japanese() $xml1 = new SimpleXMLElement('日本語1'); $xml2 = new SimpleXMLElement('日本語2'); $xml3 = new SimpleXMLElement('日本語3'); - $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' @@ -77,11 +77,11 @@ public function test__toString() $xml1 = new SimpleXMLElement('channel1'); $xml2 = new SimpleXMLElement('channel2'); $xml3 = new SimpleXMLElement('channel3'); - $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 = ' diff --git a/tests/Suin/RSSWriter/ItemTest.php b/tests/Suin/RSSWriter/ItemTest.php index 02e653f..e448998 100644 --- a/tests/Suin/RSSWriter/ItemTest.php +++ b/tests/Suin/RSSWriter/ItemTest.php @@ -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)); }