mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
test: Replace assertNotContains() with assertStringNotContainsString() for text assertion.
assertNotContains() can no longer be used for text containment assertion.
This commit is contained in:
parent
dfc1c56625
commit
eaefdbb977
19 changed files with 41 additions and 41 deletions
|
@ -419,8 +419,8 @@ class SchemaShellTest extends CakeTestCase {
|
|||
$this->file = new File(TMP . 'tests' . DS . 'schema.php');
|
||||
$contents = $this->file->read();
|
||||
|
||||
$this->assertNotContains('public $acos = array(', $contents);
|
||||
$this->assertNotContains('public $aros = array(', $contents);
|
||||
$this->assertStringNotContainsString('public $acos = array(', $contents);
|
||||
$this->assertStringNotContainsString('public $aros = array(', $contents);
|
||||
$this->assertStringContainsString('public $aros_acos = array(', $contents);
|
||||
}
|
||||
|
||||
|
|
|
@ -450,7 +450,7 @@ class ExtractTaskTest extends CakeTestCase {
|
|||
$this->assertStringContainsString('msgid "Post title is required"', $result);
|
||||
$this->assertStringContainsString('msgid "Post body is required"', $result);
|
||||
$this->assertStringContainsString('msgid "Post body is super required"', $result);
|
||||
$this->assertNotContains('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title', $result);
|
||||
$this->assertStringNotContainsString('Plugin/TestPlugin/Model/TestPluginPost.php:validation for field title', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -448,7 +448,7 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
$this->assertStringContainsString('class ArticleFixture extends CakeTestFixture', $result);
|
||||
$this->assertStringContainsString('public $fields', $result);
|
||||
$this->assertStringContainsString('public $records', $result);
|
||||
$this->assertNotContains('public $import', $result);
|
||||
$this->assertStringNotContainsString('public $import', $result);
|
||||
|
||||
$result = $this->Task->bake('Article', 'comments');
|
||||
$this->assertStringContainsString('class ArticleFixture extends CakeTestFixture', $result);
|
||||
|
@ -457,16 +457,16 @@ class FixtureTaskTest extends CakeTestCase {
|
|||
|
||||
$result = $this->Task->bake('Article', 'comments', array('records' => true));
|
||||
$this->assertStringContainsString("public \$import = array('records' => true, 'connection' => 'test');", $result);
|
||||
$this->assertNotContains('public $records', $result);
|
||||
$this->assertStringNotContainsString('public $records', $result);
|
||||
|
||||
$result = $this->Task->bake('Article', 'comments', array('schema' => 'Article'));
|
||||
$this->assertStringContainsString("public \$import = array('model' => 'Article', 'connection' => 'test');", $result);
|
||||
$this->assertNotContains('public $fields', $result);
|
||||
$this->assertStringNotContainsString('public $fields', $result);
|
||||
|
||||
$result = $this->Task->bake('Article', 'comments', array('schema' => 'Article', 'records' => true));
|
||||
$this->assertStringContainsString("public \$import = array('model' => 'Article', 'records' => true, 'connection' => 'test');", $result);
|
||||
$this->assertNotContains('public $fields', $result);
|
||||
$this->assertNotContains('public $records', $result);
|
||||
$this->assertStringNotContainsString('public $fields', $result);
|
||||
$this->assertStringNotContainsString('public $records', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -436,12 +436,12 @@ class TestTaskTest extends CakeTestCase {
|
|||
$this->assertStringContainsString("App::uses('TestTaskCommentsController', 'Controller')", $result);
|
||||
$this->assertStringContainsString('class TestTaskCommentsControllerTest extends ControllerTestCase', $result);
|
||||
|
||||
$this->assertNotContains('function setUp()', $result);
|
||||
$this->assertNotContains("\$this->TestTaskComments = new TestTaskCommentsController()", $result);
|
||||
$this->assertNotContains("\$this->TestTaskComments->constructClasses()", $result);
|
||||
$this->assertStringNotContainsString('function setUp()', $result);
|
||||
$this->assertStringNotContainsString("\$this->TestTaskComments = new TestTaskCommentsController()", $result);
|
||||
$this->assertStringNotContainsString("\$this->TestTaskComments->constructClasses()", $result);
|
||||
|
||||
$this->assertNotContains('function tearDown()', $result);
|
||||
$this->assertNotContains('unset($this->TestTaskComments)', $result);
|
||||
$this->assertStringNotContainsString('function tearDown()', $result);
|
||||
$this->assertStringNotContainsString('unset($this->TestTaskComments)', $result);
|
||||
|
||||
$this->assertStringContainsString("'app.test_task_article'", $result);
|
||||
$this->assertStringContainsString("'app.test_task_comment'", $result);
|
||||
|
|
|
@ -359,7 +359,7 @@ class ViewTaskTest extends CakeTestCase {
|
|||
$path = APP . 'Plugin' . DS . 'TestTest' . DS . 'View' . DS . 'ViewTaskComments' . DS . 'view.ctp';
|
||||
|
||||
$result = $this->Task->getContent('index');
|
||||
$this->assertNotContains('List Test Test.view Task Articles', $result);
|
||||
$this->assertStringNotContainsString('List Test Test.view Task Articles', $result);
|
||||
|
||||
$this->Task->expects($this->once())
|
||||
->method('createFile')
|
||||
|
|
|
@ -524,7 +524,7 @@ class ConfigureTest extends CakeTestCase {
|
|||
$this->assertStringContainsString('<?php', $result);
|
||||
$this->assertStringContainsString('$config = ', $result);
|
||||
$this->assertStringContainsString('Error', $result);
|
||||
$this->assertNotContains('debug', $result);
|
||||
$this->assertStringNotContainsString('debug', $result);
|
||||
|
||||
if (file_exists(TMP . 'config_test.php')) {
|
||||
unlink(TMP . 'config_test.php');
|
||||
|
|
|
@ -269,7 +269,7 @@ class ErrorHandlerTest extends CakeTestCase {
|
|||
$this->assertMatchesRegularExpression('/Fooled you!/', $result, 'message missing.');
|
||||
|
||||
$log = file(LOGS . 'error.log');
|
||||
$this->assertNotContains('[NotFoundException] Kaboom!', $log[0], 'message should not be logged.');
|
||||
$this->assertStringNotContainsString('[NotFoundException] Kaboom!', $log[0], 'message should not be logged.');
|
||||
$this->assertStringContainsString('[ForbiddenException] Fooled you!', $log[0], 'message missing.');
|
||||
}
|
||||
|
||||
|
@ -318,8 +318,8 @@ class ErrorHandlerTest extends CakeTestCase {
|
|||
Configure::write('debug', 0);
|
||||
ErrorHandler::handleFatalError(E_ERROR, 'Something wrong', __FILE__, $line);
|
||||
$result = ob_get_clean();
|
||||
$this->assertNotContains('Something wrong', $result, 'message must not appear.');
|
||||
$this->assertNotContains(__FILE__, $result, 'filename must not appear.');
|
||||
$this->assertStringNotContainsString('Something wrong', $result, 'message must not appear.');
|
||||
$this->assertStringNotContainsString(__FILE__, $result, 'filename must not appear.');
|
||||
$this->assertStringContainsString('An Internal Error Has Occurred', $result);
|
||||
}
|
||||
|
||||
|
|
|
@ -362,7 +362,7 @@ class ExceptionRendererTest extends CakeTestCase {
|
|||
$result = ob_get_clean();
|
||||
|
||||
$this->assertEquals('error500', $ExceptionRenderer->method, 'incorrect method coercion.');
|
||||
$this->assertNotContains('foul ball.', $result, 'Text should no show up.');
|
||||
$this->assertStringNotContainsString('foul ball.', $result, 'Text should no show up.');
|
||||
$this->assertStringContainsString('Internal Error', $result, 'Generic message only.');
|
||||
}
|
||||
|
||||
|
|
|
@ -734,7 +734,7 @@ class CakeLogTest extends CakeTestCase {
|
|||
CakeLog::write('eggs', $testMessage);
|
||||
CakeLog::defaultLevels();
|
||||
$contents = file_get_contents(LOGS . 'spam.log');
|
||||
$this->assertNotContains('Eggs: ' . $testMessage, $contents);
|
||||
$this->assertStringNotContainsString('Eggs: ' . $testMessage, $contents);
|
||||
$contents = file_get_contents(LOGS . 'eggs.log');
|
||||
$this->assertStringContainsString('Eggs: ' . $testMessage, $contents);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ class ConsoleLogTest extends CakeTestCase {
|
|||
$this->assertTrue(file_exists(LOGS . 'error.log'), 'error.log missing');
|
||||
$this->assertTrue(file_exists(LOGS . 'debug.log'), 'debug.log missing');
|
||||
$logOutput = file_get_contents(LOGS . 'error.log');
|
||||
$this->assertNotContains($message, $logOutput);
|
||||
$this->assertStringNotContainsString($message, $logOutput);
|
||||
$logOutput = file_get_contents(LOGS . 'debug.log');
|
||||
$this->assertStringContainsString($message, $logOutput);
|
||||
}
|
||||
|
|
|
@ -1027,7 +1027,7 @@ SQL;
|
|||
);
|
||||
$result = $this->Dbo->createSchema($schema, 'no_indexes');
|
||||
$this->assertStringContainsString('PRIMARY KEY (`id`)', $result);
|
||||
$this->assertNotContains('UNIQUE KEY', $result);
|
||||
$this->assertStringNotContainsString('UNIQUE KEY', $result);
|
||||
|
||||
$schema->tables = array(
|
||||
'primary_index' => array(
|
||||
|
|
|
@ -866,8 +866,8 @@ class PostgresTest extends CakeTestCase {
|
|||
));
|
||||
$this->assertStringContainsString('RENAME "title" TO "subject";', $query);
|
||||
$this->assertStringContainsString('ALTER COLUMN "subject" TYPE', $query);
|
||||
$this->assertNotContains(";\n\tALTER COLUMN \"subject\" TYPE", $query);
|
||||
$this->assertNotContains('ALTER COLUMN "title" TYPE "subject"', $query);
|
||||
$this->assertStringNotContainsString(";\n\tALTER COLUMN \"subject\" TYPE", $query);
|
||||
$this->assertStringNotContainsString('ALTER COLUMN "title" TYPE "subject"', $query);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1141,7 +1141,7 @@ class PostgresTest extends CakeTestCase {
|
|||
|
||||
$result = $db->limit(10, 300000000000000000000000000000);
|
||||
$scientificNotation = sprintf('%.1E', 300000000000000000000000000000);
|
||||
$this->assertNotContains($scientificNotation, $result);
|
||||
$this->assertStringNotContainsString($scientificNotation, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -596,7 +596,7 @@ SQL;
|
|||
|
||||
$result = $db->limit(10, 300000000000000000000000000000);
|
||||
$scientificNotation = sprintf('%.1E', 300000000000000000000000000000);
|
||||
$this->assertNotContains($scientificNotation, $result);
|
||||
$this->assertStringNotContainsString($scientificNotation, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1783,7 +1783,7 @@ class DboSourceTest extends CakeTestCase {
|
|||
|
||||
$result = $db->limit(10, 300000000000000000000000000000);
|
||||
$scientificNotation = sprintf('%.1E', 300000000000000000000000000000);
|
||||
$this->assertNotContains($scientificNotation, $result);
|
||||
$this->assertStringNotContainsString($scientificNotation, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1462,7 +1462,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$result = $this->CakeEmail->send('message body.');
|
||||
|
||||
$this->assertStringContainsString('message body.', $result['message']);
|
||||
$this->assertNotContains('This email was sent using the CakePHP Framework', $result['message']);
|
||||
$this->assertStringNotContainsString('This email was sent using the CakePHP Framework', $result['message']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -381,7 +381,7 @@ class CakeTestCaseTest extends CakeTestCase {
|
|||
public function testAssertTextContains() {
|
||||
$stringDirty = "some\nstring\r\nwith\rdifferent\nline endings!";
|
||||
$this->assertStringContainsString("different", $stringDirty);
|
||||
$this->assertNotContains("different\rline", $stringDirty);
|
||||
$this->assertStringNotContainsString("different\rline", $stringDirty);
|
||||
$this->assertTextContains("different\rline", $stringDirty);
|
||||
}
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ class DebuggerTest extends CakeTestCase {
|
|||
$b = $a['<script>alert(1)</script>'];
|
||||
$result = ob_get_clean();
|
||||
|
||||
$this->assertNotContains('<script>alert(1)', $result);
|
||||
$this->assertStringNotContainsString('<script>alert(1)', $result);
|
||||
$this->assertStringContainsString('<script>alert(1)', $result);
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ TEXT;
|
|||
Debugger::log($val, LOG_DEBUG, 0);
|
||||
$result = file_get_contents(LOGS . 'debug.log');
|
||||
$this->assertStringContainsString('DebuggerTest::testLog', $result);
|
||||
$this->assertNotContains("/'val'/", $result);
|
||||
$this->assertStringNotContainsString("/'val'/", $result);
|
||||
|
||||
unlink(LOGS . 'debug.log');
|
||||
}
|
||||
|
|
|
@ -614,10 +614,10 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||
$encoding = strtolower(Configure::read('App.encoding'));
|
||||
$result = $this->Form->create('Contact', array('type' => 'get', 'url' => '/contacts/add'));
|
||||
$this->assertNotContains('Token', $result);
|
||||
$this->assertStringNotContainsString('Token', $result);
|
||||
|
||||
$result = $this->Form->end('Save');
|
||||
$this->assertNotContains('Token', $result);
|
||||
$this->assertStringNotContainsString('Token', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1837,7 +1837,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
|
||||
$this->Form->create('Address', array('url' => '/articles/view/1'));
|
||||
$result = $this->Form->secure();
|
||||
$this->assertNotContains($expected, $result, 'URL is different');
|
||||
$this->assertStringNotContainsString($expected, $result, 'URL is different');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8198,7 +8198,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
)
|
||||
);
|
||||
$this->assertStringContainsString('value="' . date('m') . '" selected="selected"', $result);
|
||||
$this->assertNotContains('value="2008" selected="selected"', $result);
|
||||
$this->assertStringNotContainsString('value="2008" selected="selected"', $result);
|
||||
|
||||
$result = $this->Form->input('just_year',
|
||||
array(
|
||||
|
@ -8209,7 +8209,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'maxYear' => date('Y', strtotime('+20 years'))
|
||||
)
|
||||
);
|
||||
$this->assertNotContains('value="' . date('Y') . '" selected="selected"', $result);
|
||||
$this->assertStringNotContainsString('value="' . date('Y') . '" selected="selected"', $result);
|
||||
|
||||
$result = $this->Form->input('just_month',
|
||||
array(
|
||||
|
@ -8219,7 +8219,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'empty' => false,
|
||||
)
|
||||
);
|
||||
$this->assertNotContains('value="' . date('m') . '" selected="selected"', $result);
|
||||
$this->assertStringNotContainsString('value="' . date('m') . '" selected="selected"', $result);
|
||||
|
||||
$result = $this->Form->input('just_day',
|
||||
array(
|
||||
|
@ -8229,7 +8229,7 @@ class FormHelperTest extends CakeTestCase {
|
|||
'empty' => false,
|
||||
)
|
||||
);
|
||||
$this->assertNotContains('value="' . date('d') . '" selected="selected"', $result);
|
||||
$this->assertStringNotContainsString('value="' . date('d') . '" selected="selected"', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -8317,11 +8317,11 @@ class FormHelperTest extends CakeTestCase {
|
|||
$result = $this->Form->input('lap_time', array(
|
||||
'type' => 'text',
|
||||
));
|
||||
$this->assertNotContains('maxlength=', $result);
|
||||
$this->assertStringNotContainsString('maxlength=', $result);
|
||||
$result = $this->Form->input('last_seen', array(
|
||||
'type' => 'text',
|
||||
));
|
||||
$this->assertNotContains('maxlength=', $result);
|
||||
$this->assertStringNotContainsString('maxlength=', $result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue