_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q19600
HTTP_ConditionalGet._isCacheValid
train
protected function _isCacheValid() { if (null === $this->_etag) { // lmTime is copied to ETag, so this condition implies that the // server sent neither ETag nor Last-Modified, so the client can't // possibly has a valid cache. return false; } ...
php
{ "resource": "" }
q19601
Minify_Cache_File.store
train
public function store($id, $data) { $flag = $this->locking ? LOCK_EX : null; $file = $this->path . '/' . $id; if (! @file_put_contents($file, $data, $flag)) { $this->logger->warning("Minify_Cache_File: Write failed to '$file'"); } // write control if ($d...
php
{ "resource": "" }
q19602
Minify_Cache_File.isValid
train
public function isValid($id, $srcMtime) { $file = $this->path . '/' . $id; return (is_file($file) && (filemtime($file) >= $srcMtime)); }
php
{ "resource": "" }
q19603
Minify_Cache_File.display
train
public function display($id) { if (!$this->locking) { readfile($this->path . '/' . $id); return; } $fp = fopen($this->path . '/' . $id, 'rb'); flock($fp, LOCK_SH); fpassthru($fp); flock($fp, LOCK_UN); fclose($fp); }
php
{ "resource": "" }
q19604
Minify_Cache_File.fetch
train
public function fetch($id) { if (!$this->locking) { return file_get_contents($this->path . '/' . $id); } $fp = fopen($this->path . '/' . $id, 'rb'); if (!$fp) { return false; } flock($fp, LOCK_SH); $ret = stream_get_contents($fp); ...
php
{ "resource": "" }
q19605
Minify_NailgunClosureCompiler.getServerCommandLine
train
protected function getServerCommandLine() { $this->checkJar(self::$ngJarFile); $this->checkJar(self::$jarFile); $classPath = array( self::$ngJarFile, self::$jarFile, ); // The command for the server that should show up in the process list $se...
php
{ "resource": "" }
q19606
Minify_Env.normalizePath
train
public function normalizePath($path) { $realpath = realpath($path); if ($realpath) { $path = $realpath; } $path = str_replace('\\', '/', $path); $path = rtrim($path, '/'); if (substr($path, 1, 1) === ':') { $path = lcfirst($path); } ...
php
{ "resource": "" }
q19607
Minify_Controller_Files.createConfiguration
train
public function createConfiguration(array $options) { // strip controller options $files = $options['files']; // if $files is a single object, casting will break it if (is_object($files)) { $files = array($files); } elseif (! is_array($files)) { $file...
php
{ "resource": "" }
q19608
Minify_Lines.minify
train
public static function minify($content, $options = array()) { $id = (isset($options['id']) && $options['id']) ? $options['id'] : ''; $content = str_replace("\r\n", "\n", $content); $lines = explode("\n", $content); $numLines = count($lines); // determine left padding ...
php
{ "resource": "" }
q19609
Minify_Lines._eolInComment
train
private static function _eolInComment($line, $inComment) { while (strlen($line)) { if ($inComment) { // only "*/" can end the comment $index = self::_find($line, '*/'); if ($index === false) { return true; } ...
php
{ "resource": "" }
q19610
Minify_Lines._find
train
private static function _find($str, $token) { switch ($token) { case '//': $fakes = array( '://' => 1, '"//' => 1, '\'//' => 1, '".//' => 2, '\'.//' => 2, ); ...
php
{ "resource": "" }
q19611
Minify_CSS_Compressor._fontFamilyCB
train
protected function _fontFamilyCB($m) { // Issue 210: must not eliminate WS between words in unquoted families $flags = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY; $pieces = preg_split('/(\'[^\']+\'|"[^"]+")/', $m[1], null, $flags); $out = 'font-family:'; while (null !== ...
php
{ "resource": "" }
q19612
HTTP_Encoder.getAcceptedEncoding
train
public static function getAcceptedEncoding($allowCompress = true, $allowDeflate = true) { // @link http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html if (! isset($_SERVER['HTTP_ACCEPT_ENCODING']) || self::isBuggyIe()) { return array('', ''); } $ae = $_SER...
php
{ "resource": "" }
q19613
HTTP_Encoder.output
train
public static function output($content, $compressionLevel = null) { if (null === $compressionLevel) { $compressionLevel = self::$compressionLevel; } $he = new HTTP_Encoder(array('content' => $content)); $ret = $he->encode($compressionLevel); $he->sendAll(); ...
php
{ "resource": "" }
q19614
HTTP_Encoder.isBuggyIe
train
public static function isBuggyIe() { if (empty($_SERVER['HTTP_USER_AGENT'])) { return false; } $ua = $_SERVER['HTTP_USER_AGENT']; // quick escape for non-IEs if (0 !== strpos($ua, 'Mozilla/4.0 (compatible; MSIE ') || false !== strpos($ua, 'Opera')) { ...
php
{ "resource": "" }
q19615
Minify_ScssCssSource.getCache
train
private function getCache() { // cache for single run // so that getLastModified and getContent in single request do not add additional cache roundtrips (i.e memcache) if (isset($this->parsed)) { return $this->parsed; } // check from cache first $cache = ...
php
{ "resource": "" }
q19616
Minify_HTML_Helper.getUri
train
public static function getUri($keyOrFiles, $opts = array()) { $opts = array_merge(array( // default options 'farExpires' => true, 'debug' => false, 'charset' => 'UTF-8', 'minAppUri' => '/min', 'rewriteWorks' => true, 'groupsConfigFile' ...
php
{ "resource": "" }
q19617
Minify_HTML_Helper.getRawUri
train
public function getRawUri($farExpires = true, $debug = false) { $path = rtrim($this->minAppUri, '/') . '/'; if (! $this->rewriteWorks) { $path .= '?'; } if (null === $this->_groupKey) { // @todo: implement shortest uri $path = self::_getShortestUri...
php
{ "resource": "" }
q19618
Minify_HTML_Helper.setFiles
train
public function setFiles($files, $checkLastModified = true) { $this->_groupKey = null; if ($checkLastModified) { $this->_lastModified = self::getLastModified($files); } // normalize paths like in /min/f=<paths> foreach ($files as $k => $file) { if (0 =...
php
{ "resource": "" }
q19619
Minify_HTML_Helper.setGroup
train
public function setGroup($key, $checkLastModified = true) { $this->_groupKey = $key; if ($checkLastModified) { if (! $this->groupsConfigFile) { $this->groupsConfigFile = self::app()->groupsConfigPath; } if (is_file($this->groupsConfigFile)) { ...
php
{ "resource": "" }
q19620
Minify_HTML_Helper._getCommonCharAtPos
train
protected static function _getCommonCharAtPos($arr, $pos) { if (!isset($arr[0][$pos])) { return ''; } $c = $arr[0][$pos]; $l = count($arr); if ($l === 1) { return $c; } for ($i = 1; $i < $l; ++$i) { if ($arr[$i][$pos] !== $c...
php
{ "resource": "" }
q19621
Minify.getDefaultOptions
train
public function getDefaultOptions() { return array( 'isPublic' => true, 'encodeOutput' => function_exists('gzdeflate'), 'encodeMethod' => null, // determine later 'encodeLevel' => 9, 'minifiers' => array( Minify::TYPE_JS => array('...
php
{ "resource": "" }
q19622
Minify.combine
train
public function combine($sources, $options = array()) { $tmpCache = $this->cache; $this->cache = new Minify_Cache_Null(); $env = new Minify_Env(); $sourceFactory = new Minify_Source_Factory($env, array( 'checkAllowDirs' => false, ), $this->cache); $contro...
php
{ "resource": "" }
q19623
Minify.errorExit
train
public function errorExit($header, $url = '', $msgHtml = '') { $url = htmlspecialchars($url, ENT_QUOTES); list(,$h1) = explode(' ', $header, 2); $h1 = htmlspecialchars($h1); // FastCGI environments require 3rd arg to header() to be set list(, $code) = explode(' ', $header, 3)...
php
{ "resource": "" }
q19624
Minify.nullMinifier
train
public static function nullMinifier($content) { if (isset($content[0]) && $content[0] === "\xef") { $content = substr($content, 3); } $content = str_replace("\r\n", "\n", $content); return trim($content); }
php
{ "resource": "" }
q19625
Minify.setupUriRewrites
train
protected function setupUriRewrites() { foreach ($this->sources as $key => $source) { $file = $this->env->normalizePath($source->getFilePath()); $minifyOptions = $source->getMinifierOptions(); if ($file && !isset($minifyOptions['currentDir']) ...
php
{ "resource": "" }
q19626
Minify.setupDebug
train
protected function setupDebug() { foreach ($this->sources as $source) { $source->setMinifier(array('Minify_Lines', 'minify')); $id = $source->getId(); $source->setMinifierOptions(array( 'id' => (is_file($id) ? basename($id) : $id), )); ...
php
{ "resource": "" }
q19627
Minify.combineMinify
train
protected function combineMinify() { $type = $this->options['contentType']; // ease readability // when combining scripts, make sure all statements separated and // trailing single line comment is terminated $implodeSeparator = ($type === self::TYPE_JS) ? "\n;" : ''; // all...
php
{ "resource": "" }
q19628
Minify._getCacheId
train
protected function _getCacheId($prefix = 'minify') { $name = preg_replace('/[^a-zA-Z0-9\\.=_,]/', '', $this->selectionId); $name = preg_replace('/\\.+/', '.', $name); $name = substr($name, 0, 100 - 34 - strlen($prefix)); $md5 = md5(serialize(array( Minify_SourceSet::getDi...
php
{ "resource": "" }
q19629
Minify_JS_ClosureCompiler.min
train
public function min($js) { $postBody = $this->buildPostBody($js); if ($this->maxBytes > 0) { $bytes = (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) ? mb_strlen($postBody, '8bit') : strlen($postBody); if ($bytes...
php
{ "resource": "" }
q19630
Minify_JS_ClosureCompiler.getResponse
train
protected function getResponse($postBody) { $allowUrlFopen = preg_match('/1|yes|on|true/i', ini_get('allow_url_fopen')); if ($allowUrlFopen) { $contents = file_get_contents($this->serviceUrl, false, stream_context_create(array( 'http' => array( 'metho...
php
{ "resource": "" }
q19631
Minify_JS_ClosureCompiler.buildPostBody
train
protected function buildPostBody($js, $returnErrors = false) { return http_build_query( array_merge( self::$DEFAULT_OPTIONS, $this->additionalOptions, array( 'js_code' => $js, 'output_info' => ($returnErrors ...
php
{ "resource": "" }
q19632
ChromeDriverCommand.extract
train
protected function extract($archive) { $zip = new ZipArchive; $zip->open($archive); $zip->extractTo($this->directory); $binary = $zip->getNameIndex(0); $zip->close(); unlink($archive); return $binary; }
php
{ "resource": "" }
q19633
ChromeDriverCommand.rename
train
protected function rename($binary, $os) { $newName = str_replace('chromedriver', 'chromedriver-'.$os, $binary); rename($this->directory.$binary, $this->directory.$newName); chmod($this->directory.$newName, 0755); }
php
{ "resource": "" }
q19634
WaitsForElements.whenAvailable
train
public function whenAvailable($selector, Closure $callback, $seconds = null) { return $this->waitFor($selector, $seconds)->with($selector, $callback); }
php
{ "resource": "" }
q19635
WaitsForElements.waitFor
train
public function waitFor($selector, $seconds = null) { $message = $this->formatTimeOutMessage('Waited %s seconds for selector', $selector); return $this->waitUsing($seconds, 100, function () use ($selector) { return $this->resolver->findOrFail($selector)->isDisplayed(); }, $messa...
php
{ "resource": "" }
q19636
WaitsForElements.waitUntilMissing
train
public function waitUntilMissing($selector, $seconds = null) { $message = $this->formatTimeOutMessage('Waited %s seconds for removal of selector', $selector); return $this->waitUsing($seconds, 100, function () use ($selector) { try { $missing = ! $this->resolver->findOrF...
php
{ "resource": "" }
q19637
WaitsForElements.waitForText
train
public function waitForText($text, $seconds = null) { $text = Arr::wrap($text); $message = $this->formatTimeOutMessage('Waited %s seconds for text', implode("', '", $text)); return $this->waitUsing($seconds, 100, function () use ($text) { return Str::contains($this->resolver->f...
php
{ "resource": "" }
q19638
WaitsForElements.waitForLink
train
public function waitForLink($link, $seconds = null) { $message = $this->formatTimeOutMessage('Waited %s seconds for link', $link); return $this->waitUsing($seconds, 100, function () use ($link) { return $this->seeLink($link); }, $message); }
php
{ "resource": "" }
q19639
WaitsForElements.waitForLocation
train
public function waitForLocation($path, $seconds = null) { $message = $this->formatTimeOutMessage('Waited %s seconds for location', $path); return $this->waitUntil("window.location.pathname == '{$path}'", $seconds, $message); }
php
{ "resource": "" }
q19640
WaitsForElements.waitForRoute
train
public function waitForRoute($route, $parameters = [], $seconds = null) { return $this->waitForLocation(route($route, $parameters, false), $seconds); }
php
{ "resource": "" }
q19641
WaitsForElements.waitUntil
train
public function waitUntil($script, $seconds = null, $message = null) { if (! Str::startsWith($script, 'return ')) { $script = 'return '.$script; } if (! Str::endsWith($script, ';')) { $script = $script.';'; } return $this->waitUsing($seconds, 100, fu...
php
{ "resource": "" }
q19642
WaitsForElements.waitUntilVue
train
public function waitUntilVue($key, $value, $componentSelector = null, $seconds = null) { $this->waitUsing($seconds, 100, function () use ($key, $value, $componentSelector) { return $value == $this->vueAttribute($componentSelector, $key); }); return $this; }
php
{ "resource": "" }
q19643
WaitsForElements.waitForDialog
train
public function waitForDialog($seconds = null) { $seconds = is_null($seconds) ? static::$waitSeconds : $seconds; $this->driver->wait($seconds, 100)->until( WebDriverExpectedCondition::alertIsPresent(), "Waited {$seconds} seconds for dialog." ); return $this; }
php
{ "resource": "" }
q19644
WaitsForElements.waitForReload
train
public function waitForReload($callback = null, $seconds = null) { $token = Str::random(); $this->driver->executeScript("window['{$token}'] = {};"); if ($callback) { $callback($this); } return $this->waitUsing($seconds, 100, function () use ($token) { ...
php
{ "resource": "" }
q19645
WaitsForElements.waitUsing
train
public function waitUsing($seconds, $interval, Closure $callback, $message = null) { $seconds = is_null($seconds) ? static::$waitSeconds : $seconds; $this->pause($interval); $started = Carbon::now(); while (true) { try { if ($callback()) { ...
php
{ "resource": "" }
q19646
InteractsWithAuthentication.loginAs
train
public function loginAs($userId, $guard = null) { $userId = method_exists($userId, 'getKey') ? $userId->getKey() : $userId; return $this->visit(rtrim('/_dusk/login/'.$userId.'/'.$guard, '/')); }
php
{ "resource": "" }
q19647
Dusk.duskEnvironment
train
protected static function duskEnvironment($options) { if (! isset($options['environments'])) { return false; } if (is_string($options['environments'])) { $options['environments'] = [$options['environments']]; } if (! is_array($options['environments']...
php
{ "resource": "" }
q19648
InteractsWithMouse.moveMouse
train
public function moveMouse($xOffset, $yOffset) { (new WebDriverActions($this->driver))->moveByOffset( $xOffset, $yOffset )->perform(); return $this; }
php
{ "resource": "" }
q19649
InteractsWithMouse.mouseover
train
public function mouseover($selector) { $element = $this->resolver->findOrFail($selector); $this->driver->getMouse()->mouseMove($element->getCoordinates()); return $this; }
php
{ "resource": "" }
q19650
InteractsWithMouse.click
train
public function click($selector = null) { if (is_null($selector)) { (new WebDriverActions($this->driver))->click()->perform(); } else { $this->resolver->findOrFail($selector)->click(); } return $this; }
php
{ "resource": "" }
q19651
InteractsWithMouse.rightClick
train
public function rightClick($selector = null) { if (is_null($selector)) { (new WebDriverActions($this->driver))->contextClick()->perform(); } else { (new WebDriverActions($this->driver))->contextClick( $this->resolver->findOrFail($selector) )->perfo...
php
{ "resource": "" }
q19652
ProvidesBrowser.browse
train
public function browse(Closure $callback) { $browsers = $this->createBrowsersFor($callback); try { $callback(...$browsers->all()); } catch (Exception $e) { $this->captureFailuresFor($browsers); throw $e; } catch (Throwable $e) { $this...
php
{ "resource": "" }
q19653
ProvidesBrowser.createBrowsersFor
train
protected function createBrowsersFor(Closure $callback) { if (count(static::$browsers) === 0) { static::$browsers = collect([$this->newBrowser($this->createWebDriver())]); } $additional = $this->browsersNeededFor($callback) - 1; for ($i = 0; $i < $additional; $i++) { ...
php
{ "resource": "" }
q19654
ProvidesBrowser.captureFailuresFor
train
protected function captureFailuresFor($browsers) { $browsers->each(function ($browser, $key) { $name = str_replace('\\', '_', get_class($this)).'_'.$this->getName(false); $browser->screenshot('failure-'.$name.'-'.$key); }); }
php
{ "resource": "" }
q19655
ProvidesBrowser.storeConsoleLogsFor
train
protected function storeConsoleLogsFor($browsers) { $browsers->each(function ($browser, $key) { $name = str_replace('\\', '_', get_class($this)).'_'.$this->getName(false); $browser->storeConsoleLog($name.'-'.$key); }); }
php
{ "resource": "" }
q19656
ChromeProcess.toProcess
train
public function toProcess(array $arguments = []) { if ($this->driver) { return $this->process($arguments); } if ($this->onWindows()) { $this->driver = realpath(__DIR__.'/../../bin/chromedriver-win.exe'); } elseif ($this->onMac()) { $this->driver =...
php
{ "resource": "" }
q19657
ChromeProcess.process
train
protected function process(array $arguments = []) { return new Process( array_merge([realpath($this->driver)], $arguments), null, $this->chromeEnvironment() ); }
php
{ "resource": "" }
q19658
DuskCommand.phpunitArguments
train
protected function phpunitArguments($options) { $options = array_values(array_filter($options, function ($option) { return ! Str::startsWith($option, '--env='); })); if (! file_exists($file = base_path('phpunit.dusk.xml'))) { $file = base_path('phpunit.dusk.xml.dist'...
php
{ "resource": "" }
q19659
DuskCommand.purgeScreenshots
train
protected function purgeScreenshots() { $path = base_path('tests/Browser/screenshots'); if (! is_dir($path)) { return; } $files = Finder::create()->files() ->in($path) ->name('failure-*'); foreach ($files as $file...
php
{ "resource": "" }
q19660
DuskCommand.withDuskEnvironment
train
protected function withDuskEnvironment($callback) { if (file_exists(base_path($this->duskFile()))) { if (file_get_contents(base_path('.env')) !== file_get_contents(base_path($this->duskFile()))) { $this->backupEnvironment(); } $this->refreshEnvironment();...
php
{ "resource": "" }
q19661
DuskCommand.refreshEnvironment
train
protected function refreshEnvironment() { // BC fix to support Dotenv ^2.2 if (! method_exists(Dotenv::class, 'create')) { (new Dotenv(base_path()))->overload(); return; } Dotenv::create(base_path())->overload(); }
php
{ "resource": "" }
q19662
DuskCommand.writeConfiguration
train
protected function writeConfiguration() { if (! file_exists($file = base_path('phpunit.dusk.xml')) && ! file_exists(base_path('phpunit.dusk.xml.dist'))) { copy(realpath(__DIR__.'/../../stubs/phpunit.xml'), $file); return; } $this->hasPhpUnitConfiguration...
php
{ "resource": "" }
q19663
MakesAssertions.assertTitleContains
train
public function assertTitleContains($title) { PHPUnit::assertTrue( Str::contains($this->driver->getTitle(), $title), "Did not see expected value [{$title}] within title [{$this->driver->getTitle()}]." ); return $this; }
php
{ "resource": "" }
q19664
MakesAssertions.assertHasCookie
train
public function assertHasCookie($name, $decrypt = true) { $cookie = $decrypt ? $this->cookie($name) : $this->plainCookie($name); PHPUnit::assertTrue( ! is_null($cookie), "Did not find expected cookie [{$name}]." ); return $this; }
php
{ "resource": "" }
q19665
MakesAssertions.assertCookieValue
train
public function assertCookieValue($name, $value, $decrypt = true) { $actual = $decrypt ? $this->cookie($name) : $this->plainCookie($name); PHPUnit::assertEquals( $value, $actual, "Cookie [{$name}] had value [{$actual}], but expected [{$value}]." ); return $t...
php
{ "resource": "" }
q19666
MakesAssertions.assertSeeIn
train
public function assertSeeIn($selector, $text) { $fullSelector = $this->resolver->format($selector); $element = $this->resolver->findOrFail($selector); PHPUnit::assertTrue( Str::contains($element->getText(), $text), "Did not see expected text [{$text}] within element...
php
{ "resource": "" }
q19667
MakesAssertions.assertDontSeeIn
train
public function assertDontSeeIn($selector, $text) { $fullSelector = $this->resolver->format($selector); $element = $this->resolver->findOrFail($selector); PHPUnit::assertFalse( Str::contains($element->getText(), $text), "Saw unexpected text [{$text}] within element ...
php
{ "resource": "" }
q19668
MakesAssertions.assertSourceHas
train
public function assertSourceHas($code) { PHPUnit::assertTrue( Str::contains($this->driver->getPageSource(), $code), "Did not find expected source code [{$code}]" ); return $this; }
php
{ "resource": "" }
q19669
MakesAssertions.assertSourceMissing
train
public function assertSourceMissing($code) { PHPUnit::assertFalse( Str::contains($this->driver->getPageSource(), $code), "Found unexpected source code [{$code}]" ); return $this; }
php
{ "resource": "" }
q19670
MakesAssertions.assertSeeLink
train
public function assertSeeLink($link) { if ($this->resolver->prefix) { $message = "Did not see expected link [{$link}] within [{$this->resolver->prefix}]."; } else { $message = "Did not see expected link [{$link}]."; } PHPUnit::assertTrue( $this->s...
php
{ "resource": "" }
q19671
MakesAssertions.assertDontSeeLink
train
public function assertDontSeeLink($link) { if ($this->resolver->prefix) { $message = "Saw unexpected link [{$link}] within [{$this->resolver->prefix}]."; } else { $message = "Saw unexpected link [{$link}]."; } PHPUnit::assertFalse( $this->seeLink(...
php
{ "resource": "" }
q19672
MakesAssertions.seeLink
train
public function seeLink($link) { $this->ensurejQueryIsAvailable(); $selector = addslashes(trim($this->resolver->format("a:contains('{$link}')"))); $script = <<<JS var link = jQuery.find("{$selector}"); return link.length > 0 && jQuery(link).is(':visible'); JS; ...
php
{ "resource": "" }
q19673
MakesAssertions.assertInputValue
train
public function assertInputValue($field, $value) { PHPUnit::assertEquals( $value, $this->inputValue($field), "Expected value [{$value}] for the [{$field}] input does not equal the actual value [{$this->inputValue($field)}]." ); return $this; }
php
{ "resource": "" }
q19674
MakesAssertions.assertInputValueIsNot
train
public function assertInputValueIsNot($field, $value) { PHPUnit::assertNotEquals( $value, $this->inputValue($field), "Value [{$value}] for the [{$field}] input should not equal the actual value." ); return $this; }
php
{ "resource": "" }
q19675
MakesAssertions.inputValue
train
public function inputValue($field) { $element = $this->resolver->resolveForTyping($field); return in_array($element->getTagName(), ['input', 'textarea']) ? $element->getAttribute('value') : $element->getText(); }
php
{ "resource": "" }
q19676
MakesAssertions.assertChecked
train
public function assertChecked($field, $value = null) { $element = $this->resolver->resolveForChecking($field, $value); PHPUnit::assertTrue( $element->isSelected(), "Expected checkbox [{$field}] to be checked, but it wasn't." ); return $this; }
php
{ "resource": "" }
q19677
MakesAssertions.assertNotChecked
train
public function assertNotChecked($field, $value = null) { $element = $this->resolver->resolveForChecking($field, $value); PHPUnit::assertFalse( $element->isSelected(), "Checkbox [{$field}] was unexpectedly checked." ); return $this; }
php
{ "resource": "" }
q19678
MakesAssertions.assertRadioSelected
train
public function assertRadioSelected($field, $value) { $element = $this->resolver->resolveForRadioSelection($field, $value); PHPUnit::assertTrue( $element->isSelected(), "Expected radio [{$field}] to be selected, but it wasn't." ); return $this; }
php
{ "resource": "" }
q19679
MakesAssertions.assertRadioNotSelected
train
public function assertRadioNotSelected($field, $value = null) { $element = $this->resolver->resolveForRadioSelection($field, $value); PHPUnit::assertFalse( $element->isSelected(), "Radio [{$field}] was unexpectedly selected." ); return $this; }
php
{ "resource": "" }
q19680
MakesAssertions.assertSelected
train
public function assertSelected($field, $value) { PHPUnit::assertTrue( $this->selected($field, $value), "Expected value [{$value}] to be selected for [{$field}], but it wasn't." ); return $this; }
php
{ "resource": "" }
q19681
MakesAssertions.assertNotSelected
train
public function assertNotSelected($field, $value) { PHPUnit::assertFalse( $this->selected($field, $value), "Unexpected value [{$value}] selected for [{$field}]." ); return $this; }
php
{ "resource": "" }
q19682
MakesAssertions.assertSelectHasOptions
train
public function assertSelectHasOptions($field, array $values) { $options = $this->resolver->resolveSelectOptions($field, $values); $options = collect($options)->unique(function (RemoteWebElement $option) { return $option->getAttribute('value'); })->all(); PHPUnit::asser...
php
{ "resource": "" }
q19683
MakesAssertions.assertSelectMissingOptions
train
public function assertSelectMissingOptions($field, array $values) { PHPUnit::assertCount( 0, $this->resolver->resolveSelectOptions($field, $values), 'Unexpected options ['.implode(',', $values)."] for selection field [{$field}]." ); return $this; }
php
{ "resource": "" }
q19684
MakesAssertions.selected
train
public function selected($field, $value) { $options = $this->resolver->resolveSelectOptions($field, (array) $value); return collect($options)->contains(function (RemoteWebElement $option) { return $option->isSelected(); }); }
php
{ "resource": "" }
q19685
MakesAssertions.assertValue
train
public function assertValue($selector, $value) { $actual = $this->resolver->findOrFail($selector)->getAttribute('value'); PHPUnit::assertEquals($value, $actual); return $this; }
php
{ "resource": "" }
q19686
MakesAssertions.assertVisible
train
public function assertVisible($selector) { $fullSelector = $this->resolver->format($selector); PHPUnit::assertTrue( $this->resolver->findOrFail($selector)->isDisplayed(), "Element [{$fullSelector}] is not visible." ); return $this; }
php
{ "resource": "" }
q19687
MakesAssertions.assertPresent
train
public function assertPresent($selector) { $fullSelector = $this->resolver->format($selector); PHPUnit::assertTrue( ! is_null($this->resolver->find($selector)), "Element [{$fullSelector}] is not present." ); return $this; }
php
{ "resource": "" }
q19688
MakesAssertions.assertMissing
train
public function assertMissing($selector) { $fullSelector = $this->resolver->format($selector); try { $missing = ! $this->resolver->findOrFail($selector)->isDisplayed(); } catch (NoSuchElementException $e) { $missing = true; } PHPUnit::assertTrue($mis...
php
{ "resource": "" }
q19689
MakesAssertions.assertDialogOpened
train
public function assertDialogOpened($message) { $actualMessage = $this->driver->switchTo()->alert()->getText(); PHPUnit::assertEquals( $message, $actualMessage, "Expected dialog message [{$message}] does not equal actual message [{$actualMessage}]." ); return...
php
{ "resource": "" }
q19690
MakesAssertions.assertEnabled
train
public function assertEnabled($field) { $element = $this->resolver->resolveForField($field); PHPUnit::assertTrue( $element->isEnabled(), "Expected element [{$field}] to be enabled, but it wasn't." ); return $this; }
php
{ "resource": "" }
q19691
MakesAssertions.assertDisabled
train
public function assertDisabled($field) { $element = $this->resolver->resolveForField($field); PHPUnit::assertFalse( $element->isEnabled(), "Expected element [{$field}] to be disabled, but it wasn't." ); return $this; }
php
{ "resource": "" }
q19692
MakesAssertions.assertFocused
train
public function assertFocused($field) { $element = $this->resolver->resolveForField($field); PHPUnit::assertTrue( $this->driver->switchTo()->activeElement()->equals($element), "Expected element [{$field}] to be focused, but it wasn't." ); return $this; }
php
{ "resource": "" }
q19693
MakesAssertions.assertNotFocused
train
public function assertNotFocused($field) { $element = $this->resolver->resolveForField($field); PHPUnit::assertFalse( $this->driver->switchTo()->activeElement()->equals($element), "Expected element [{$field}] not to be focused, but it was." ); return $this; ...
php
{ "resource": "" }
q19694
MakesAssertions.assertVue
train
public function assertVue($key, $value, $componentSelector = null) { PHPUnit::assertEquals($value, $this->vueAttribute($componentSelector, $key)); return $this; }
php
{ "resource": "" }
q19695
MakesAssertions.assertVueIsNot
train
public function assertVueIsNot($key, $value, $componentSelector = null) { PHPUnit::assertNotEquals($value, $this->vueAttribute($componentSelector, $key)); return $this; }
php
{ "resource": "" }
q19696
MakesAssertions.assertVueContains
train
public function assertVueContains($key, $value, $componentSelector = null) { $attribute = $this->vueAttribute($componentSelector, $key); PHPUnit::assertIsArray($attribute, "The attribute for key [$key] is not an array."); PHPUnit::assertContains($value, $attribute); return $this; ...
php
{ "resource": "" }
q19697
MakesAssertions.assertVueDoesNotContain
train
public function assertVueDoesNotContain($key, $value, $componentSelector = null) { $attribute = $this->vueAttribute($componentSelector, $key); PHPUnit::assertIsArray($attribute, "The attribute for key [$key] is not an array."); PHPUnit::assertNotContains($value, $attribute); return...
php
{ "resource": "" }
q19698
MakesAssertions.vueAttribute
train
public function vueAttribute($componentSelector, $key) { $fullSelector = $this->resolver->format($componentSelector); return $this->driver->executeScript( "return document.querySelector('".$fullSelector."').__vue__.".$key ); }
php
{ "resource": "" }
q19699
InteractsWithElements.clickLink
train
public function clickLink($link, $element = 'a') { $this->ensurejQueryIsAvailable(); $selector = addslashes(trim($this->resolver->format("{$element}:contains({$link}):visible"))); $this->driver->executeScript("jQuery.find(\"{$selector}\")[0].click();"); return $this; }
php
{ "resource": "" }