Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class ConsecutiveCallsTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->at(0))
->method('foo')
->with(1)
->willReturn('a');

$mock->expects($this->at(1))
->method('foo')
->with(2)
->willReturn('b');

$mock->expects(self::at(2))
->method('foo')
->with(3)
->willReturn('c');
}
}

?>
-----
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class ConsecutiveCallsTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->exactly(3))->method('foo')->withConsecutive([1], [2], [3])->willReturnOnConsecutiveCalls('a', 'b', 'c');
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDe

use PHPUnit\Framework\TestCase;

final class AtWithOneCountTest extends TestCase
final class LoneAtZeroTest extends TestCase
{
public function test()
{
$mock->expects($this->at(1))
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->at(0))
->method('foo')
->willReturn('1');
}
}

?>
-----
<?php
Expand All @@ -21,13 +23,15 @@ namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDe

use PHPUnit\Framework\TestCase;

final class AtWithOneCountTest extends TestCase
final class LoneAtZeroTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->once())
->method('foo')
->willReturn('1');
}
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class SkipDifferentMethodsTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->at(0))->method('foo')->willReturn('1');
$mock->expects($this->at(1))->method('bar')->willReturn('2');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class SkipIndexGapTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->at(1))->method('foo')->willReturn('1');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class SkipOtherExpectationTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->at(0))->method('foo')->willReturn('1');
$mock->expects($this->once())->method('bar');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class SkipPartialWithTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->expects($this->at(0))->method('foo')->with(1);
$mock->expects($this->at(1))->method('foo');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class SkipPropertyMockTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$this->mock->expects($this->at(0))->method('foo')->willReturn('1');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Rector\PHPUnit\Tests\PHPUnit90\Rector\MethodCall\ReplaceAtMethodWithDesiredMatcherRector\Fixture;

use PHPUnit\Framework\TestCase;

final class SkipStubbedCallTest extends TestCase
{
public function test()
{
$mock = $this->createMock(\stdClass::class);
$mock->method('bar')->willReturn('2');
$mock->expects($this->at(0))->method('foo')->willReturn('1');
}
}
Loading
Loading