Skip to content

Commit

Permalink
tidy: avoids require
Browse files Browse the repository at this point in the history
  • Loading branch information
davedevelopment committed Feb 22, 2023
1 parent 7eb2e0e commit 483fb82
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/Mockery/Fixtures/SemiReservedWordsAsMethods.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Mockery\Fixtures;
namespace test\Mockery\Fixtures;

class SemiReservedWordsAsMethods
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace Mockery;

use Mockery as m;
use Mockery\Fixtures\SemiReservedWordsAsMethods;
use test\Mockery\Fixtures\SemiReservedWordsAsMethods;
use PHPUnit\Framework\TestCase;

class MockeryCanMockClassesWithSemiReservedWordsTest extends TestCase
Expand All @@ -13,9 +13,7 @@ class MockeryCanMockClassesWithSemiReservedWordsTest extends TestCase
*/
public function smoke_test()
{
require __DIR__ . '/Fixtures/SemiReservedWordsAsMethods.php';

$mock = m::mock("Mockery\Fixtures\SemiReservedWordsAsMethods");
$mock = m::mock(SemiReservedWordsAsMethods::class);

$mock->shouldReceive("include")->andReturn("foo");

Expand Down
5 changes: 2 additions & 3 deletions tests/Mockery/MockingAllLowerCasedMethodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@

namespace test\Mockery;

use test\Mockery\Fixtures\ClassWithAllLowerCaseMethod;
use Mockery\Adapter\Phpunit\MockeryTestCase;

class MockingAllLowerCasedMethodsTest extends MockeryTestCase
{
/** @test */
public function itShouldAllowToCallAllLowerCasedMethodAsCamelCased()
{
require __DIR__ . "/Fixtures/ClassWithAllLowerCaseMethod.php";

$mock = mock('test\Mockery\Fixtures\ClassWithAllLowerCaseMethod');
$mock = mock(ClassWithAllLowerCaseMethod::class);
$mock->shouldReceive('userExpectsCamelCaseMethod')
->andReturn('mocked');

Expand Down
4 changes: 2 additions & 2 deletions tests/Mockery/MockingMethodsWithIterableTypeHintsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

namespace test\Mockery;

use test\Mockery\Fixtures\MethodWithIterableTypeHints;
use Mockery\Adapter\Phpunit\MockeryTestCase;

class MockingMethodsWithIterableTypeHintsTest extends MockeryTestCase
{
/** @test */
public function itShouldSuccessfullyBuildTheMock()
{
require __DIR__ . "/Fixtures/MethodWithIterableTypeHints.php";
$mock = mock("test\Mockery\Fixtures\MethodWithIterableTypeHints");
$mock = mock(MethodWithIterableTypeHints::class);

$this->assertInstanceOf(\test\Mockery\Fixtures\MethodWithIterableTypeHints::class, $mock);
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Mockery/MockingMethodsWithNullableParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,25 @@

namespace test\Mockery;

use test\Mockery\Fixtures\MethodWithNullableReturnType;
use test\Mockery\Fixtures\MethodWithParametersWithDefaultValues;
use Mockery\Adapter\Phpunit\MockeryTestCase;

class MockingMethodsWithNullableParametersTest extends MockeryTestCase
{
/** @test */
public function it_can_handle_nullable_typed_parameters()
{
require __DIR__ . "/Fixtures/MethodWithNullableTypedParameter.php";
$mock = mock("test\Mockery\Fixtures\MethodWithNullableTypedParameter");
$mock = mock(MethodWithNullableTypedParameter::class);

$this->assertInstanceOf(\test\Mockery\Fixtures\MethodWithNullableTypedParameter::class, $mock);
$this->assertInstanceOf(MethodWithNullableTypedParameter::class, $mock);
}

/** @test */
public function it_can_handle_default_parameters()
{
require __DIR__ . "/Fixtures/MethodWithParametersWithDefaultValues.php";
$mock = mock("test\Mockery\Fixtures\MethodWithParametersWithDefaultValues");
$mock = mock(MethodWithParametersWithDefaultValues::class);

$this->assertInstanceOf(\test\Mockery\Fixtures\MethodWithParametersWithDefaultValues::class, $mock);
$this->assertInstanceOf(MethodWithParametersWithDefaultValues::class, $mock);
}
}

0 comments on commit 483fb82

Please sign in to comment.