assertTrue($provider->extension('foo.jpg', compact('provider'))); $this->assertFalse($provider->extension('foo.jpg', ['png'], compact('provider'))); } /** * Tests that it is possible to use a custom object as the provider to * be decorated * * @return void */ public function testCustomObject() { $mock = $this->getMockBuilder('\Cake\Validation\Validator') ->setMethods(['field']) ->getMock(); $mock->expects($this->once()) ->method('field') ->with('first', null) ->will($this->returnValue(true)); $provider = new RulesProvider($mock); $provider->field('first', compact('provider')); } }