code
stringlengths
31
1.39M
docstring
stringlengths
23
16.8k
func_name
stringlengths
1
126
language
stringclasses
1 value
repo
stringlengths
7
63
path
stringlengths
7
166
url
stringlengths
50
220
license
stringclasses
7 values
public function TearDown():void { unset($this->object); parent::tearDown(); }
Tears down the fixture, for example, closes a network connection. This method is called after a test is executed.
TearDown
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testEmail($expected, $email, $mxValidation) { $this->assertEquals($expected, $this->object->email($email, $mxValidation)); }
@dataProvider emailDataProvider @param mixed $expected @param mixed $email @param mixed $mxValidation
testEmail
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testAlphaNum($expected, $value, $allowSpaces = false, $allowDashes = false) { $this->assertEquals($expected, $this->object->alphanum($value, $allowSpaces, $allowDashes)); }
@dataProvider alphanumDataProvider @param mixed $expected @param mixed $value @param mixed $allowSpaces @param mixed $allowDashes
testAlphaNum
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testHandle($expected, $value) { $this->assertEquals($expected, $this->object->handle($value)); }
@dataProvider handleDataProvider @param mixed $expected @param mixed $value
testHandle
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testNotEmpty($expected, $value) { $this->assertEquals($expected, $this->object->notempty($value)); }
@dataProvider notEmptyDataProvider @param mixed $expected @param mixed $value
testNotEmpty
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testMin($expected, $string, $minLength) { $this->assertEquals($expected, $this->object->min($string, $minLength)); }
@dataProvider minDataProvider @param mixed $expected @param mixed $string @param mixed $minLength
testMin
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testMax($expected, $string, $maxLength) { $this->assertEquals($expected, $this->object->max($string, $maxLength)); }
@dataProvider maxDataProvider @param mixed $expected @param mixed $string @param mixed $maxLength
testMax
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testContainsNumber($expected, $string) { $this->assertEquals($expected, $this->object->containsNumber($string)); }
@dataProvider containsNumberDataProvider @param mixed $expected @param mixed $string
testContainsNumber
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testContainsUpperCase($expected, $string) { $this->assertEquals($expected, $this->object->containsUpperCase($string)); }
@dataProvider containsUpperCaseDataProvider @param mixed $expected @param mixed $string
testContainsUpperCase
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testContainsLowerCase($expected, $string) { $this->assertEquals($expected, $this->object->containsLowerCase($string)); }
@dataProvider containsLowerCaseDataProvider @param mixed $expected @param mixed $string
testContainsLowerCase
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testContainsSymbol($expected, $string) { $this->assertEquals($expected, $this->object->containsSymbol($string)); }
@dataProvider containsSymbolDataProvider @param mixed $expected @param mixed $string
testContainsSymbol
php
concretecms/concretecms
tests/tests/Utility/Service/Validation/StringsTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Utility/Service/Validation/StringsTest.php
MIT
public function testHasBannedWord(string $bannedWord, string $string): void { $service = new Service(); self::assertTrue($service->hasBannedWord($bannedWord, $string)); }
@dataProvider matchBannedWordsProvider @param string $bannedWord @param string $string
testHasBannedWord
php
concretecms/concretecms
tests/tests/Validation/BannedWordTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Validation/BannedWordTest.php
MIT
public function testHasNotBannedWord(string $bannedWord, string $string): void { $service = new Service(); self::assertNotTrue($service->hasBannedWord($bannedWord, $string)); }
@dataProvider doesNotMatchBannedWordsProvider @param string $bannedWord @param string $string
testHasNotBannedWord
php
concretecms/concretecms
tests/tests/Validation/BannedWordTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Validation/BannedWordTest.php
MIT
public function testEscapeBannedWord(string $bannedWord, string $string): void { $service = new Service(); self::assertNotTrue($service->hasBannedWord($bannedWord, $string)); }
@dataProvider invalidBannedWordsProvider @param string $bannedWord @param string $string
testEscapeBannedWord
php
concretecms/concretecms
tests/tests/Validation/BannedWordTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/Validation/BannedWordTest.php
MIT
public function testAction(array $arguments, $expectedResult) { $attributeType = Mockery::mock(AttributeType::class); $attributeType ->shouldReceive('getPackageHandle') ->withNoArgs() ->andReturn('') ; $attributeKey = Mockery::mock(AttributeKeyInterface::class); $attributeKey ->shouldReceive('getAttributeType') ->withNoArgs() ->andReturn($attributeType) ; $attributeKey ->shouldReceive('getAttributeKeyID') ->withNoArgs() ->andReturn(123) ; $view = new View($attributeKey); $actualResult = call_user_func_array([$view, 'action'], $arguments); $this->assertSame($expectedResult, $actualResult); }
@param array $arguments @param string $expectedResult @dataProvider actionProvider
testAction
php
concretecms/concretecms
tests/tests/View/AttributeViewTest.php
https://github.com/concretecms/concretecms/blob/master/tests/tests/View/AttributeViewTest.php
MIT
public function render(...$arguments): string { $variables = $this->normalizeArguments($arguments); return view('bladeJavaScript::index', [ 'javaScript' => $this->buildJavaScriptSyntax($variables), ])->render(); }
@param array ...$arguments @return string @throws \Throwable
render
php
spatie/laravel-blade-javascript
src/Renderer.php
https://github.com/spatie/laravel-blade-javascript/blob/master/src/Renderer.php
MIT
protected function buildVariableInitialization(string $key, $value) { $variableName = $this->namespace ? "window['{$this->namespace}']['{$key}']" : "window['{$key}']"; return "{$variableName} = {$this->optimizeValueForJavaScript($value)};"; }
@param string $key @param mixed $value @return string
buildVariableInitialization
php
spatie/laravel-blade-javascript
src/Renderer.php
https://github.com/spatie/laravel-blade-javascript/blob/master/src/Renderer.php
MIT
protected function optimizeValueForJavaScript($value): string { return $this->getTransformer($value)->transform($value); }
@param mixed $value @return string @throws \Spatie\BladeJavaScript\Exceptions\Untransformable
optimizeValueForJavaScript
php
spatie/laravel-blade-javascript
src/Renderer.php
https://github.com/spatie/laravel-blade-javascript/blob/master/src/Renderer.php
MIT
public function getTransformer($value): Transformer { foreach ($this->getAllTransformers() as $transformer) { if ($transformer->canTransform($value)) { return $transformer; } } throw Untransformable::noTransformerFound($value); }
@param mixed $value @return \Spatie\BladeJavaScript\Transformers\Transformer @throws \Spatie\BladeJavaScript\Exceptions\Untransformable
getTransformer
php
spatie/laravel-blade-javascript
src/Renderer.php
https://github.com/spatie/laravel-blade-javascript/blob/master/src/Renderer.php
MIT
public function transform($value) { return $value; }
@param float|int $value @return float|int
transform
php
spatie/laravel-blade-javascript
src/Transformers/NumericTransformer.php
https://github.com/spatie/laravel-blade-javascript/blob/master/src/Transformers/NumericTransformer.php
MIT
public function transform($value): string { if (method_exists($value, 'toJson')) { return $value->toJson(); } if ($value instanceof JsonSerializable || $value instanceof StdClass) { return json_encode($value); } if (! method_exists($value, '__toString')) { throw Untransformable::cannotTransformObject($value); } return "'{$value}'"; }
@param mixed $value @return string @throws \Spatie\BladeJavaScript\Exceptions\Untransformable
transform
php
spatie/laravel-blade-javascript
src/Transformers/ObjectTransformer.php
https://github.com/spatie/laravel-blade-javascript/blob/master/src/Transformers/ObjectTransformer.php
MIT
protected function getPackageProviders($app) { return [ BladeJavaScriptServiceProvider::class, ]; }
@param \Illuminate\Foundation\Application $app @return array
getPackageProviders
php
spatie/laravel-blade-javascript
tests/TestCase.php
https://github.com/spatie/laravel-blade-javascript/blob/master/tests/TestCase.php
MIT
protected function getEnvironmentSetUp($app) { $app['config']->set('blade-javascript.namespace', 'js'); $app['config']->set('view.paths', [__DIR__ . '/resources/views']); }
Set up the environment. @param \Illuminate\Foundation\Application $app
getEnvironmentSetUp
php
spatie/laravel-blade-javascript
tests/TestCase.php
https://github.com/spatie/laravel-blade-javascript/blob/master/tests/TestCase.php
MIT
public function __construct( protected array $yamlConfig = [], ) { $this->yamlConfig = array_merge(self::DEFAULT_YAML_CONFIG, $yamlConfig); }
@param array{ yaml_inline: int, yaml_indent: int, yaml_flags: int } $yamlConfig
__construct
php
spatie/phpunit-snapshot-assertions
src/Drivers/ObjectDriver.php
https://github.com/spatie/phpunit-snapshot-assertions/blob/master/src/Drivers/ObjectDriver.php
MIT
public function build(array $config) { $output = array(); // Fix path in output dir if ('/' !== substr($config['output_dir'], -1) && strlen($config['output_dir']) > 0) { $config['output_dir'] .= '/'; } // changed from css_preprocessor to css_preprocessor for 3.0 if (in_array($config['css_preprocessor'], array('sass', 'scssphp'))) { $output['bootstrap_css'] = $this->buildCssWithSass($config); } elseif ('none' !== $config['css_preprocessor']) { $output['bootstrap_css'] = $this->buildCssWithLess($config); } else { $output['bootstrap_css'] = $this->buildCssWithoutLess($config); } $output['bootstrap_js'] = $this->buildJs($config); $output['jquery'] = $this->buildJquery($config); return $output; }
Builds the assetic configuration. @param array $config @return array
build
php
braincrafted/bootstrap-bundle
DependencyInjection/AsseticConfiguration.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/DependencyInjection/AsseticConfiguration.php
MIT
protected function configureAsseticBundle(ContainerBuilder $container, array $config) { foreach (array_keys($container->getExtensions()) as $name) { switch ($name) { case 'assetic': $asseticConfig = new AsseticConfiguration; $container->prependExtensionConfig( $name, array('assets' => $asseticConfig->build($config)) ); break; } } }
@param ContainerBuilder $container The service container @param array $config The bundle configuration @return void
configureAsseticBundle
php
braincrafted/bootstrap-bundle
DependencyInjection/BraincraftedBootstrapExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/DependencyInjection/BraincraftedBootstrapExtension.php
MIT
protected function configureTwigBundle(ContainerBuilder $container) { foreach (array_keys($container->getExtensions()) as $name) { switch ($name) { case 'twig': $container->prependExtensionConfig( $name, array('form_themes' => array($this->formTemplate)) ); break; } } }
@param ContainerBuilder $container The service container @return void
configureTwigBundle
php
braincrafted/bootstrap-bundle
DependencyInjection/BraincraftedBootstrapExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/DependencyInjection/BraincraftedBootstrapExtension.php
MIT
protected function configureKnpMenuBundle(ContainerBuilder $container) { foreach (array_keys($container->getExtensions()) as $name) { switch ($name) { case 'knp_menu': $container->prependExtensionConfig( $name, array('twig' => array('template' => $this->menuTemplate)) ); break; } } }
@param ContainerBuilder $container The service container @return void
configureKnpMenuBundle
php
braincrafted/bootstrap-bundle
DependencyInjection/BraincraftedBootstrapExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/DependencyInjection/BraincraftedBootstrapExtension.php
MIT
protected function configureKnpPaginatorBundle(ContainerBuilder $container) { foreach (array_keys($container->getExtensions()) as $name) { switch ($name) { case 'knp_paginator': $container->prependExtensionConfig( $name, array('template' => array('pagination' => $this->paginationTemplate)) ); break; } } }
@param ContainerBuilder $container The service container @return void
configureKnpPaginatorBundle
php
braincrafted/bootstrap-bundle
DependencyInjection/BraincraftedBootstrapExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/DependencyInjection/BraincraftedBootstrapExtension.php
MIT
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefined(array('button_class', 'as_link')); }
Add the button_class option Add the as_link option {@inheritdoc}
configureOptions
php
braincrafted/bootstrap-bundle
Form/Extension/ButtonTypeExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Extension/ButtonTypeExtension.php
MIT
public function getExtendedType() { // map old class to new one using LegacyFormHelper return LegacyFormHelper::getType('text'); }
Returns the name of the type being extended. @return string The name of the type being extended
getExtendedType
php
braincrafted/bootstrap-bundle
Form/Extension/InputGroupButtonExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Extension/InputGroupButtonExtension.php
MIT
protected function addButton(FormBuilderInterface $builder, $config) { $options = (isset($config['options']))? $config['options'] : array(); return $builder->create($config['name'], $config['type'], $options); }
Adds a button @param FormBuilderInterface $builder @param array $config @return ButtonBuilder
addButton
php
braincrafted/bootstrap-bundle
Form/Extension/InputGroupButtonExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Extension/InputGroupButtonExtension.php
MIT
protected function storeButton(ButtonBuilder $buttonBuilder, FormBuilderInterface $form, $position) { if (!isset($this->buttons[$form->getName()])) { $this->buttons[$form->getName()] = array(); } $this->buttons[$form->getName()][$position] = $buttonBuilder; }
Stores a button for later rendering @param ButtonBuilder $buttonBuilder @param FormBuilderInterface $form @param string $position
storeButton
php
braincrafted/bootstrap-bundle
Form/Extension/InputGroupButtonExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Extension/InputGroupButtonExtension.php
MIT
public function getExtendedType() { // map old class to new one using LegacyFormHelper return LegacyFormHelper::getType('form'); }
{@inheritdoc} Although we only support a field that provides a somewhat text-value we extend the form field. (to be more precise: all fields which will be rendered as form_widget_simple) If not we would have to create for every of the text-based types an own extension class. This way we also support new text-based types out of the box.
getExtendedType
php
braincrafted/bootstrap-bundle
Form/Extension/StaticControlExtension.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Extension/StaticControlExtension.php
MIT
public function getName() { return $this->getBlockPrefix(); }
Backward compatibility for SF < 3.0 @return null|string
getName
php
braincrafted/bootstrap-bundle
Form/Type/BootstrapCollectionType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/BootstrapCollectionType.php
MIT
public function buildView(FormView $view, FormInterface $form, array $options) { if ($form->count() == 0) { return; } array_map(array($this, 'validateButton'), $form->all()); }
{@inheritdoc} @param FormView $view @param FormInterface $form @param array $options
buildView
php
braincrafted/bootstrap-bundle
Form/Type/FormActionsType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/FormActionsType.php
MIT
protected function addButton($builder, $name, $config) { $options = (isset($config['options']))? $config['options'] : array(); $builder->add($name, $config['type'], $options); }
Adds a button @param FormBuilderInterface $builder @param string $name @param array $config @throws \InvalidArgumentException @return ButtonBuilder
addButton
php
braincrafted/bootstrap-bundle
Form/Type/FormActionsType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/FormActionsType.php
MIT
protected function validateButton(FormInterface $field) { if (!$field instanceof Button) { throw new \InvalidArgumentException("Children of FormActionsType must be instances of the Button class"); } }
Validates if child is a Button @param FormInterface $field @throws \InvalidArgumentException
validateButton
php
braincrafted/bootstrap-bundle
Form/Type/FormActionsType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/FormActionsType.php
MIT
public function getName() { return $this->getBlockPrefix(); }
Backward compatibility for SF < 3.0 @return null|string
getName
php
braincrafted/bootstrap-bundle
Form/Type/FormActionsType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/FormActionsType.php
MIT
public function getName() { return $this->getBlockPrefix(); }
Backward compatibility for SF < 3.0 @return null|string
getName
php
braincrafted/bootstrap-bundle
Form/Type/FormStaticControlType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/FormStaticControlType.php
MIT
public function getName() { return $this->getBlockPrefix(); }
Backward compatibility for SF < 3.0 @return null|string
getName
php
braincrafted/bootstrap-bundle
Form/Type/MoneyType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/MoneyType.php
MIT
protected static function getPattern($currency) { if (!$currency) { return '{{ widget }}'; } $locale = \Locale::getDefault(); if (!isset(self::$patterns[$locale])) { self::$patterns[$locale] = array(); } if (!isset(self::$patterns[$locale][$currency])) { $format = new \NumberFormatter($locale, \NumberFormatter::CURRENCY); $pattern = $format->formatCurrency('123', $currency); // the spacings between currency symbol and number are ignored, because // a single space leads to better readability in combination with input // fields // the regex also considers non-break spaces (0xC2 or 0xA0 in UTF-8) preg_match( '/^([^\s\xc2\xa0]*)[\s\xc2\xa0]*123(?:[,.]0+)?[\s\xc2\xa0]*([^\s\xc2\xa0]*)$/u', $pattern, $matches ); self::$patterns[$locale][$currency] = self::parsePatternMatches($matches); } return self::$patterns[$locale][$currency]; }
Returns the pattern for this locale The pattern contains the placeholder "{{ widget }}" where the HTML tag should be inserted @param string $currency @return string Returns the pattern
getPattern
php
braincrafted/bootstrap-bundle
Form/Type/MoneyType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/MoneyType.php
MIT
protected static function parsePatternMatches(array $matches) { if (!empty($matches[1])) { return '{{ tag_start }}'.$matches[1].'{{ tag_end }} {{ widget }}'; } if (!empty($matches[2])) { return '{{ widget }} {{ tag_start }}'.$matches[2].'{{ tag_end }}'; } // @codeCoverageIgnoreStart return '{{ widget }}'; // @codeCoverageIgnoreEnd }
Parses the given pattern matches array and returns the pattern string. @param array $matches Pattern matches @return string Pattern
parsePatternMatches
php
braincrafted/bootstrap-bundle
Form/Type/MoneyType.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Form/Type/MoneyType.php
MIT
public function __construct(Session $session) { $this->session = $session; }
Constructor. @param Session $session The session
__construct
php
braincrafted/bootstrap-bundle
Session/FlashMessage.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Session/FlashMessage.php
MIT
public function alert($message) { $this->session->getFlashBag()->add('alert', $message); }
Sets an alert message. @param string $message The message
alert
php
braincrafted/bootstrap-bundle
Session/FlashMessage.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Session/FlashMessage.php
MIT
public function error($message) { $this->danger($message); }
Alias for `danger()`. @param string $message The message
error
php
braincrafted/bootstrap-bundle
Session/FlashMessage.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Session/FlashMessage.php
MIT
public function danger($message) { $this->session->getFlashBag()->add('danger', $message); }
Sets a danger message. @param string $message
danger
php
braincrafted/bootstrap-bundle
Session/FlashMessage.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Session/FlashMessage.php
MIT
public function info($message) { $this->session->getFlashBag()->add('info', $message); }
Sets an info message. @param string $message The message
info
php
braincrafted/bootstrap-bundle
Session/FlashMessage.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Session/FlashMessage.php
MIT
public function success($message) { $this->session->getFlashBag()->add('success', $message); }
Sets a success message. @param string $message The message
success
php
braincrafted/bootstrap-bundle
Session/FlashMessage.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Session/FlashMessage.php
MIT
public function testExecute() { $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.customize') ->andReturn(array( 'variables_file' => __DIR__.'/x/variables.less', 'bootstrap_output' => __DIR__.'/bootstrap.less', 'bootstrap_template' => __DIR__.'/bootstrap.html.twig' )); $this->container->shouldReceive('getParameter')->with('braincrafted_bootstrap.css_preprocessor')->andReturn('less'); $this->container->shouldReceive('getParameter')->with('braincrafted_bootstrap.assets_dir')->andReturn(__DIR__); $this->container->shouldReceive('has'); if (Kernel::VERSION_ID >= 20500) { $this->container->shouldReceive('enterScope')->with('request'); $this->container->shouldReceive('set')->withArgs( array( 'request', \Mockery::type('Symfony\Component\HttpFoundation\Request'), 'request' ) ); } $this->twig ->shouldReceive('render') ->with(__DIR__.'/bootstrap.html.twig', array( 'variables_file' => './x/variables.less', 'assets_dir' => '' )); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new GenerateCommand()); $command = $application->find('braincrafted:bootstrap:generate'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/Found custom variables file/', $commandTester->getDisplay()); $this->assertRegExp('/bootstrap\.less/', $commandTester->getDisplay()); }
@covers Braincrafted\Bundle\BootstrapBundle\Command\GenerateCommand::execute() @covers Braincrafted\Bundle\BootstrapBundle\Command\GenerateCommand::executeGenerateBootstrap()
testExecute
php
braincrafted/bootstrap-bundle
Tests/Command/GenerateCommandTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Command/GenerateCommandTest.php
MIT
public function testExecuteNoVariablesFile() { $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.customize') ->andReturn(array('variables_file' => null)); $this->container->shouldReceive('has'); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new GenerateCommand()); $command = $application->find('braincrafted:bootstrap:generate'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/Found no custom variables\.less file/', $commandTester->getDisplay()); }
@covers Braincrafted\Bundle\BootstrapBundle\Command\GenerateCommand::execute()
testExecuteNoVariablesFile
php
braincrafted/bootstrap-bundle
Tests/Command/GenerateCommandTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Command/GenerateCommandTest.php
MIT
public function testExecuteNoLessFilter() { $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.customize') ->andReturn(array('variables_file' => __DIR__.'/x/variables.less')); $this->container->shouldReceive('getParameter')->with('braincrafted_bootstrap.css_preprocessor')->andReturn('none'); $this->container->shouldReceive('has'); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new GenerateCommand()); $command = $application->find('braincrafted:bootstrap:generate'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/configured with "less" or "lessphp"/', $commandTester->getDisplay()); }
@covers Braincrafted\Bundle\BootstrapBundle\Command\GenerateCommand::execute()
testExecuteNoLessFilter
php
braincrafted/bootstrap-bundle
Tests/Command/GenerateCommandTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Command/GenerateCommandTest.php
MIT
public function testExecute() { $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.assets_dir') ->andReturn(__DIR__.'/fixtures/vendor/twbs/bootstrap'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.icon_prefix') ->andReturn('glyphicon'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.css_preprocessor') ->andReturn(''); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.fonts_dir') ->andReturn(__DIR__.'/fixtures/web/fonts'); $this->container->shouldReceive('has'); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new InstallCommand()); $command = $application->find('braincrafted:bootstrap:install'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/Copied icon fonts/', $commandTester->getDisplay()); }
@covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::execute() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getSrcDir() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getDestDir()
testExecute
php
braincrafted/bootstrap-bundle
Tests/Command/InstallCommandTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Command/InstallCommandTest.php
MIT
public function testExecuteFontAwesome() { $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.fonts_dir') ->andReturn(__DIR__.'/fixtures/web/fonts'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.icon_prefix') ->andReturn('fa'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.fontawesome_dir') ->andReturn(__DIR__.'/fixtures/vendor/twbs/bootstrap'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.css_preprocessor') ->andReturn(''); $this->container->shouldReceive('has'); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new InstallCommand()); $command = $application->find('braincrafted:bootstrap:install'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/Copied icon fonts/', $commandTester->getDisplay()); }
@covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::execute() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getSrcDir() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getDestDir()
testExecuteFontAwesome
php
braincrafted/bootstrap-bundle
Tests/Command/InstallCommandTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Command/InstallCommandTest.php
MIT
public function testExecuteSrcNotExists() { $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.assets_dir') ->andReturn(__DIR__.'/invalid'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.fonts_dir') ->andReturn(__DIR__.'/fixtures/web/fonts'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.icon_prefix') ->andReturn('glyphicon'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.css_preprocessor') ->andReturn(''); $this->container->shouldReceive('has'); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new InstallCommand()); $command = $application->find('braincrafted:bootstrap:install'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/does not exist/', $commandTester->getDisplay()); }
@covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::execute() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getSrcDir() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getDestDir()
testExecuteSrcNotExists
php
braincrafted/bootstrap-bundle
Tests/Command/InstallCommandTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Command/InstallCommandTest.php
MIT
public function testExecuteInvalidDestDirectory() { $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.fonts_dir') ->andReturn('/../fonts'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.icon_prefix') ->andReturn('glyphicon'); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.css_preprocessor') ->andReturn(''); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.assets_dir') ->andReturn(''); $this->container ->shouldReceive('getParameter') ->with('braincrafted_bootstrap.fontawesome_dir') ->andReturn(''); $this->container->shouldReceive('has'); // mock the Kernel or create one depending on your needs $application = new Application($this->kernel); $application->add(new InstallCommand()); $command = $application->find('braincrafted:bootstrap:install'); $commandTester = new CommandTester($command); $commandTester->execute(array('command' => $command->getName())); $this->assertRegExp('/Could not create directory/', $commandTester->getDisplay()); }
@covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::execute() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getSrcDir() @covers Braincrafted\Bundle\BootstrapBundle\Command\InstallCommand::getDestDir()
testExecuteInvalidDestDirectory
php
braincrafted/bootstrap-bundle
Tests/Command/InstallCommandTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Command/InstallCommandTest.php
MIT
public function testBuild() { $this->asseticConfig->build(array( 'css_preprocessor' => 'less', 'assets_dir' => './assets', 'output_dir' => './web', 'jquery_path' => './assets/jquery.js', 'customize' => array( 'variables_file' => './assets/variables.less', 'bootstrap_output' => './assets/bootstrap.less' ), 'icon_prefix' => 'glyphicon' )); }
@covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::build() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::buildCssWithLess() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::buildJs() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::buildJquery()
testBuild
php
braincrafted/bootstrap-bundle
Tests/DependencyInjection/AsseticConfigurationTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/DependencyInjection/AsseticConfigurationTest.php
MIT
public function testBuildWithoutLess() { $this->asseticConfig->build(array( 'css_preprocessor' => 'none', 'assets_dir' => './assets', 'output_dir' => './web', 'jquery_path' => './assets/jquery.js', 'icon_prefix' => 'glyphicon' )); }
@covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::build() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::buildCssWithoutLess() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::buildJs() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\AsseticConfiguration::buildJquery()
testBuildWithoutLess
php
braincrafted/bootstrap-bundle
Tests/DependencyInjection/AsseticConfigurationTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/DependencyInjection/AsseticConfigurationTest.php
MIT
public function testLoad() { $bag = m::mock('Symfony\Component\DependencyInjection\ParameterBag\ParameterBag'); $bag->shouldReceive('add'); /** @var ContainerBuilder | m\Mock $container */ $container = m::mock('Symfony\Component\DependencyInjection\ContainerBuilder'); $container->shouldReceive('hasExtension')->andReturn(false); $container->shouldReceive('addResource'); $container->shouldReceive('getParameterBag')->andReturn($bag); $container->shouldReceive('setDefinition'); $container->shouldReceive('setParameter'); $container->shouldReceive('fileExists')->withAnyArgs()->andReturn(true); $this->extension->load(array(), $container); }
@covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\BraincraftedBootstrapExtension::load()
testLoad
php
braincrafted/bootstrap-bundle
Tests/DependencyInjection/BraincraftedBootstrapExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/DependencyInjection/BraincraftedBootstrapExtensionTest.php
MIT
public function testPrepend() { $bundles = array( 'AsseticBundle' => '', 'TwigBundle' => '', 'KnpMenuBundle' => '', 'KnpPaginatorBundle' => '' ); $extensions = array( 'assetic' => array(), 'twig' => array(), 'knp_menu' => array(), 'knp_paginator' => array() ); $container = m::mock('Symfony\Component\DependencyInjection\ContainerBuilder'); $container->shouldReceive('getParameter')->with('kernel.bundles')->andReturn($bundles); $container->shouldReceive('getExtensions')->andReturn($extensions); $container->shouldReceive('getExtensionConfig')->andReturn(array()); $container->shouldReceive('prependExtensionConfig'); $this->extension->prepend($container); }
@covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\BraincraftedBootstrapExtension::prepend() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\BraincraftedBootstrapExtension::configureAsseticBundle() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\BraincraftedBootstrapExtension::configureTwigBundle() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\BraincraftedBootstrapExtension::configureKnpMenuBundle() @covers Braincrafted\Bundle\BootstrapBundle\DependencyInjection\BraincraftedBootstrapExtension::configureKnpPaginatorBundle()
testPrepend
php
braincrafted/bootstrap-bundle
Tests/DependencyInjection/BraincraftedBootstrapExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/DependencyInjection/BraincraftedBootstrapExtensionTest.php
MIT
public function testBuildForm($options) { $button = m::mock('\Symfony\Component\Form\ButtonBuilder'); $builder = m::mock('Symfony\Component\Form\FormBuilderInterface'); $builder->shouldReceive('getName')->andReturn('input_name'); // map old class to new one using LegacyFormHelper if (isset($options['attr']['input_group']['button_prepend'])) { $builder->shouldReceive('create')->with('prepend', LegacyFormHelper::getType('submit'), array())->andReturn($button)->once(); } if (isset($options['attr']['input_group']['button_append'])) { $builder->shouldReceive('create')->with('append', LegacyFormHelper::getType('submit'), array())->andReturn($button)->once(); } $this->extension->buildForm($builder, $options); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Extension\InputGroupButtonExtension::buildForm() @dataProvider provideForform
testBuildForm
php
braincrafted/bootstrap-bundle
Tests/Form/Extension/InputGroupButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Extension/InputGroupButtonExtensionTest.php
MIT
public function testGetExtendedType() { $this->assertEquals(LegacyFormHelper::getType('text'), $this->extension->getExtendedType()); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Extension\InputGroupButtonExtension::getExtendedType()
testGetExtendedType
php
braincrafted/bootstrap-bundle
Tests/Form/Extension/InputGroupButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Extension/InputGroupButtonExtensionTest.php
MIT
public function testBuildView() { $view = m::mock('Symfony\Component\Form\FormView'); $type = m::mock('Symfony\Component\Form\ResolvedFormTypeInterface'); if(LegacyFormHelper::isLegacy()) { $type->shouldReceive('getName')->andReturn('form'); } else { $type->shouldReceive('getBlockPrefix')->andReturn(LegacyFormHelper::getType('form')); } $config = m::mock('Symfony\Component\Form\FormConfigInterface'); $config->shouldReceive('getType')->andReturn($type); $form = m::mock('Symfony\Component\Form\FormInterface'); $form->shouldReceive('getConfig')->andReturn($config); $this->extension->buildView($view, $form, array()); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Extension\TypeSetterExtension::buildView()
testBuildView
php
braincrafted/bootstrap-bundle
Tests/Form/Extension/TypeSetterExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Extension/TypeSetterExtensionTest.php
MIT
public function testGetExtendedType() { // map old class to new one using LegacyFormHelper $this->assertEquals(LegacyFormHelper::getType('form'), $this->extension->getExtendedType()); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Extension\TypeSetterExtension::getExtendedType()
testGetExtendedType
php
braincrafted/bootstrap-bundle
Tests/Form/Extension/TypeSetterExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Extension/TypeSetterExtensionTest.php
MIT
public function testBuildView() { $view = m::mock('Symfony\Component\Form\FormView'); $prototype = m::mock('Symfony\Component\Form\FormInterface'); $prototype->shouldReceive('createView')->with($view); $config = m::mock('Symfony\Component\Form\FormConfigInterface'); $config->shouldReceive('hasAttribute')->andReturn(true); $config->shouldReceive('getAttribute')->andReturn($prototype); $form = m::mock('Symfony\Component\Form\FormInterface'); $form->shouldReceive('getConfig')->andReturn($config); $this->type->buildView($view, $form, array( 'allow_add' => true, 'allow_delete' => false, 'add_button_text' => 'Add', 'add_button_class' => 'btn btn-primary btn-sm', 'delete_button_text' => 'Delete', 'delete_button_class' => 'btn btn-danger btn-sm', 'sub_widget_col' => 2, 'button_col' => 2, 'prototype_name' => '___name___' )); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType::buildView()
testBuildView
php
braincrafted/bootstrap-bundle
Tests/Form/Type/BootstrapCollectionTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/BootstrapCollectionTypeTest.php
MIT
public function testConfigureOptions() { $resolver = m::mock('Symfony\Component\OptionsResolver\OptionsResolver'); $resolver->shouldReceive('setDefaults'); $resolver->shouldReceive('setNormalizer'); $this->type->configureOptions($resolver); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType::configureOptions()
testConfigureOptions
php
braincrafted/bootstrap-bundle
Tests/Form/Type/BootstrapCollectionTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/BootstrapCollectionTypeTest.php
MIT
public function testGetParent() { $this->assertEquals(LegacyFormHelper::getType('collection'), $this->type->getParent()); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType::getParent()
testGetParent
php
braincrafted/bootstrap-bundle
Tests/Form/Type/BootstrapCollectionTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/BootstrapCollectionTypeTest.php
MIT
public function testGetBlockPrefix() { $this->assertEquals('bootstrap_collection', $this->type->getBlockPrefix()); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\BootstrapCollectionType::getBlockPrefix()
testGetBlockPrefix
php
braincrafted/bootstrap-bundle
Tests/Form/Type/BootstrapCollectionTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/BootstrapCollectionTypeTest.php
MIT
public function testConfigureOptions() { $defaults = array( 'buttons' => array(), 'options' => array(), 'mapped' => false, ); $resolver = m::mock('Symfony\Component\OptionsResolver\OptionsResolver'); $resolver->shouldReceive('setDefaults')->with($defaults)->once(); $this->type->configureOptions($resolver); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\FormActionsType::configureOptions()
testConfigureOptions
php
braincrafted/bootstrap-bundle
Tests/Form/Type/FormActionsTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/FormActionsTypeTest.php
MIT
public function testGetBlockPrefix() { $this->assertEquals('form_actions', $this->type->getName()); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\FormActionsType::getBlockPrefix()
testGetBlockPrefix
php
braincrafted/bootstrap-bundle
Tests/Form/Type/FormActionsTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/FormActionsTypeTest.php
MIT
public function testBuildViewLeftSide() { $view = m::mock('Symfony\Component\Form\FormView'); $form = m::mock('Symfony\Component\Form\FormInterface'); $this->type->buildView($view, $form, array('currency' => 'EUR')); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::buildView() @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::getPattern() @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::parsePatternMatches()
testBuildViewLeftSide
php
braincrafted/bootstrap-bundle
Tests/Form/Type/MoneyTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/MoneyTypeTest.php
MIT
public function testBuildViewRightSide() { /* * If the intl extension is not loaded this will throw an test error, * even with the symfony provided intl component, as this php replacement * layer can only handle 'en': * http://symfony.com/doc/current/components/intl.html */ if(extension_loaded('intl')) { $view = m::mock('Symfony\Component\Form\FormView'); $form = m::mock('Symfony\Component\Form\FormInterface'); $default = \Locale::getDefault(); \Locale::setDefault('fr-CA'); $this->type->buildView($view, $form, array('currency' => 'EUR')); \Locale::setDefault($default); } }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::buildView() @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::getPattern() @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::parsePatternMatches()
testBuildViewRightSide
php
braincrafted/bootstrap-bundle
Tests/Form/Type/MoneyTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/MoneyTypeTest.php
MIT
public function testGetPatternEmpty() { $view = m::mock('Symfony\Component\Form\FormView'); $form = m::mock('Symfony\Component\Form\FormInterface'); $this->type->buildView($view, $form, array('currency' => null)); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::buildView() @covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::getPattern()
testGetPatternEmpty
php
braincrafted/bootstrap-bundle
Tests/Form/Type/MoneyTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/MoneyTypeTest.php
MIT
public function testGetBlockPrefix() { $this->assertEquals('money', $this->type->getBlockPrefix()); }
@covers Braincrafted\Bundle\BootstrapBundle\Form\Type\MoneyType::getBlockPrefix()
testGetBlockPrefix
php
braincrafted/bootstrap-bundle
Tests/Form/Type/MoneyTypeTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Form/Type/MoneyTypeTest.php
MIT
public function testAlert() { $this->flashBag ->shouldReceive('add') ->with('alert', 'Foobar Alert') ->once(); $this->flash->alert('Foobar Alert'); }
Tests the alert() method. @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::__construct() @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::alert()
testAlert
php
braincrafted/bootstrap-bundle
Tests/Session/FlashMessageTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Session/FlashMessageTest.php
MIT
public function testError() { $this->flashBag ->shouldReceive('add') ->with('danger', 'Foobar Error') ->once(); $this->flash->error('Foobar Error'); }
Tests the error() method. @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::__construct() @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::error()
testError
php
braincrafted/bootstrap-bundle
Tests/Session/FlashMessageTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Session/FlashMessageTest.php
MIT
public function testDanger() { $this->flashBag ->shouldReceive('add') ->with('danger', 'Foobar Error') ->once(); $this->flash->danger('Foobar Error'); }
Tests the danger() method. @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::__construct() @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::danger()
testDanger
php
braincrafted/bootstrap-bundle
Tests/Session/FlashMessageTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Session/FlashMessageTest.php
MIT
public function testInfo() { $this->flashBag ->shouldReceive('add') ->with('info', 'Foobar Info') ->once(); $this->flash->info('Foobar Info'); }
Tests the info() method. @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::__construct() @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::info()
testInfo
php
braincrafted/bootstrap-bundle
Tests/Session/FlashMessageTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Session/FlashMessageTest.php
MIT
public function testSuccess() { $this->flashBag ->shouldReceive('add') ->with('success', 'Foobar Success') ->once(); $this->flash->success('Foobar Success'); }
Tests the success() method. @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::__construct() @covers Braincrafted\Bundle\BootstrapBundle\Session\FlashMessage::success()
testSuccess
php
braincrafted/bootstrap-bundle
Tests/Session/FlashMessageTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Session/FlashMessageTest.php
MIT
public function testGetFunctions() { $this->assertCount(1, $this->extension->getFunctions()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapBadgeExtension::getFunctions()
testGetFunctions
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapBadgeExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapBadgeExtensionTest.php
MIT
public function testBadgeFunction() { $this->assertEquals( '<span class="badge">Hello World</span>', $this->extension->badgeFunction('Hello World'), '->badgeFunction() returns the HTML code for the given badge.' ); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapBadgeExtension::badgeFunction
testBadgeFunction
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapBadgeExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapBadgeExtensionTest.php
MIT
public function testGetName() { $this->assertEquals('braincrafted_bootstrap_badge', $this->extension->getName()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapBadgeExtension::getName()
testGetName
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapBadgeExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapBadgeExtensionTest.php
MIT
public function testGetFunctions() { $this->assertCount(2, $this->extension->getFunctions()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapButtonExtension::getFunctions()
testGetFunctions
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapButtonExtensionTest.php
MIT
public function testButtonFunctionWithDefaults() { $this->assertEquals( '<button class="btn btn-default btn-md" type="button"></button>', $this->extension->buttonFunction(), '->buttonFunction() returns the HTML code for the given button.' ); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapButtonExtension::buttonFunction
testButtonFunctionWithDefaults
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapButtonExtensionTest.php
MIT
public function testButtonFunctionWithOptions() { $options = array( 'label' => 'Test', 'icon' => 'check', 'type' => 'success', 'size' => 'sm', 'submit' => true, 'attr' => array( 'id' => 'test_button', 'class' => 'my-class', 'title' => 'Test', 'data-confirm' => 'Are you sure?' ), ); $this->assertEquals( '<button id="test_button" class="btn btn-success btn-sm my-class" title="Test" data-confirm="Are you sure?" type="submit"><i class="fa fa-check"></i> Test</button>', $this->extension->buttonFunction($options), '->buttonFunction() returns the HTML code for the given button.' ); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapButtonExtension::buttonFunction
testButtonFunctionWithOptions
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapButtonExtensionTest.php
MIT
public function testButtonLinkFunctionWithDefaults() { $this->assertEquals( '<a class="btn btn-default btn-md" href="#"></a>', $this->extension->buttonLinkFunction(), '->buttonFunction() returns the HTML code for the given button.' ); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapButtonExtension::buttonLinkFunction
testButtonLinkFunctionWithDefaults
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapButtonExtensionTest.php
MIT
public function testButtonLinkFunctionWithOptions() { $options = array( 'label' => 'Test', 'icon' => 'check', 'url' => 'example.com', 'type' => 'success', 'size' => 'sm', 'attr' => array( 'id' => 'test_button', 'class' => 'my-class', 'title' => 'Test', 'data-confirm' => 'Are you sure?' ), ); $this->assertEquals( '<a id="test_button" class="btn btn-success btn-sm my-class" title="Test" data-confirm="Are you sure?" href="example.com"><i class="fa fa-check"></i> Test</a>', $this->extension->buttonLinkFunction($options), '->buttonFunction() returns the HTML code for the given button.' ); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapButtonExtension::buttonLinkFunction
testButtonLinkFunctionWithOptions
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapButtonExtensionTest.php
MIT
public function testGetName() { $this->assertEquals('braincrafted_bootstrap_button', $this->extension->getName()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapButtonExtension::getName()
testGetName
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapButtonExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapButtonExtensionTest.php
MIT
public function testGetFunctions() { $this->assertCount(16, $this->extension->getFunctions()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::getFunctions()
testGetFunctions
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testSetStyleGetStyle() { $this->extension->setStyle('inline'); $this->assertEquals('inline', $this->extension->getStyle()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::setStyle() @covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::getStyle()
testSetStyleGetStyle
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testSetColSizeGetColSize() { $this->extension->setColSize('sm'); $this->assertEquals('sm', $this->extension->getColSize()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::setColSize() @covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::getColSize()
testSetColSizeGetColSize
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testSetWidgetColGetWidgetCol() { $this->extension->setWidgetCol(5); $this->assertEquals(5, $this->extension->getWidgetCol()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::setWidgetCol() @covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::getWidgetCol()
testSetWidgetColGetWidgetCol
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testSetLabelColGetLabelCol() { $this->extension->setLabelCol(4); $this->assertEquals(4, $this->extension->getLabelCol()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::setLabelCol() @covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::getLabelCol()
testSetLabelColGetLabelCol
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testSetSimpleColGetSimpleCol() { $this->extension->setSimpleCol(8); $this->assertEquals(8, $this->extension->getSimpleCol()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::setSimpleCol() @covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::getSimpleCol()
testSetSimpleColGetSimpleCol
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testBackupFormSettingsRestoreFormSettings() { $this->extension->setStyle('horizontal'); $this->extension->setColSize('sm'); $this->extension->setWidgetCol(1); $this->extension->setLabelCol(2); $this->extension->setSimpleCol(3); $this->extension->backupFormSettings(); $this->extension->setStyle('inline'); $this->extension->setColSize('lg'); $this->extension->setWidgetCol(4); $this->extension->setLabelCol(5); $this->extension->setSimpleCol(6); $this->extension->restoreFormSettings(); $this->assertEquals('horizontal', $this->extension->getStyle()); $this->assertEquals('sm', $this->extension->getColSize()); $this->assertEquals(1, $this->extension->getWidgetCol()); $this->assertEquals(2, $this->extension->getLabelCol()); $this->assertEquals(3, $this->extension->getSimpleCol()); // Nothing happens if we try to restore form settings but none exist $this->extension->restoreFormSettings(); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::backupFormSettings() @covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::restoreFormSettings()
testBackupFormSettingsRestoreFormSettings
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testGetName() { $this->assertEquals('braincrafted_bootstrap_form', $this->extension->getName()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension::getName()
testGetName
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapFormExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapFormExtensionTest.php
MIT
public function testGetFilters() { $this->assertCount(1, $this->getIconExtension()->getFilters()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapIconExtension::getFilters()
testGetFilters
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapIconExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapIconExtensionTest.php
MIT
public function testGetFunctions() { $this->assertCount(1, $this->getIconExtension()->getFunctions()); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapIconExtension::getFunctions()
testGetFunctions
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapIconExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapIconExtensionTest.php
MIT
public function testIconFilter() { $this->assertEquals( '<span class="glyphicon glyphicon-heart"></span>', $this->getIconExtension('glyphicon')->iconFunction('heart'), '->iconFunction() returns the HTML code for the given icon.' ); $this->assertEquals( '<span class="fa fa-heart"></span>', $this->getIconExtension('fa')->iconFunction('heart'), '->iconFunction() uses the iconPrefix passed into the IconExtension constructor.' ); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapIconExtension::iconFunction
testIconFilter
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapIconExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapIconExtensionTest.php
MIT
public function testIconFilterWithDifferntPrefix() { $this->assertEquals( '<span class="glyphicon glyphicon-heart"></span>', $this->getIconExtension('default')->iconFunction('heart', 'glyphicon'), '->iconFunction() returns the HTML code for the given icon.' ); $this->assertEquals( '<span class="fa fa-heart"></span>', $this->getIconExtension('default')->iconFunction('heart', 'fa'), '->iconFunction() uses the iconPrefix passed into the IconExtension constructor.' ); }
@covers Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapIconExtension::iconFunction
testIconFilterWithDifferntPrefix
php
braincrafted/bootstrap-bundle
Tests/Twig/BootstrapIconExtensionTest.php
https://github.com/braincrafted/bootstrap-bundle/blob/master/Tests/Twig/BootstrapIconExtensionTest.php
MIT