phpmock\Mock::enable PHP Method

enable() public method

Enables this mock.
See also: Mock::disable()
See also: Mock::disableAll()
public enable ( )
    public function enable()
    {
        $registry = MockRegistry::getInstance();
        if ($registry->isRegistered($this)) {
            throw new MockEnabledException("{$this->name} is already enabled." . "Call disable() on the existing mock.");
        }
        $this->define();
        $registry->register($this);
    }

Usage Example

コード例 #1
0
ファイル: MockNamespaceTest.php プロジェクト: OndraM/php-mock
 /**
  * Tests redefining mocks in a different namespace.
  *
  * @test
  * @dataprovider provideTestNamespace
  */
 public function testRedefiningNamespaces()
 {
     $this->builder->setNamespace(__NAMESPACE__);
     $this->mock = $this->builder->build();
     $this->mock->enable();
     $this->assertEquals(1234, time());
 }
All Usage Examples Of phpmock\Mock::enable