コード例 #1
0
ファイル: SelectTest.php プロジェクト: pp3345/ppframework
 protected function setUp()
 {
     \Mockery::resetContainer();
     $this->mockDatabase = \Mockery::mock("alias:" . Database::class);
     $this->mockDatabase->selectForUpdate = false;
     $this->mockDatabase->shouldReceive("getDefault")->andReturn($this->mockDatabase);
     $this->mockDatabase->shouldReceive("prepare")->with("SELECT * FROM `ModelStubATable` WHERE `id` = ? FOR UPDATE")->globally()->ordered();
     $this->mockDatabase->shouldReceive("prepare")->with("SELECT * FROM `ModelStubATable` WHERE `id` = ?")->globally()->ordered();
     $this->mockDatabase->shouldReceive("prepare")->with("SELECT * FROM `ModelStubBTable` WHERE `id` = ? FOR UPDATE")->globally()->ordered();
     $this->mockDatabase->shouldReceive("prepare")->with("SELECT * FROM `ModelStubBTable` WHERE `id` = ?")->globally()->ordered();
     ModelStubA::initialize();
     ModelStubB::initialize();
 }
コード例 #2
0
ファイル: ContainerTest.php プロジェクト: jyothid/Xdocker
 public function testInterfacesCanHaveAssertions()
 {
     \Mockery::setContainer($this->container);
     $m = $this->container->mock('stdClass, ArrayAccess, Countable, Traversable');
     $m->shouldReceive('foo')->once();
     $m->foo();
     $this->container->mockery_verify();
     \Mockery::resetContainer();
 }
コード例 #3
0
 /**
  * @issue issue/35
  */
 public function testCallingSelfOnlyReturnsLastMockCreatedOrCurrentMockBeingProgrammedSinceTheyAreOneAndTheSame()
 {
     \Mockery::setContainer($this->container);
     $m = $this->container->mock('MockeryTestFoo');
     $this->assertFalse($this->container->self() instanceof MockeryTestFoo2);
     //$m = $this->container->mock('MockeryTestFoo2');
     //$this->assertTrue($this->container->self() instanceof MockeryTestFoo2);
     //$m = $this->container->mock('MockeryTestFoo');
     //$this->assertFalse(\Mockery::self() instanceof MockeryTestFoo2);
     //$this->assertTrue(\Mockery::self() instanceof MockeryTestFoo);
     \Mockery::resetContainer();
 }
コード例 #4
0
ファイル: SshTest.php プロジェクト: sayiho/Jumper
 /**
  * @test
  */
 public function sshConnectionShouldBeCloseWhenCommunicatorIsDestroy()
 {
     m::resetContainer($this->ssh);
     $this->ssh->shouldReceive('disconnect')->once();
     $this->communicator->__destruct();
 }
コード例 #5
0
ファイル: ContainerTest.php プロジェクト: cordoval/mockery
 /**
  * @issue issue/21
  */
 public function testClassDeclaringUnsetDoesNotThrowException()
 {
     \Mockery::setContainer($this->container);
     $m = $this->container->mock('MockeryTest_UnsetMethod');
     $this->container->mockery_verify();
     \Mockery::resetContainer();
 }