Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notice #121

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Gnugat/Redaktilo/Service/EditorBuilder.php
Original file line number Diff line number Diff line change
@@ -83,10 +83,10 @@ protected function getSearchEngine()
$engine = new SearchEngine();
$phpConverter = $this->getPhpConverter();

$engine->registerStrategy(new PhpSearchStrategy($phpConverter));
$engine->registerStrategy(new LineRegexSearchStrategy(), 20);
$engine->registerStrategy(new SameSearchStrategy(), 10);
$engine->registerStrategy(new LineNumberSearchStrategy());
$engine->registerStrategy(new PhpSearchStrategy($phpConverter));

foreach ($this->searchStrategies as $priority => $strategies) {
foreach ($strategies as $strategy) {
1 change: 0 additions & 1 deletion tests/example/BundleRegistrationTest.php
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
namespace example\Gnugat\Redaktilo;

use Gnugat\Redaktilo\EditorFactory;
use Gnugat\Redaktilo\Search\Php\TokenBuilder;
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;

class BundleRegistrationTest extends \PHPUnit_Framework_TestCase
2 changes: 0 additions & 2 deletions tests/example/DocumentationReformattingTest.php
Original file line number Diff line number Diff line change
@@ -12,8 +12,6 @@
namespace example\Gnugat\Redaktilo;

use Gnugat\Redaktilo\EditorFactory;
use Gnugat\Redaktilo\Editor;
use Gnugat\Redaktilo\File;
use Symfony\Component\Filesystem\Filesystem as SymfonyFilesystem;

class DocumentationReformattingTest extends \PHPUnit_Framework_TestCase
43 changes: 43 additions & 0 deletions tests/example/LineJumpingTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

/*
* This file is part of the Redaktilo project.
*
* (c) Loïc Chardonnet <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace example\Gnugat\Redaktilo;

use Gnugat\Redaktilo\EditorFactory;
use Gnugat\Redaktilo\Text;

class LineJumpingTest extends \PHPUnit_Framework_TestCase
{
private $editor;

protected function setUp()
{
$this->editor = EditorFactory::createEditor();
set_error_handler(function($errno, $errstr, $errfile, $errline) {
throw new \RuntimeException($errstr . " on line " . $errline . " in file " . $errfile);
});
}

/**
* @expectedException \RuntimeException
* @expectedExceptionMessage Gnugat\Redaktilo\Search\LineNumberSearchStrategy has been replaced by Text#setCurrentLineNumber on line 50 in file /home/gnucat/Projects/gnugat/redaktilo/src/Gnugat/Redaktilo/Search/LineNumberSearchStrategy.php
*/
public function testItCannotFindNonExistingLine()
{
$text = Text::fromArray(array(''));
$this->editor->jumpBelow($text, 0);
}

protected function tearDown()
{
restore_error_handler();
}
}
4 changes: 2 additions & 2 deletions tests/spec/Gnugat/Redaktilo/Service/EditorBuilderSpec.php
Original file line number Diff line number Diff line change
@@ -26,10 +26,10 @@ function it_can_build_the_default_editor()
$editor->shouldBeAnInstanceOf('Gnugat\Redaktilo\Editor');

$editor->shouldHaveSearchStrategies(array(
'Gnugat\Redaktilo\Search\PhpSearchStrategy',
'Gnugat\Redaktilo\Search\LineNumberSearchStrategy',
'Gnugat\Redaktilo\Search\LineRegexSearchStrategy',
'Gnugat\Redaktilo\Search\SameSearchStrategy',
'Gnugat\Redaktilo\Search\LineNumberSearchStrategy',
'Gnugat\Redaktilo\Search\PhpSearchStrategy',
));

$editor->shouldHaveCommands(array(