Codeigniter Testing Guide Beginners Guide To Automated Testing in PHP Kenji Suzuki Download
Codeigniter Testing Guide Beginners Guide To Automated Testing in PHP Kenji Suzuki Download
https://ebookbell.com/product/codeigniter-testing-guide-
beginners-guide-to-automated-testing-in-php-kenji-suzuki-5323080
https://ebookbell.com/product/codeigniter-17-jose-argudo-blanco-david-
upton-2008694
https://ebookbell.com/product/codeigniter-17-professional-development-
adam-griffith-2269460
https://ebookbell.com/product/codeigniter-for-rapid-php-application-
development-1st-edition-david-upton-37727030
https://ebookbell.com/product/codeigniter-2-cookbook-rob-
foster-4684162
Codeigniter Web Application Blueprints Develop Fullfeatured Dynamic
Web Applications Using The Powerful Codeigniter Mvc Framework Rob
Foster
https://ebookbell.com/product/codeigniter-web-application-blueprints-
develop-fullfeatured-dynamic-web-applications-using-the-powerful-
codeigniter-mvc-framework-rob-foster-5467510
https://ebookbell.com/product/professional-codeigniter-wrox-
professional-guides-1st-edition-thomas-myer-2539010
https://ebookbell.com/product/practical-codeigniter-3-1st-edition-
lonnie-ezell-12011072
Kenji Suzuki and Mat Whitney
CodeIgniter Testing Guide
Beginners’ Guide to Automated Testing in PHP.
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
The Book at a Glance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . i
What You Need for This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Who should read This Book? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Why PHPUnit? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Is This a CodeIgniter Book? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Is Testing PHP Applications Difficult? . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Is Testing CodeIgniter Applications Difficult? . . . . . . . . . . . . . . . . . . . . v
Testing is Fun and Easy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Conventions Used in This Book . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Errata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Installing Composer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Installing CodeIgniter via Composer . . . . . . . . . . . . . . . . . . . . . . . . . 14
Installing ci-phpunit-test via Composer . . . . . . . . . . . . . . . . . . . . . . . 14
Installing PHPUnit via Composer . . . . . . . . . . . . . . . . . . . . . . . . . . 15
(Optional) Installing PsySH via Composer . . . . . . . . . . . . . . . . . . . . . . 16
3. Test Jargon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.1 Testing levels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Unit Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Integration Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
System Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.2 Testing Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Functional Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Database Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Browser Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Acceptance Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.4 Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.5 Test Doubles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Mocks and Stubs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
4. PHPUnit Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
4.1 Running PHPUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Running All Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Running a Specific Test Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 Running PHPUnit via Web Browser . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Running Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Running All Tests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Running a Specific Test Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
4.3 Configuring PHPUnit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
XML Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Command Line Arguments and Options . . . . . . . . . . . . . . . . . . . . . . 30
4.4 Understanding the Basics by Testing Libraries . . . . . . . . . . . . . . . . . . . . . 33
Basic Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Data Provider . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Fixtures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Assertions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7. Testing Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
7.1 Why is Testing Controllers Difficult? . . . . . . . . . . . . . . . . . . . . . . . . . . 98
7.2 Test Case for the News Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
7.3 Mocking Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
7.4 Authentication and Redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Installing Ion Auth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
Manual Testing with a Web Browser . . . . . . . . . . . . . . . . . . . . . . . . 109
Testing Redirection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Mocking Auth Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
7.5 What if My Controller Needs Something Else? . . . . . . . . . . . . . . . . . . . . . 113
Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
How to Speed Up Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
CONTENTS
Appendix B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
How to Read ci-phpunit-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Structure of ci-phpunit-test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
Bootstrap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Autoloader . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
Replaced Classes and Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
New Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
TestCase classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Request related classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Helper classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Monkey Patch library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
Appendix C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
License Agreement for CodeIgniter and its User Guide . . . . . . . . . . . . . . . . . . . 168
License Agreement for CodeIgniter Rest Server . . . . . . . . . . . . . . . . . . . . . . . 169
License Agreement for Ion Auth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Preface
When I learned PHP for the first time, I did not know about writing test code at all. Nobody
around me was writing test code. There was no PHPUnit (a testing framework for PHP), yet. In
2004, PHPUnit 1.0.0 was released for PHP4. In the same year, PHPUnit 2.0.0 was released for PHP5.
However, I have never used PHPUnit 1 or 2.
When I found CodeIgniter (a PHP web application framework) for the first time, in 2007, it had a
Unit testing class, but there was no test code for the framework itself.
Now, in 2015, more than 10 years have passed since PHPUnit 1.0.0. CodeIgniter 3.0 has its own test
code with PHPUnit, and the code coverage for those tests is around 60%. We are progressing a bit
day by day.
Have you ever written test code for your web application? If you haven’t, you may imagine that
writing test code will be very difficult or bothersome. Maybe you want to write test code, but don’t
know how to do so.
It is common to over-estimate the cost of learning something new, and testing is no exception. After
reading a tutorial for PHPUnit, I thought, “So how do I test my application?” I had trouble seeing
the similarities between the tests in the tutorial and the tests I would need to write for my own
application.
This book is a beginners’ guide for automated testing of PHP web applications. Of course, you will
be able to write test code for any PHP applications after reading this book, but the focus will be on
web applications.
I eschew complexity, favoring simple solutions. I use simple and easy to understand solutions first
in the book, so you won’t get lost. Let’s keep going!
Let’s begin learning about automated testing. First we will explore the basic concepts of automated
testing. We will find out why and what you should test. At the same time, I will explain the ideas
and testing policies used by this book.
i
Preface ii
To run tests in your PHP environment, you will need to install some additional software. For this
book, this includes CodeIgniter, PHPUnit and a tool which acts as a bridge between them, ci-phpunit-
test. If you don’t like command line, you can use VisualPHPUnit to run tests via your web browser.
We define test jargon here. One of the annoying and confusing things in testing is the new
vocabulary required to understand it. By the end of this chapter we’ll help you understand
the difference between Unit, Integration, and System testing; Functional and Acceptance testing;
Fixtures and Mocks; and more.
In this chapter, we will learn the basics of PHPUnit. We will run PHPUnit and learn how to configure
it. After that, we will study PHPUnit conventions and write our first test. We also cover PHPUnit
functionality, data providers, fixtures, and assertions.
You’ve already learned how to write test code, so here we will write tests for a CodeIgniter Tutorial
application. We will write tests for a controller and a model. In this chapter, we will use the database
for model testing.
We will learn more about testing models. We will write tests for models without using the database.
To do this, we will learn about PHPUnit mock objects.
We will learn more about testing controllers in this and the next two chapters. In this chapter, we
will write tests for a controller for reviewing, and write tests with mocking models. We also will
write test cases for authentication and redirects.
We will continue learning to write tests for controllers. In this chapter, we will write unit tests for
controllers, and learn about monkey patching.
In this chapter, we will learn about testing REST controllers. You will learn how to send (emulate)
requests with methods other than GET and POST.
Preface iii
In previous chapters, we have been using PHPUnit. In this chapter, we will learn about another
testing tool. We will install Codeception, learn to configure it, and write tests which work with the
web browser.
Why PHPUnit?
PHPUnit is the de facto standard Testing Framework in the PHP world.
These popular PHP frameworks use PHPUnit for their own tests, and they provide support for
application testing with PHPUnit:
• CakePHP
• FuelPHP
• Laravel
• Symfony
• Yii
• Zend Framework
CodeIgniter 3.0 uses PHPUnit for testing its system code. Support for application testing with
PHPUnit is currently planned for CodeIgniter 4.0.
1 <?php
2
3 echo 'Hello World!';
--- a/CodeIgniter/application/tests/libraries/Temperature_converter_test.php
+++ b/CodeIgniter/application/tests/libraries/Temperature_converter_test.php
@@ -6,7 +6,7 @@ class Temperature_converter_test extends TestCase
{
$obj = new Temperature_converter();
$actual = $obj->FtoC(100);
- $expected = 37.0;
+ $expected = 37.8;
$this->assertEquals($expected, $actual, '', 0.01);
}
}
The listing above is in a format called unified diff. It shows the difference between two files. The
format starts with two-line header, with the path and name of the original file preceded by ---
on the first line, and the new file preceded by +++ on the second line. In some situations, each line
could include a date/time stamp, as well.
In this case, the original file and the new file are the same file (this might not be the case if the file
was moved or renamed, or if the diff was to indicate that the content was moved to a new file).
Following this are one or more change hunks which show areas where the files differ.
The line “@@ -6,7 +6,7 @@” shows the hunk range. The first set of numbers (“-6,7”) indicates the
lines in the original file, the second set (“+6,7”) indicates the lines in the new file. These numbers
are in the format ‘start,count’, where the ‘,count’ may be omitted if the hunk only includes one
line. So, in this example, the hunk starts at line 6 in both files and contains 7 lines in both files.
The contents of the hunk (following the hunk range) contain the lines from the files, with additions
preceded with + (highlighted in green here), and deletions preceded with - (highlighted in red here).
The remaining lines (not preceded with either a - or +) are provided for context.
In short, remove the line(s) starting with - from the original file and add the line(s) starting with
+ to get the new file.
Errata
Although I have taken care to ensure the accuracy of this content, mistakes do happen. If you notice
any mistakes, I would be grateful if you would report them to me. If you find any errata, please file
an issue on GitHub https://github.com/kenjis/codeigniter-testing-guide, and I will update the book
as soon as possible.
1. What is Automated Testing?
Welcome to the testing world!
In this chapter, we will learn about the concept of automated testing and learn why and what you
should test. As we go, we will begin to develop the testing strategy which will be applied by this
book.
hello.php
1 <?php
2
3 function hello()
4 {
5 return 'Hello World!';
6 }
Exercise
At this point, please stop and think about how you would test this function.
Manual Testing
We’ll start with a manual test, printing the result of the function in a page viewed by your web
browser. We’ll place this function in another file, called hello_test_with_your_eyes.php in the
same location as the hello.php file which holds our hello() function.
1
What is Automated Testing? 2
hello_test_with_your_eyes.php
1 <?php
2
3 require __DIR__ . '/hello.php';
4
5 echo hello();
If you navigate to hello_test_with_your_eyes.php in your browser and see Hello World!, the
function and the test both work fine.
Alternatively, you can just run it from PHP’s Command Line Interface (CLI):
$ php hello_test_with_your_eyes.php
Hello World!
Automated Testing
What if, instead of manually checking the results in a web browser, you write code to test your
application? The following is some very primitive test code for our primitive hello.php application.
We would place this code in a file called hello_test_automated.php alongside our application and
our manual test.
What is Automated Testing? 3
hello_test_automated.php
1 <?php
2
3 error_reporting(-1);
4
5 require __DIR__ . '/hello.php';
6
7 function assertTrue($condition)
8 {
9 if (! $condition) {
10 throw new Exception('Assertion failed.');
11 }
12 }
13
14 $actual = hello();
15 $expected = 'Hello World!';
16 assertTrue($expected === $actual);
If you run this code, you probably won’t see anything, unless the hello() function returns
something unexpected, in which case you will receive a fatal PHP error and a stack trace.
If our hello() function does not return 'Hello World!', our test will fail. Since the code verifies
that the result of executing the function matches the expected result, rather than having to verify
the result in a browser (or in the CLI) for ourselves, we call this automated testing. Using automated
tests, you could run the test code every time you make a change, or at a certain time every day,
because it is PHP code!
When writing an automated test, you think of what you would do to test the code by hand or how
you might confirm the code is working properly, then write code which will do the testing for you.
In the long run, this means you can spend less time manually testing your code, and it will protect
your code base from unexpected changes.
Automated testing has two features:
• it is very fast,
• so you can run tests very often.
This example is simple, so you might think the test is nonsense. However, if you expect a certain
output given a certain input, the complexity of the function you are testing has very little impact on
the complexity of the test, so even very complicated functions might have tests with code which is
similar to the test we have created for our primitive hello function.
In my opinion, the most important thing is reducing fear. If we have well-tested code, we can change
and improve it without fear that we might break existing code.
CHAPTER IX.
ETRUSKAN ART.
The first settlers in Etruria—T
heir gods of the
first and second orders—T he ritual of
thunder—T emples and tombs—S ubdivision of
tombs—Cinerary chests—Excavations at
Præneste—Pottery and metal works—T heir
style either Archaic or Etruskan—Division of
Etruskan works of art into five principal
categories 212
CHAPTER X.
ROMAN ART.
Characteristic differences between Greeks and
Romans—T he triple theocracy of Rome—T he
mythical period of the seven kings of Rome
—Rome as republic—Roman mythology—
Rome under the emperors—Roman public
games—Roman literature the outgrowth of
Greek literature—Polylithic wall decorations—
The arch, cross-vault, and cupola—Periods of
Roman art and their subdivisions—T emples—
Fora and theatres—T he mausoleum of
Augustus—Hadrian, the divine architect—
Triumphal arches—T he baths of Caracalla—
The advent of Christianity 228
CHAPTER XI.
EARLY CHRISTIAN ART.
North and south of our globe—Buddhism and
Christianity—Christ’s divine teachings—
Romanesque and Byzantine art-forms—
Symbols, allegories, emblems, and myths—
Catacombs at Rome and Naples—T he
sacredness of the number seven—Christian
art in its essence and different phases—T he
spiritual element predominates—T he first
Christian churches—Constantine—Ravenna
and its early churches—S t. Sophia in the
Byzantine style—Migration of northern
nations—T heir religious notions—T
he
Teutons turn Christians—W ood and ivory
carvings—A rt in its relation to the
progressive development of mankind—
Summary and conclusion 264
Bibliography for the study of the historical
development of Art 301
Index 305
MANUAL
OF THE
HISTORICAL DEVELOPMENT OF
ART
CHAPTER I.
PROLEGOMENA.
A.
The realistic school has in later years had an immense influence
with us. Art-critics have almost gone so far as to demand from the
artist a correct rendering of the very stratification of rocks; or of the
different kinds of soil, to such a degree that the farmer should be
able to recognise the ground in which to sow oats or wheat.
Pictures, according to these estheticists, should be geological maps,
mineralogical collections, and, so far as flowers are concerned,
perfect herbariums. When this school takes up the archæological
view, it clings with indomitable tenacity to given forms, and checks
imagination. Art is then only to be handled as the Greeks or Romans
practised it. Either the Gothic or the Renaissance style is to be
slavishly imitated. This school has one great drawback: it considers
all things natural beautiful, and looks upon an imitation of that which
was as better than an exertion of the self-creative originality of the
artist.
B.
The historical school endeavours to bring before our eyes the
past, so as to enable us to understand the present, and to influence
the future of art. This school has followed two divergent directions,
the Antique and the Gothic, the classical or romantic; the one
holding that everything beautiful must be based upon Greek
patterns; the other that all beauty is confined to the Gothic. The
writers of these two schools bewilder the students; either driving
them into a cold, soulless imitation of classic forms, or forcing them
to sacrifice everything to trefoils, pinnacles, tracery, finials,
buttresses, thin spires, painted windows, and pointed arches.
C.
The critical school indulges in tall phrases, mere hypothetical
paradoxes, often startling the world with speculations of the wildest
sort. Art-critics frequently roam in the spheres of surmises; they
have their good points, but often neglect reality, or the historical
ground; they sacrifice everything to the idea, which is with them the
only productive basis of everything existing in art.
We shall try to be realistic, as it would be vain to attempt to
detach art from the influences of nature; for art borrows its principal
elements from the impressions of natural phenomena. We shall be
historical, and point out the progressive development of art; and,
lastly, we shall endeavour to be critical. Speculative philosophy has
its merits in art. Esthetical criticism suggests new ideas, and new
ideas engender new forms. We shall endeavour to adopt from each
of the three schools what is best. Our age is an age of eclecticism in
art. We must, however, try to prepare for a period of original vitality,
which can only be done by avoiding one-sidedness and heedless
originality. We shall try to suggest and to excite in our readers new
thoughts. As music speaks in sounds, poetry in words, so art in
forms; but music, poetry, and art are subject to certain rules, without
which harmony would become dissonance, poetry an inflated prose,
and art a tasteless entity, of which quaintness will be the only
distinguishing attribute. What we call our sense of beauty is based
on those laws which make the existence of the universe possible.
The Greeks used for beauty in art the same word, as for order, or
the perfect arrangement of the universe. The word κόσμος {kosmos}
(from which we have ‘cosmetic,’ any beautifying application) may
teach us how we should look upon works of art, which ought to be a
reflection of the general laws ruling nature.
Two forces guide our material and intellectual life. We possess
two means of acquiring knowledge and of practising art: reason and
experience. Impressions from without are the everlasting source of
all our conceptions. Hunger and thirst drive us to seek nourishment,
to become fishers, hunters, herdsmen, or agriculturists. Cold and
heat force us to seek a shelter, to construct wigwams, huts,
dwellings on piles, cottages, houses, palaces, and temples.
Though order and harmony prevail in the outer world, every
atom of the universe is endowed with an unconscious will or life of
its own. Atoms seek atoms according to inherent laws, or fly from or
annihilate one another. The whole process of life around us appears
to be one never-ending struggle. Apparently there rules only the law
of chance and might; what cannot conquer is conquered.
History is one long catalogue of appearing and disappearing
nations, of devouring and devoured kingdoms and empires. It is as
though generation after generation had emerged from the spectral
past into the sanguinary present, to destroy or to be destroyed. This
conflict in the outer world is seconded by everlasting conflicts in our
inner world. Fear, hope, love—passions of all kinds, imagination and
reality, ignorance and knowledge, pride and humility, prejudice and
wisdom, form an intellectual hurricane not less destructive than the
warfare of the cosmical elements. Religion, Science, and Art, this
divine triad, step in. Religion excites in us the hope of higher and
better morals; science creates consciousness of the laws according
to which we are governed; the link between cause and effect is
traced, and the rule of arbitrary chance narrowed. Lastly, art throws
its beautifying halo on everything. Thus these three are instrumental
in elevating our mind, expanding our intellectual powers, and
bringing harmony and beauty into the eternal conflict. Faith is the
element of religion, experience the element of knowledge, and
beauty the element of art. Whilst faith and experience are possible
without an artistic elevation of the mind, art must combine the
elements of religion and science, and form through beauty a visible
link between these elements.
The sublime, as we have said, rules in the universe. Clouds
chase one another and are subject to everlasting changes. Trees
cover the surface of our globe, forming woods at random. Mountains
are towered up, as if hurled together by chance. Seas form a
bewildering variety of coasts. Streams wind their paths through
mountains and valleys with capricious irregularity. All these
phenomena confuse and oppress us, they engender an
incomprehensible, indistinct feeling in us. But so soon as we begin
with our intellectual force to sift, to separate, and to detach single
phenomena from the general mass—as soon as choice begins to
work, the isolated phenomenon displays at once its symmetrical
beauty.
III.
Finally we have the Aryan, the long or oval-headed man
(dolichokephalous), the historical, the white man, the crowning
product of the cosmical forces of nature. His facial lines are
composed of the two conflicting elements, the
horizontal and the vertical line, and are framed in by an
oval. His amount of brain is on an average 92 cubic
inches, and his facial angle 90 degrees. His
development is not limited. This group of mankind,
though divided into many different types (races or
nations), which have arisen from an intermixture with
the other two groups, or through the influences of climate, food, and
the aspect of nature, stands at the highest point of civilisation. As
the lines of his face are admirably counterbalanced, and his body is a
master-piece of regularity and proportion, he has tried to establish a
perfect balance between the conflicting forces in his moral and
intellectual nature. To him exclusively we owe art in its highest
sense. Once he stood on the same level with the primitive black
savage, then he advanced to the ingenuity of the yellow man, and
left both far behind him in his gradual but always progressive
development. He surpasses the other two groups of humanity, not
only in technical skill, but especially in inventive and reasoning
power, critical discernment, and purity of artistic taste. The white
man alone, has produced idealised master-pieces in sculpture and
painting.
The white man in his architecture uses either the horizontal or
the vertical line, or both; he takes the triangular building of the
negro and places it on the square tent of the yellow man, making his
house as perfect as possible; he goes further, and, in accordance
with his powerfully-arched brow, over-arches not only rivers and
chasms, but builds his magnificent cupolas and pointed arches, the
acme of architectural forms.
Ethnology then serves us as a foundation for the study of art in
its different phases.
Conforming to the general tendency of modern science, we have
tried to express the cause of the artistic development of the three
groups of humanity by figures; we have measured the seat and
instrument of our intellectual faculty, and have thus tried to leave the
sphere of mere conjecture, or unfounded opinion, in order to place
the phenomena of art-history on a firm basis. Though art,
undoubtedly, belongs ‘to the magic circle of the imagination, and the
inner powers of the mind,’ those powers are dependent on our very
bodily construction, the amount of brain and the facial angle. We do
not deal in mere hypothesis, but submit to our readers a complete
theory borne out by facts.
In considering the frontispiece of our manual, representing the
‘Tree of Art,’ we can visibly trace the slow and gradual development
of the white man. The negro fixes our attention only as savage; the
yellow man has a line of his own, and has remained stationary in his
artistic development; the white man has passed through the savage
stages, and by his own exertions, undergoing various phases of rise
and decline (the real signs of historical vitality), has steadily
progressed till he began to attempt, and to succeed in bringing
about, ‘a harmonious connection between the representation of
nature and the expression of awakened emotion, and a mysterious
analogy between the emotions of his mind and the phenomena
perceived by his senses.’
As all phenomena must take place in space and time (the two
fundamental forms of all existence), the products of art must also
have been executed under these two conditions, and can therefore
be treated historically.
Space is the expansion and extension of the forces of nature into
the infinite. Time is the limitation of this activity. Without space no
object could arrive at completion. Without time the subject would be
eternal. These are the two counteracting elements. The one, space,
is positive—the other, time, negative. Time is either relative or
absolute. If relative, it can be measured by an ascertained
succession of events. If absolute, it becomes measurable by years.
In both we can trace a gradual and successive development of
artistic forms. In general, time relative, with its succession of
products, is more reliable than time labelled with voluntary and more
than doubtful dates. For instance, we cannot measure the periods of
the formation of the earth’s crust by years, and still we are perfectly
convinced that the tertiary formation could not have taken place
before the primary; thus we are justified in assuming that the iron
period must have succeeded the stone or bronze period; bronze
instruments never being found with iron handles, whilst iron blades
have ornamented wooden or bronze handles. Man naturally scarcely
ever uses the worse material for a practical purpose when he has
once found a better one; but he will use the softer material as a
means of ornamentation.
That we have plenty of ‘survivals’ in art, as well as in nature,
does not in any way militate against the strict logic of facts. The
lowest forms of animals have mostly survived (like the lowest forms
of ornamentation), yet no one can doubt or deny the gradual and
systematic development of the vegetable and animal kingdoms. If
we find no fragments of pottery in Australia, New Zealand, or the
Polynesian islands, we cannot assume that a grand and powerful
civilisation has perished there, leaving no traces behind. In finding
different kinds of pottery, gradually improving even in the quality of
the material—the clay being first unwashed, then mixed with grains
of quartz and felspar, next carefully washed, then sun-baked, then
fire-baked; first hand and then wheel turned, and at last glazed,
unornamented or ornamented—we cannot assume that the order
was inverted, and that man first ornamented glazed pottery, which
he turned out on the wheel, and then went back to unwashed clay
and hand-made pottery. The ‘degeneration theory’ has exploded as
entirely as the geocentric and anthropocentric theories have
vanished. We know that man, like flowers, trees, rocks and animals,
is the product of the combined forces of nature and the influences of
climate and food, and that his religious, social, and political
conditions are closely reflected in his art. As little as our globe is the
centre of the universe, or man the centre of creation, so little did art
or science spring at once perfectly armed, provided with spear and
shield, from Jupiter’s head like blue-eyed Athene. In a certain sense
art and science are both of divine origin, but only so far as the
originating and creative power is concerned, which, once set in
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
ebookbell.com