Exemple #1
0
 /**
  * @test
  * @covers SlimApp\Validator::__construct
  * @uses SlimApp\Validator::setMapper
  * @uses SlimApp\Validator::getMapper
  */
 public function constructor_sets_mapper_if_given()
 {
     $mapper = $this->getMockBuilder('SlimApp\\Db\\Mapper')->getMock();
     $mockNoMapper = $this->getMockBuilder('SlimApp\\Validator')->getMockForAbstractClass();
     $mockMapper = $this->getMockBuilder('SlimApp\\Validator')->setConstructorArgs([$mapper])->getMockForAbstractClass();
     $validatorNoMapper = new \SebastianBergmann\PeekAndPoke\Proxy($mockNoMapper);
     $validatorMapper = new \SebastianBergmann\PeekAndPoke\Proxy($mockMapper);
     $resultMapperSet = $validatorMapper->getMapper();
     $resultMapperNotSet = $validatorNoMapper->getMapper();
     $this->assertNull($resultMapperNotSet);
     $this->assertSame($resultMapperSet, $mapper);
 }