diff --git a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php index c61f1fb..e9d4cb4 100644 --- a/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php +++ b/Behavioral/ChainOfResponsibilities/Tests/ChainTest.php @@ -33,7 +33,7 @@ class ChainTest extends TestCase ->willReturn('GET'); $request->method('getUri')->willReturn($uri); - $this->assertEquals('Hello In Memory!', $this->chain->handle($request)); + $this->assertSame('Hello In Memory!', $this->chain->handle($request)); } public function testCanRequestKeyInSlowStorage() @@ -47,6 +47,6 @@ class ChainTest extends TestCase ->willReturn('GET'); $request->method('getUri')->willReturn($uri); - $this->assertEquals('Hello World!', $this->chain->handle($request)); + $this->assertSame('Hello World!', $this->chain->handle($request)); } } diff --git a/Behavioral/Command/Tests/CommandTest.php b/Behavioral/Command/Tests/CommandTest.php index 2479321..e14e215 100644 --- a/Behavioral/Command/Tests/CommandTest.php +++ b/Behavioral/Command/Tests/CommandTest.php @@ -16,6 +16,6 @@ class CommandTest extends TestCase $invoker->setCommand(new HelloCommand($receiver)); $invoker->run(); - $this->assertEquals('Hello World', $receiver->getOutput()); + $this->assertSame('Hello World', $receiver->getOutput()); } } diff --git a/Behavioral/Command/Tests/UndoableCommandTest.php b/Behavioral/Command/Tests/UndoableCommandTest.php index 9569cb1..b76c17b 100644 --- a/Behavioral/Command/Tests/UndoableCommandTest.php +++ b/Behavioral/Command/Tests/UndoableCommandTest.php @@ -17,17 +17,17 @@ class UndoableCommandTest extends TestCase $invoker->setCommand(new HelloCommand($receiver)); $invoker->run(); - $this->assertEquals('Hello World', $receiver->getOutput()); + $this->assertSame('Hello World', $receiver->getOutput()); $messageDateCommand = new AddMessageDateCommand($receiver); $messageDateCommand->execute(); $invoker->run(); - $this->assertEquals("Hello World\nHello World [".date('Y-m-d').']', $receiver->getOutput()); + $this->assertSame("Hello World\nHello World [".date('Y-m-d').']', $receiver->getOutput()); $messageDateCommand->undo(); $invoker->run(); - $this->assertEquals("Hello World\nHello World [".date('Y-m-d')."]\nHello World", $receiver->getOutput()); + $this->assertSame("Hello World\nHello World [".date('Y-m-d')."]\nHello World", $receiver->getOutput()); } } diff --git a/Behavioral/Iterator/Tests/IteratorTest.php b/Behavioral/Iterator/Tests/IteratorTest.php index 5a63078..bf7535a 100644 --- a/Behavioral/Iterator/Tests/IteratorTest.php +++ b/Behavioral/Iterator/Tests/IteratorTest.php @@ -23,7 +23,7 @@ class IteratorTest extends TestCase $books[] = $book->getAuthorAndTitle(); } - $this->assertEquals( + $this->assertSame( [ 'Learning PHP Design Patterns by William Sanders', 'Professional Php Design Patterns by Aaron Saray', @@ -48,7 +48,7 @@ class IteratorTest extends TestCase $books[] = $book->getAuthorAndTitle(); } - $this->assertEquals( + $this->assertSame( ['Professional Php Design Patterns by Aaron Saray'], $books ); diff --git a/Behavioral/Memento/Tests/MementoTest.php b/Behavioral/Memento/Tests/MementoTest.php index 656a58c..8bcd42b 100644 --- a/Behavioral/Memento/Tests/MementoTest.php +++ b/Behavioral/Memento/Tests/MementoTest.php @@ -15,18 +15,18 @@ class MementoTest extends TestCase // open the ticket $ticket->open(); $openedState = $ticket->getState(); - $this->assertEquals(State::STATE_OPENED, (string) $ticket->getState()); + $this->assertSame(State::STATE_OPENED, (string) $ticket->getState()); $memento = $ticket->saveToMemento(); // assign the ticket $ticket->assign(); - $this->assertEquals(State::STATE_ASSIGNED, (string) $ticket->getState()); + $this->assertSame(State::STATE_ASSIGNED, (string) $ticket->getState()); // now restore to the opened state, but verify that the state object has been cloned for the memento $ticket->restoreFromMemento($memento); - $this->assertEquals(State::STATE_OPENED, (string) $ticket->getState()); + $this->assertSame(State::STATE_OPENED, (string) $ticket->getState()); $this->assertNotSame($openedState, $ticket->getState()); } } diff --git a/Behavioral/State/Tests/StateTest.php b/Behavioral/State/Tests/StateTest.php index 1bb36a7..73273bc 100644 --- a/Behavioral/State/Tests/StateTest.php +++ b/Behavioral/State/Tests/StateTest.php @@ -11,7 +11,7 @@ class StateTest extends TestCase { $orderContext = OrderContext::create(); - $this->assertEquals('created', $orderContext->toString()); + $this->assertSame('created', $orderContext->toString()); } public function testCanProceedToStateShipped() @@ -19,7 +19,7 @@ class StateTest extends TestCase $contextOrder = OrderContext::create(); $contextOrder->proceedToNext(); - $this->assertEquals('shipped', $contextOrder->toString()); + $this->assertSame('shipped', $contextOrder->toString()); } public function testCanProceedToStateDone() @@ -28,7 +28,7 @@ class StateTest extends TestCase $contextOrder->proceedToNext(); $contextOrder->proceedToNext(); - $this->assertEquals('done', $contextOrder->toString()); + $this->assertSame('done', $contextOrder->toString()); } public function testStateDoneIsTheLastPossibleState() @@ -38,6 +38,6 @@ class StateTest extends TestCase $contextOrder->proceedToNext(); $contextOrder->proceedToNext(); - $this->assertEquals('done', $contextOrder->toString()); + $this->assertSame('done', $contextOrder->toString()); } } diff --git a/Behavioral/Strategy/Tests/StrategyTest.php b/Behavioral/Strategy/Tests/StrategyTest.php index 0d25c7c..69f4dca 100644 --- a/Behavioral/Strategy/Tests/StrategyTest.php +++ b/Behavioral/Strategy/Tests/StrategyTest.php @@ -49,7 +49,7 @@ class StrategyTest extends TestCase $elements = $obj->executeStrategy($collection); $firstElement = array_shift($elements); - $this->assertEquals($expected, $firstElement); + $this->assertSame($expected, $firstElement); } /** @@ -64,6 +64,6 @@ class StrategyTest extends TestCase $elements = $obj->executeStrategy($collection); $firstElement = array_shift($elements); - $this->assertEquals($expected, $firstElement); + $this->assertSame($expected, $firstElement); } } diff --git a/Behavioral/TemplateMethod/Tests/JourneyTest.php b/Behavioral/TemplateMethod/Tests/JourneyTest.php index 25bdd51..89d9b8e 100644 --- a/Behavioral/TemplateMethod/Tests/JourneyTest.php +++ b/Behavioral/TemplateMethod/Tests/JourneyTest.php @@ -12,7 +12,7 @@ class JourneyTest extends TestCase $beachJourney = new TemplateMethod\BeachJourney(); $beachJourney->takeATrip(); - $this->assertEquals( + $this->assertSame( ['Buy a flight ticket', 'Taking the plane', 'Swimming and sun-bathing', 'Taking the plane'], $beachJourney->getThingsToDo() ); @@ -23,7 +23,7 @@ class JourneyTest extends TestCase $beachJourney = new TemplateMethod\CityJourney(); $beachJourney->takeATrip(); - $this->assertEquals( + $this->assertSame( [ 'Buy a flight ticket', 'Taking the plane', diff --git a/Structural/Adapter/Tests/AdapterTest.php b/Structural/Adapter/Tests/AdapterTest.php index d2db30e..47636f0 100644 --- a/Structural/Adapter/Tests/AdapterTest.php +++ b/Structural/Adapter/Tests/AdapterTest.php @@ -15,7 +15,7 @@ class AdapterTest extends TestCase $book->open(); $book->turnPage(); - $this->assertEquals(2, $book->getPage()); + $this->assertSame(2, $book->getPage()); } public function testCanTurnPageOnKindleLikeInANormalBook() @@ -26,6 +26,6 @@ class AdapterTest extends TestCase $book->open(); $book->turnPage(); - $this->assertEquals(2, $book->getPage()); + $this->assertSame(2, $book->getPage()); } } diff --git a/Structural/Bridge/Tests/BridgeTest.php b/Structural/Bridge/Tests/BridgeTest.php index 2f1fd8e..4b89495 100644 --- a/Structural/Bridge/Tests/BridgeTest.php +++ b/Structural/Bridge/Tests/BridgeTest.php @@ -12,10 +12,10 @@ class BridgeTest extends TestCase public function testCanPrintUsingThePlainTextPrinter() { $service = new HelloWorldService(new PlainTextFormatter()); - $this->assertEquals('Hello World', $service->get()); + $this->assertSame('Hello World', $service->get()); // now change the implementation and use the HtmlFormatter instead $service->setImplementation(new HtmlFormatter()); - $this->assertEquals('
Hello World
', $service->get()); + $this->assertSame('Hello World
', $service->get()); } } diff --git a/Structural/Composite/Tests/CompositeTest.php b/Structural/Composite/Tests/CompositeTest.php index da5bbb7..90b8e12 100644 --- a/Structural/Composite/Tests/CompositeTest.php +++ b/Structural/Composite/Tests/CompositeTest.php @@ -20,7 +20,7 @@ class CompositeTest extends TestCase // This is just an example, in a real world scenario it is important to remember that web browsers do not // currently support nested forms - $this->assertEquals( + $this->assertSame( '', $form->render() ); diff --git a/Structural/Decorator/Tests/DecoratorTest.php b/Structural/Decorator/Tests/DecoratorTest.php index d1c7638..6576f90 100644 --- a/Structural/Decorator/Tests/DecoratorTest.php +++ b/Structural/Decorator/Tests/DecoratorTest.php @@ -13,8 +13,8 @@ class DecoratorTest extends TestCase { $booking = new DoubleRoomBooking(); - $this->assertEquals(40, $booking->calculatePrice()); - $this->assertEquals('double room', $booking->getDescription()); + $this->assertSame(40, $booking->calculatePrice()); + $this->assertSame('double room', $booking->getDescription()); } public function testCanCalculatePriceForDoubleRoomBookingWithWiFi() @@ -22,8 +22,8 @@ class DecoratorTest extends TestCase $booking = new DoubleRoomBooking(); $booking = new WiFi($booking); - $this->assertEquals(42, $booking->calculatePrice()); - $this->assertEquals('double room with wifi', $booking->getDescription()); + $this->assertSame(42, $booking->calculatePrice()); + $this->assertSame('double room with wifi', $booking->getDescription()); } public function testCanCalculatePriceForDoubleRoomBookingWithWiFiAndExtraBed() @@ -32,7 +32,7 @@ class DecoratorTest extends TestCase $booking = new WiFi($booking); $booking = new ExtraBed($booking); - $this->assertEquals(72, $booking->calculatePrice()); - $this->assertEquals('double room with wifi with extra bed', $booking->getDescription()); + $this->assertSame(72, $booking->calculatePrice()); + $this->assertSame('double room with wifi with extra bed', $booking->getDescription()); } } diff --git a/Structural/DependencyInjection/Tests/DependencyInjectionTest.php b/Structural/DependencyInjection/Tests/DependencyInjectionTest.php index c2375f3..e0e5bd2 100644 --- a/Structural/DependencyInjection/Tests/DependencyInjectionTest.php +++ b/Structural/DependencyInjection/Tests/DependencyInjectionTest.php @@ -13,6 +13,6 @@ class DependencyInjectionTest extends TestCase $config = new DatabaseConfiguration('localhost', 3306, 'domnikl', '1234'); $connection = new DatabaseConnection($config); - $this->assertEquals('domnikl:1234@localhost:3306', $connection->getDsn()); + $this->assertSame('domnikl:1234@localhost:3306', $connection->getDsn()); } } diff --git a/Structural/Facade/Tests/FacadeTest.php b/Structural/Facade/Tests/FacadeTest.php index de75ae2..0017eea 100644 --- a/Structural/Facade/Tests/FacadeTest.php +++ b/Structural/Facade/Tests/FacadeTest.php @@ -31,6 +31,6 @@ class FacadeTest extends TestCase $facade->turnOn(); // but you can also access the underlying components - $this->assertEquals('Linux', $os->getName()); + $this->assertSame('Linux', $os->getName()); } } diff --git a/Structural/FluentInterface/Tests/FluentInterfaceTest.php b/Structural/FluentInterface/Tests/FluentInterfaceTest.php index ff1c058..8cea81b 100644 --- a/Structural/FluentInterface/Tests/FluentInterfaceTest.php +++ b/Structural/FluentInterface/Tests/FluentInterfaceTest.php @@ -14,6 +14,6 @@ class FluentInterfaceTest extends TestCase ->from('foobar', 'f') ->where('f.bar = ?'); - $this->assertEquals('SELECT foo, bar FROM foobar AS f WHERE f.bar = ?', (string) $query); + $this->assertSame('SELECT foo, bar FROM foobar AS f WHERE f.bar = ?', (string) $query); } } diff --git a/Structural/Flyweight/Tests/FlyweightTest.php b/Structural/Flyweight/Tests/FlyweightTest.php index 7380f46..492d15b 100644 --- a/Structural/Flyweight/Tests/FlyweightTest.php +++ b/Structural/Flyweight/Tests/FlyweightTest.php @@ -20,7 +20,7 @@ class FlyweightTest extends TestCase $flyweight = $factory->get($char); $rendered = $flyweight->render($font); - $this->assertEquals(sprintf('Character %s with font %s', $char, $font), $rendered); + $this->assertSame(sprintf('Character %s with font %s', $char, $font), $rendered); } } diff --git a/Structural/Proxy/Tests/ProxyTest.php b/Structural/Proxy/Tests/ProxyTest.php index 1fe363c..ec62b48 100644 --- a/Structural/Proxy/Tests/ProxyTest.php +++ b/Structural/Proxy/Tests/ProxyTest.php @@ -13,12 +13,12 @@ class ProxyTest extends TestCase $bankAccount->deposit(30); // this time balance is being calculated - $this->assertEquals(30, $bankAccount->getBalance()); + $this->assertSame(30, $bankAccount->getBalance()); // inheritance allows for BankAccountProxy to behave to an outsider exactly like ServerBankAccount $bankAccount->deposit(50); // this time the previously calculated balance is returned again without re-calculating it - $this->assertEquals(30, $bankAccount->getBalance()); + $this->assertSame(30, $bankAccount->getBalance()); } }