コード例 #1
0
 public function testOverrideValidator()
 {
     $factory = new ValidatorFactory();
     $this->assertInstanceOf(Rules\MinValidator::class, $factory->min(5));
     $factory->register(__NAMESPACE__);
     $this->assertInstanceOf(MinValidator::class, $factory->min(5));
 }
コード例 #2
0
 public function testFactory()
 {
     $factory = new ValidatorFactory();
     // singleton
     static::assertSame($factory->integer(), $factory->integer());
     static::assertSame($factory->string(), $factory->string());
     // new creation : this is not singleton because it has parameter
     static::assertNotSame($factory->min(5), $factory->min(5));
 }