Replaced with strict assertions

This commit is contained in:
Samuel NELA
2018-09-29 16:27:02 +02:00
parent e68d7b213e
commit 16d6f8740d
17 changed files with 36 additions and 36 deletions

View File

@@ -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));
}
}

View File

@@ -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());
}
}

View File

@@ -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());
}
}

View File

@@ -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
);

View File

@@ -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());
}
}

View File

@@ -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());
}
}

View File

@@ -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);
}
}

View File

@@ -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',