%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11584/task/11584/cwd/html/water/vendor/codeception/stub/tests/ |
Upload File : |
<?php require_once __DIR__ .'/ResetMocks.php'; class StubTraitTest extends \Codeception\PHPUnit\TestCase { use ResetMocks; use \Codeception\Test\Feature\Stub; /** * @var DummyClass */ protected $dummy; public function _setUp() { require_once $file = __DIR__. '/_data/DummyOverloadableClass.php'; require_once $file = __DIR__. '/_data/DummyClass.php'; $this->dummy = new DummyClass(true); } public function testMakeStubs() { $this->dummy = $this->make('DummyClass', ['helloWorld' => 'bye']); $this->assertEquals('bye', $this->dummy->helloWorld()); $this->assertEquals('good bye', $this->dummy->goodByeWorld()); $this->dummy = $this->makeEmpty('DummyClass', ['helloWorld' => 'bye']); $this->assertEquals('bye', $this->dummy->helloWorld()); $this->assertNull($this->dummy->goodByeWorld()); $this->dummy = $this->makeEmptyExcept('DummyClass', 'goodByeWorld', ['helloWorld' => 'bye']); $this->assertEquals('bye', $this->dummy->helloWorld()); $this->assertEquals('good bye', $this->dummy->goodByeWorld()); $this->assertNull($this->dummy->exceptionalMethod()); } public function testConstructStubs() { $this->dummy = $this->construct('DummyClass', ['!'], ['helloWorld' => 'bye']); $this->assertEquals('constructed: !', $this->dummy->getCheckMe()); $this->assertEquals('bye', $this->dummy->helloWorld()); $this->assertEquals('good bye', $this->dummy->goodByeWorld()); $this->dummy = $this->constructEmpty('DummyClass', ['!'], ['helloWorld' => 'bye']); $this->assertNull($this->dummy->getCheckMe()); $this->assertEquals('bye', $this->dummy->helloWorld()); $this->assertNull($this->dummy->goodByeWorld()); $this->dummy = $this->constructEmptyExcept('DummyClass', 'getCheckMe', ['!'], ['helloWorld' => 'bye']); $this->assertEquals('constructed: !', $this->dummy->getCheckMe()); $this->assertEquals('bye', $this->dummy->helloWorld()); $this->assertNull($this->dummy->goodByeWorld()); $this->assertNull($this->dummy->exceptionalMethod()); } public function testMakeMocks() { $this->dummy = $this->make('DummyClass', [ 'helloWorld' => \Codeception\Stub\Expected::once() ]); $this->dummy->helloWorld(); try { $this->dummy->helloWorld(); } catch (Exception $e) { $this->assertTrue(strpos('was not expected to be called more than once', $e->getMessage()) >= 0, 'String contains'); $this->resetMockObjects(); return; } $this->fail('No exception thrown'); } }