Update unit tests to not rely on deprecated methods of testing
This commit is contained in:
parent
662b1c2e45
commit
2c529cf753
|
|
@ -59,18 +59,18 @@ class NavigationManagerTest extends TestCase
|
|||
$manager->setContext('October.Tester', 'blog');
|
||||
|
||||
$items = $manager->listSideMenuItems();
|
||||
$this->assertInternalType('array', $items);
|
||||
$this->assertIsArray($items);
|
||||
$this->assertArrayHasKey('posts', $items);
|
||||
$this->assertArrayHasKey('categories', $items);
|
||||
|
||||
$this->assertInternalType('object', $items['posts']);
|
||||
$this->assertIsObject($items['posts']);
|
||||
$this->assertObjectHasAttribute('code', $items['posts']);
|
||||
$this->assertObjectHasAttribute('owner', $items['posts']);
|
||||
$this->assertEquals('posts', $items['posts']->code);
|
||||
$this->assertEquals('October.Tester', $items['posts']->owner);
|
||||
|
||||
$this->assertObjectHasAttribute('permissions', $items['posts']);
|
||||
$this->assertInternalType('array', $items['posts']->permissions);
|
||||
$this->assertIsArray($items['posts']->permissions);
|
||||
$this->assertCount(1, $items['posts']->permissions);
|
||||
|
||||
$this->assertObjectHasAttribute('order', $items['posts']);
|
||||
|
|
@ -92,7 +92,7 @@ class NavigationManagerTest extends TestCase
|
|||
|
||||
$items = $manager->listMainMenuItems();
|
||||
|
||||
$this->assertInternalType('array', $items);
|
||||
$this->assertIsArray($items);
|
||||
$this->assertArrayHasKey('OCTOBER.TESTER.PRINT', $items);
|
||||
|
||||
$item = $items['OCTOBER.TESTER.PRINT'];
|
||||
|
|
@ -143,10 +143,10 @@ class NavigationManagerTest extends TestCase
|
|||
$manager->setContext('October.Tester', 'blog');
|
||||
$items = $manager->listSideMenuItems();
|
||||
|
||||
$this->assertInternalType('array', $items);
|
||||
$this->assertIsArray($items);
|
||||
$this->assertArrayHasKey('foo', $items);
|
||||
|
||||
$this->assertInternalType('object', $items['foo']);
|
||||
$this->assertIsObject($items['foo']);
|
||||
$this->assertObjectHasAttribute('code', $items['foo']);
|
||||
$this->assertObjectHasAttribute('owner', $items['foo']);
|
||||
$this->assertObjectHasAttribute('order', $items['foo']);
|
||||
|
|
@ -156,7 +156,7 @@ class NavigationManagerTest extends TestCase
|
|||
$this->assertEquals('October.Tester', $items['foo']->owner);
|
||||
|
||||
$this->assertObjectHasAttribute('permissions', $items['foo']);
|
||||
$this->assertInternalType('array', $items['foo']->permissions);
|
||||
$this->assertIsArray($items['foo']->permissions);
|
||||
$this->assertCount(2, $items['foo']->permissions);
|
||||
$this->assertContains('october.tester.access_foo', $items['foo']->permissions);
|
||||
$this->assertContains('october.tester.access_bar', $items['foo']->permissions);
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ class BackendHelperTest extends TestCase
|
|||
$assets = $backendHelper->decompileAsset('tests/fixtures/backend/assets/compilation.js');
|
||||
|
||||
$this->assertCount(2, $assets);
|
||||
$this->assertContains('file1.js', $assets[0]);
|
||||
$this->assertContains('file2.js', $assets[1]);
|
||||
$this->assertStringContainsString('file1.js', $assets[0]);
|
||||
$this->assertStringContainsString('file2.js', $assets[1]);
|
||||
}
|
||||
|
||||
public function testDecompileMissingFile()
|
||||
|
|
|
|||
|
|
@ -44,16 +44,16 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$theme = Theme::load('test');
|
||||
|
||||
$obj = TestCmsCompoundObject::load($theme, 'compound.htm');
|
||||
$this->assertContains("\$controller->data['something'] = 'some value'", $obj->code);
|
||||
$this->assertStringContainsString("\$controller->data['something'] = 'some value'", $obj->code);
|
||||
$this->assertEquals('<p>This is a paragraph</p>', $obj->markup);
|
||||
$this->assertInternalType('array', $obj->settings);
|
||||
$this->assertIsArray($obj->settings);
|
||||
$this->assertArrayHasKey('var', $obj->settings);
|
||||
$this->assertEquals('value', $obj->settings['var']);
|
||||
|
||||
$this->assertArrayHasKey('components', $obj->settings);
|
||||
|
||||
$this->assertArrayHasKey('section', $obj->settings['components']);
|
||||
$this->assertInternalType('array', $obj->settings['components']['section']);
|
||||
$this->assertIsArray($obj->settings['components']['section']);
|
||||
$this->assertArrayHasKey('version', $obj->settings['components']['section']);
|
||||
$this->assertEquals(10, $obj->settings['components']['section']['version']);
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ class CmsCompoundObjectTest extends TestCase
|
|||
|
||||
$obj = TestCmsCompoundObject::load($theme, 'component.htm');
|
||||
$this->assertArrayHasKey('components', $obj->settings);
|
||||
$this->assertInternalType('array', $obj->settings['components']);
|
||||
$this->assertIsArray($obj->settings['components']);
|
||||
$this->assertArrayHasKey('testArchive', $obj->settings['components']);
|
||||
$this->assertArrayHasKey('posts-per-page', $obj->settings['components']['testArchive']);
|
||||
$this->assertEquals(10, $obj->settings['components']['testArchive']['posts-per-page']);
|
||||
|
|
@ -82,7 +82,7 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$obj = TestCmsCompoundObject::load($theme, 'components.htm');
|
||||
$this->assertArrayHasKey('components', $obj->settings);
|
||||
|
||||
$this->assertInternalType('array', $obj->settings['components']);
|
||||
$this->assertIsArray($obj->settings['components']);
|
||||
$this->assertArrayHasKey('testArchive firstAlias', $obj->settings['components']);
|
||||
$this->assertArrayHasKey('October\Tester\Components\Post secondAlias', $obj->settings['components']);
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$properties = $obj->getComponentProperties('October\Tester\Components\Post');
|
||||
$emptyProperties = $obj->getComponentProperties('October\Tester\Components\Archive');
|
||||
$notExistingProperties = $obj->getComponentProperties('This\Is\Not\Component');
|
||||
$this->assertInternalType('array', $properties);
|
||||
$this->assertIsArray($properties);
|
||||
$this->assertArrayHasKey('show-featured', $properties);
|
||||
$this->assertTrue((bool)$properties['show-featured']);
|
||||
$this->assertEquals('true', $properties['show-featured']);
|
||||
|
|
@ -148,18 +148,18 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$this->assertEquals($testContent, $obj->getContent());
|
||||
$this->assertEquals('testcompound.htm', $obj->getFileName());
|
||||
$this->assertEquals('<p>This is a paragraph</p>', $obj->markup);
|
||||
$this->assertInternalType('array', $obj->settings);
|
||||
$this->assertIsArray($obj->settings);
|
||||
$this->assertArrayHasKey('var', $obj->settings);
|
||||
$this->assertEquals('value', $obj->settings['var']);
|
||||
|
||||
$this->assertArrayHasKey('components', $obj->settings);
|
||||
|
||||
$this->assertInternalType('array', $obj->settings['components']['section']);
|
||||
$this->assertIsArray($obj->settings['components']['section']);
|
||||
$this->assertArrayHasKey('version', $obj->settings['components']['section']);
|
||||
$this->assertEquals(10, $obj->settings['components']['section']['version']);
|
||||
|
||||
$this->assertEquals('value', $obj->var);
|
||||
$this->assertInternalType('array', $obj->settings['components']['section']);
|
||||
$this->assertIsArray($obj->settings['components']['section']);
|
||||
$this->assertArrayHasKey('version', $obj->settings['components']['section']);
|
||||
$this->assertEquals(10, $obj->settings['components']['section']['version']);
|
||||
|
||||
|
|
@ -173,18 +173,18 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$this->assertEquals($testContent, $obj->getContent());
|
||||
$this->assertEquals('testcompound.htm', $obj->getFileName());
|
||||
$this->assertEquals('<p>This is a paragraph</p>', $obj->markup);
|
||||
$this->assertInternalType('array', $obj->settings);
|
||||
$this->assertIsArray($obj->settings);
|
||||
$this->assertArrayHasKey('var', $obj->settings);
|
||||
$this->assertEquals('value', $obj->settings['var']);
|
||||
|
||||
$this->assertArrayHasKey('components', $obj->settings);
|
||||
|
||||
$this->assertInternalType('array', $obj->settings['components']['section']);
|
||||
$this->assertIsArray($obj->settings['components']['section']);
|
||||
$this->assertArrayHasKey('version', $obj->settings['components']['section']);
|
||||
$this->assertEquals(10, $obj->settings['components']['section']['version']);
|
||||
|
||||
$this->assertEquals('value', $obj->var);
|
||||
$this->assertInternalType('array', $obj->settings['components']['section']);
|
||||
$this->assertIsArray($obj->settings['components']['section']);
|
||||
$this->assertArrayHasKey('version', $obj->settings['components']['section']);
|
||||
$this->assertEquals(10, $obj->settings['components']['section']['version']);
|
||||
}
|
||||
|
|
@ -280,14 +280,14 @@ class CmsCompoundObjectTest extends TestCase
|
|||
$obj = TestParsedCmsCompoundObject::load($theme, 'viewbag.htm');
|
||||
$this->assertNull($obj->code);
|
||||
$this->assertEquals('<p>Chop Suey!</p>', $obj->markup);
|
||||
$this->assertInternalType('array', $obj->settings);
|
||||
$this->assertIsArray($obj->settings);
|
||||
$this->assertArrayHasKey('var', $obj->settings);
|
||||
$this->assertEquals('value', $obj->settings['var']);
|
||||
|
||||
$this->assertArrayHasKey('components', $obj->settings);
|
||||
|
||||
$this->assertArrayHasKey('viewBag', $obj->settings['components']);
|
||||
$this->assertInternalType('array', $obj->settings['components']['viewBag']);
|
||||
$this->assertIsArray($obj->settings['components']['viewBag']);
|
||||
$this->assertArrayHasKey('title', $obj->settings['components']['viewBag']);
|
||||
$this->assertEquals('Toxicity', $obj->settings['components']['viewBag']['title']);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,12 +148,11 @@ class CmsObjectTest extends TestCase
|
|||
$this->assertNull($obj->something);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \October\Rain\Exception\ValidationException
|
||||
* @expectedExceptionMessage Invalid file name
|
||||
*/
|
||||
public function testFillInvalidFileNameSymbol()
|
||||
{
|
||||
$this->expectException(\October\Rain\Exception\ValidationException::class);
|
||||
$this->expectExceptionMessage('Invalid file name');
|
||||
|
||||
$theme = Theme::load('apitest');
|
||||
|
||||
$testContents = 'mytestcontent';
|
||||
|
|
@ -164,12 +163,11 @@ class CmsObjectTest extends TestCase
|
|||
$obj->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \October\Rain\Exception\ValidationException
|
||||
* @expectedExceptionMessage Invalid file name
|
||||
*/
|
||||
public function testFillInvalidFileNamePath()
|
||||
{
|
||||
$this->expectException(\October\Rain\Exception\ValidationException::class);
|
||||
$this->expectExceptionMessage('Invalid file name');
|
||||
|
||||
$theme = Theme::load('apitest');
|
||||
|
||||
$testContents = 'mytestcontent';
|
||||
|
|
@ -180,12 +178,11 @@ class CmsObjectTest extends TestCase
|
|||
$obj->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \October\Rain\Exception\ValidationException
|
||||
* @expectedExceptionMessage Invalid file name
|
||||
*/
|
||||
public function testFillInvalidFileSlash()
|
||||
{
|
||||
$this->expectException(\October\Rain\Exception\ValidationException::class);
|
||||
$this->expectExceptionMessage('Invalid file name');
|
||||
|
||||
$theme = Theme::load('apitest');
|
||||
|
||||
$testContents = 'mytestcontent';
|
||||
|
|
@ -196,12 +193,11 @@ class CmsObjectTest extends TestCase
|
|||
$obj->save();
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \October\Rain\Exception\ValidationException
|
||||
* @expectedExceptionMessage The File Name field is required
|
||||
*/
|
||||
public function testFillEmptyFileName()
|
||||
{
|
||||
$this->expectException(\October\Rain\Exception\ValidationException::class);
|
||||
$this->expectExceptionMessage('The File Name field is required');
|
||||
|
||||
$theme = Theme::load('apitest');
|
||||
|
||||
$testContents = 'mytestcontent';
|
||||
|
|
@ -266,11 +262,12 @@ class CmsObjectTest extends TestCase
|
|||
|
||||
/**
|
||||
* @depends testRename
|
||||
* @expectedException \October\Rain\Exception\ApplicationException
|
||||
* @expectedExceptionMessage already exists
|
||||
*/
|
||||
public function testRenameToExistingFile()
|
||||
{
|
||||
$this->expectException(\October\Rain\Exception\ApplicationException::class);
|
||||
$this->expectExceptionMessageMatches('/already\sexists/');
|
||||
|
||||
$theme = Theme::load('apitest');
|
||||
|
||||
$srcFilePath = $theme->getPath().'/testobjects/anotherobj.htm';
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ class CodeParserTest extends TestCase
|
|||
$parser = new CodeParser($layout);
|
||||
$info = $parser->parse();
|
||||
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertArrayHasKey('filePath', $info);
|
||||
$this->assertArrayHasKey('className', $info);
|
||||
$this->assertArrayHasKey('source', $info);
|
||||
|
|
@ -78,7 +78,7 @@ class CodeParserTest extends TestCase
|
|||
|
||||
$parser = new CodeParser($layout);
|
||||
$info = $parser->parse();
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertEquals('request-cache', $info['source']);
|
||||
$this->assertFileExists($info['filePath']);
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class CodeParserTest extends TestCase
|
|||
|
||||
$parser = new CodeParser($layout);
|
||||
$info = $parser->parse();
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertEquals('cache', $info['source']);
|
||||
$this->assertFileExists($info['filePath']);
|
||||
|
||||
|
|
@ -101,7 +101,7 @@ class CodeParserTest extends TestCase
|
|||
|
||||
$parser = new CodeParser($layout);
|
||||
$info = $parser->parse();
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertEquals('request-cache', $info['source']);
|
||||
$this->assertFileExists($info['filePath']);
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ class CodeParserTest extends TestCase
|
|||
$property->setValue($parser, []);
|
||||
|
||||
$info = $parser->parse();
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertEquals('parser', $info['source']);
|
||||
$this->assertFileExists($info['filePath']);
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ class CodeParserTest extends TestCase
|
|||
$parser = new CodeParser($layout);
|
||||
$info = $parser->parse();
|
||||
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertArrayHasKey('filePath', $info);
|
||||
$this->assertArrayHasKey('className', $info);
|
||||
$this->assertArrayHasKey('source', $info);
|
||||
|
|
@ -157,7 +157,7 @@ class CodeParserTest extends TestCase
|
|||
$parser = new CodeParser($page);
|
||||
$info = $parser->parse();
|
||||
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertArrayHasKey('filePath', $info);
|
||||
$this->assertArrayHasKey('className', $info);
|
||||
$this->assertArrayHasKey('source', $info);
|
||||
|
|
@ -191,7 +191,7 @@ class CodeParserTest extends TestCase
|
|||
$parser = new CodeParser($page);
|
||||
$info = $parser->parse();
|
||||
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertArrayHasKey('filePath', $info);
|
||||
$this->assertArrayHasKey('className', $info);
|
||||
$this->assertArrayHasKey('source', $info);
|
||||
|
|
@ -220,7 +220,7 @@ class CodeParserTest extends TestCase
|
|||
$parser = new CodeParser($page);
|
||||
$info = $parser->parse();
|
||||
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertArrayHasKey('filePath', $info);
|
||||
$this->assertArrayHasKey('className', $info);
|
||||
$this->assertArrayHasKey('source', $info);
|
||||
|
|
@ -255,7 +255,7 @@ class CodeParserTest extends TestCase
|
|||
$parser = new CodeParser($page);
|
||||
$info = $parser->parse();
|
||||
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertArrayHasKey('filePath', $info);
|
||||
$this->assertArrayHasKey('className', $info);
|
||||
$this->assertArrayHasKey('source', $info);
|
||||
|
|
@ -284,7 +284,7 @@ class CodeParserTest extends TestCase
|
|||
$parser = new CodeParser($page);
|
||||
$info = $parser->parse();
|
||||
|
||||
$this->assertInternalType('array', $info);
|
||||
$this->assertIsArray($info);
|
||||
$this->assertArrayHasKey('filePath', $info);
|
||||
$this->assertArrayHasKey('className', $info);
|
||||
$this->assertArrayHasKey('source', $info);
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class ControllerTest extends TestCase
|
|||
$response = $controller->run('/some-page-that-doesnt-exist');
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||
$content = $response->getContent();
|
||||
$this->assertInternalType('string', $content);
|
||||
$this->assertIsString($content);
|
||||
$this->assertEquals('<p>Page not found</p>', $content);
|
||||
}
|
||||
|
||||
|
|
@ -83,16 +83,15 @@ class ControllerTest extends TestCase
|
|||
$response = $controller->run('/');
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||
$content = $response->getContent();
|
||||
$this->assertInternalType('string', $content);
|
||||
$this->assertIsString($content);
|
||||
$this->assertEquals('<h1>My Webpage</h1>', trim($content));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Cms\Classes\CmsException
|
||||
* @expectedExceptionMessage is not found
|
||||
*/
|
||||
public function testLayoutNotFound()
|
||||
{
|
||||
$this->expectException(\Cms\Classes\CmsException::class);
|
||||
$this->expectExceptionMessageMatches('/is\snot\sfound/');
|
||||
|
||||
$theme = Theme::load('test');
|
||||
$controller = new Controller($theme);
|
||||
$response = $controller->run('/no-layout');
|
||||
|
|
@ -146,12 +145,11 @@ class ControllerTest extends TestCase
|
|||
$this->assertEquals("<div>LAYOUT CONTENT <h1>This page is a subdirectory</h1></div>", $response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Twig\Error\RuntimeError
|
||||
* @expectedExceptionMessage is not found
|
||||
*/
|
||||
public function testPartialNotFound()
|
||||
{
|
||||
$this->expectException(\Twig\Error\RuntimeError::class);
|
||||
$this->expectExceptionMessageMatches('/is\snot\sfound/');
|
||||
|
||||
$theme = Theme::load('test');
|
||||
$controller = new Controller($theme);
|
||||
$response = $controller->run('/no-partial')->getContent();
|
||||
|
|
@ -193,12 +191,11 @@ class ControllerTest extends TestCase
|
|||
return $requestMock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Cms\Classes\CmsException
|
||||
* @expectedExceptionMessage AJAX handler 'onNoHandler' was not found.
|
||||
*/
|
||||
public function testAjaxHandlerNotFound()
|
||||
{
|
||||
$this->expectException(\Cms\Classes\CmsException::class);
|
||||
$this->expectExceptionMessage('AJAX handler \'onNoHandler\' was not found.');
|
||||
|
||||
Request::swap($this->configAjaxRequestMock('onNoHandler', ''));
|
||||
|
||||
$theme = Theme::load('test');
|
||||
|
|
@ -206,12 +203,11 @@ class ControllerTest extends TestCase
|
|||
$controller->run('/ajax-test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Cms\Classes\CmsException
|
||||
* @expectedExceptionMessage Invalid AJAX handler name: delete.
|
||||
*/
|
||||
public function testAjaxInvalidHandlerName()
|
||||
{
|
||||
$this->expectException(\Cms\Classes\CmsException::class);
|
||||
$this->expectExceptionMessage('Invalid AJAX handler name: delete.');
|
||||
|
||||
Request::swap($this->configAjaxRequestMock('delete'));
|
||||
|
||||
$theme = Theme::load('test');
|
||||
|
|
@ -219,12 +215,11 @@ class ControllerTest extends TestCase
|
|||
$controller->run('/ajax-test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Cms\Classes\CmsException
|
||||
* @expectedExceptionMessage Invalid partial name: p:artial.
|
||||
*/
|
||||
public function testAjaxInvalidPartial()
|
||||
{
|
||||
$this->expectException(\Cms\Classes\CmsException::class);
|
||||
$this->expectExceptionMessage('Invalid partial name: p:artial.');
|
||||
|
||||
Request::swap($this->configAjaxRequestMock('onTest', 'p:artial'));
|
||||
|
||||
$theme = Theme::load('test');
|
||||
|
|
@ -232,12 +227,11 @@ class ControllerTest extends TestCase
|
|||
$controller->run('/ajax-test');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Cms\Classes\CmsException
|
||||
* @expectedExceptionMessage The partial 'partial' is not found.
|
||||
*/
|
||||
public function testAjaxPartialNotFound()
|
||||
{
|
||||
$this->expectException(\Cms\Classes\CmsException::class);
|
||||
$this->expectExceptionMessage('The partial \'partial\' is not found.');
|
||||
|
||||
Request::swap($this->configAjaxRequestMock('onTest', 'partial'));
|
||||
|
||||
$theme = Theme::load('test');
|
||||
|
|
@ -255,7 +249,7 @@ class ControllerTest extends TestCase
|
|||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||
|
||||
$content = $response->getOriginalContent();
|
||||
$this->assertInternalType('array', $content);
|
||||
$this->assertIsArray($content);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertCount(1, $content);
|
||||
$this->assertArrayHasKey('ajax-result', $content);
|
||||
|
|
@ -272,7 +266,7 @@ class ControllerTest extends TestCase
|
|||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||
|
||||
$content = $response->getOriginalContent();
|
||||
$this->assertInternalType('array', $content);
|
||||
$this->assertIsArray($content);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertCount(1, $content);
|
||||
$this->assertArrayHasKey('ajax-result', $content);
|
||||
|
|
@ -289,7 +283,7 @@ class ControllerTest extends TestCase
|
|||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||
|
||||
$content = $response->getOriginalContent();
|
||||
$this->assertInternalType('array', $content);
|
||||
$this->assertIsArray($content);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertCount(2, $content);
|
||||
$this->assertArrayHasKey('ajax-result', $content);
|
||||
|
|
@ -303,7 +297,7 @@ class ControllerTest extends TestCase
|
|||
$theme = Theme::load('test');
|
||||
$controller = new Controller($theme);
|
||||
$response = $controller->run('/with-component')->getContent();
|
||||
$page = $this->readAttribute($controller, 'page');
|
||||
$page = self::getProtectedProperty($controller, 'page');
|
||||
$this->assertArrayHasKey('testArchive', $page->components);
|
||||
|
||||
$component = $page->components['testArchive'];
|
||||
|
|
@ -331,7 +325,7 @@ ESC;
|
|||
$theme = Theme::load('test');
|
||||
$controller = new Controller($theme);
|
||||
$response = $controller->run('/with-components')->getContent();
|
||||
$page = $this->readAttribute($controller, 'page');
|
||||
$page = self::getProtectedProperty($controller, 'page');
|
||||
|
||||
$this->assertArrayHasKey('firstAlias', $page->components);
|
||||
$this->assertArrayHasKey('secondAlias', $page->components);
|
||||
|
|
@ -363,19 +357,18 @@ ESC;
|
|||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\Response', $response);
|
||||
|
||||
$content = $response->getOriginalContent();
|
||||
$this->assertInternalType('array', $content);
|
||||
$this->assertIsArray($content);
|
||||
$this->assertEquals(200, $response->getStatusCode());
|
||||
$this->assertCount(1, $content);
|
||||
$this->assertArrayHasKey('ajax-result', $content);
|
||||
$this->assertEquals('page', $content['ajax-result']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException October\Rain\Exception\SystemException
|
||||
* @expectedExceptionMessage is not registered for the component
|
||||
*/
|
||||
public function testComponentClassNotFound()
|
||||
{
|
||||
$this->expectException(\October\Rain\Exception\SystemException::class);
|
||||
$this->expectExceptionMessageMatches('/is\snot\sregistered\sfor\sthe\scomponent/');
|
||||
|
||||
$theme = Theme::load('test');
|
||||
$controller = new Controller($theme);
|
||||
$response = $controller->run('/no-component-class')->getContent();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class RouterTest extends TestCase
|
|||
$this->assertFalse($value);
|
||||
$map = $property->getValue($router);
|
||||
|
||||
$this->assertInternalType('array', $map);
|
||||
$this->assertIsArray($map);
|
||||
$this->assertGreaterThanOrEqual(4, count($map));
|
||||
|
||||
/*
|
||||
|
|
@ -52,7 +52,7 @@ class RouterTest extends TestCase
|
|||
$value = $method->invoke($router);
|
||||
$this->assertTrue($value);
|
||||
$map = $property->getValue($router);
|
||||
$this->assertInternalType('array', $map);
|
||||
$this->assertIsArray($map);
|
||||
$this->assertGreaterThanOrEqual(4, count($map));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class ThemeTest extends TestCase
|
|||
|
||||
$pageCollection = $theme->listPages();
|
||||
$pages = array_values($pageCollection->all());
|
||||
$this->assertInternalType('array', $pages);
|
||||
$this->assertIsArray($pages);
|
||||
|
||||
$expectedPageNum = $this->countThemePages(base_path().'/tests/fixtures/themes/test/pages');
|
||||
$this->assertCount($expectedPageNum, $pages);
|
||||
|
|
@ -63,12 +63,11 @@ class ThemeTest extends TestCase
|
|||
$this->assertEquals('test', $activeTheme->getDirName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \October\Rain\Exception\SystemException
|
||||
* @expectedExceptionMessage The active theme is not set.
|
||||
*/
|
||||
public function testNoActiveTheme()
|
||||
{
|
||||
$this->expectException(\October\Rain\Exception\SystemException::class);
|
||||
$this->expectExceptionMessage('The active theme is not set.');
|
||||
|
||||
Config::set('cms.activeTheme', null);
|
||||
Theme::getActiveTheme();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@ class CombineAssetsTest extends TestCase
|
|||
* Supported file extensions should exist
|
||||
*/
|
||||
$jsExt = $cssExt = self::getProtectedProperty($combiner, 'jsExtensions');
|
||||
$this->assertInternalType('array', $jsExt);
|
||||
$this->assertIsArray($jsExt);
|
||||
|
||||
$cssExt = self::getProtectedProperty($combiner, 'cssExtensions');
|
||||
$this->assertInternalType('array', $cssExt);
|
||||
$this->assertIsArray($cssExt);
|
||||
|
||||
/*
|
||||
* Check service methods
|
||||
|
|
|
|||
|
|
@ -60,6 +60,6 @@ class MediaLibraryTest extends TestCase // @codingStandardsIgnoreLine
|
|||
public function testValidPathsOnValidatePath($path)
|
||||
{
|
||||
$result = MediaLibrary::validatePath($path);
|
||||
$this->assertInternalType('string', $result);
|
||||
$this->assertIsString($result);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ class VersionManagerTest extends TestCase
|
|||
$manager = VersionManager::instance();
|
||||
list($comments, $scripts) = self::callProtectedMethod($manager, 'extractScriptsAndComments', [$versionInfo]);
|
||||
|
||||
$this->assertInternalType('array', $comments);
|
||||
$this->assertInternalType('array', $scripts);
|
||||
$this->assertIsArray($comments);
|
||||
$this->assertIsArray($scripts);
|
||||
|
||||
$this->assertEquals($expectedComments, $comments);
|
||||
$this->assertEquals($expectedScripts, $scripts);
|
||||
|
|
|
|||
Loading…
Reference in New Issue