/** * @param ThreadableInterface $Threadable * @dataProvider threadableProvider */ public function testGetScreenlistMatches(ThreadableInterface $Threadable) { $this->setClass(new ProcessControl()); ProcessControl::killAllThreads(); $this->myTestForEmptyScreenlist(); $Threadable->spawnThread(); $RawScreenList = $this->getPrivateMethod('getRawScreenlist'); $this->assertInternalType('string', $RawScreenList); $this->assertStringStartsWith('There is a screen on', $RawScreenList); $this->assertStringEndsWith("\n", $RawScreenList); $ScreenlistMatches = $this->getPrivateMethod('getScreenlistMatches'); $this->assertRegexMatchesFormat($ScreenlistMatches, 1); $RegexMatch = $ScreenlistMatches[0][0]; $ProcessId = $ScreenlistMatches[1][0]; $ThreadKey = $ScreenlistMatches[2][0]; $this->assertContains($Threadable->getThreadKey(), $RegexMatch); $this->assertInternalType('string', $ProcessId); $this->assertGreaterThan(1, $ProcessId); $this->assertEquals($Threadable->getThreadKey(), $ThreadKey); $this->assertTrue(CommandParse::isThreadkeyValid($ThreadKey)); $Threadable->killThread(); $this->myTestForEmptyScreenlist(); }
/** * @param $Value * @dataProvider invalidThreadKeyProvider * @expectedException Axvf\Threadable\Exceptions\InvalidThreadKeyException */ public function testThreadKeyInvalid($Value) { $this->assertFalse(CommandParse::isThreadkeyValid($Value)); CommandParse::validateThreadkey($Value); }