aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/CoreBundle/Event
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-07-01 09:52:38 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-07-01 09:52:38 +0200
commitf808b01692a835673f328d7221ba8c212caa9b61 (patch)
tree0c3b1fc5b1ddbd7af72227303503177689e1d403 /tests/Wallabag/CoreBundle/Event
parent822c877949aff8ae57677671115f8f4fc69588d5 (diff)
downloadwallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.gz
wallabag-f808b01692a835673f328d7221ba8c212caa9b61.tar.zst
wallabag-f808b01692a835673f328d7221ba8c212caa9b61.zip
Add a real configuration for CS-Fixer
Diffstat (limited to 'tests/Wallabag/CoreBundle/Event')
-rw-r--r--tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php28
-rw-r--r--tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php4
-rw-r--r--tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php18
3 files changed, 25 insertions, 25 deletions
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php
index 84a54d3a..0dbd9f70 100644
--- a/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php
+++ b/tests/Wallabag/CoreBundle/Event/Listener/LocaleListenerTest.php
@@ -13,15 +13,6 @@ use Wallabag\CoreBundle\Event\Listener\LocaleListener;
13 13
14class LocaleListenerTest extends \PHPUnit_Framework_TestCase 14class LocaleListenerTest extends \PHPUnit_Framework_TestCase
15{ 15{
16 private function getEvent(Request $request)
17 {
18 $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')
19 ->disableOriginalConstructor()
20 ->getMock();
21
22 return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
23 }
24
25 public function testWithoutSession() 16 public function testWithoutSession()
26 { 17 {
27 $request = Request::create('/'); 18 $request = Request::create('/');
@@ -30,7 +21,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase
30 $event = $this->getEvent($request); 21 $event = $this->getEvent($request);
31 22
32 $listener->onKernelRequest($event); 23 $listener->onKernelRequest($event);
33 $this->assertEquals('en', $request->getLocale()); 24 $this->assertSame('en', $request->getLocale());
34 } 25 }
35 26
36 public function testWithPreviousSession() 27 public function testWithPreviousSession()
@@ -44,7 +35,7 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase
44 $event = $this->getEvent($request); 35 $event = $this->getEvent($request);
45 36
46 $listener->onKernelRequest($event); 37 $listener->onKernelRequest($event);
47 $this->assertEquals('fr', $request->getLocale()); 38 $this->assertSame('fr', $request->getLocale());
48 } 39 }
49 40
50 public function testLocaleFromRequestAttribute() 41 public function testLocaleFromRequestAttribute()
@@ -59,8 +50,8 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase
59 $event = $this->getEvent($request); 50 $event = $this->getEvent($request);
60 51
61 $listener->onKernelRequest($event); 52 $listener->onKernelRequest($event);
62 $this->assertEquals('en', $request->getLocale()); 53 $this->assertSame('en', $request->getLocale());
63 $this->assertEquals('es', $request->getSession()->get('_locale')); 54 $this->assertSame('es', $request->getSession()->get('_locale'));
64 } 55 }
65 56
66 public function testSubscribedEvents() 57 public function testSubscribedEvents()
@@ -81,6 +72,15 @@ class LocaleListenerTest extends \PHPUnit_Framework_TestCase
81 $event 72 $event
82 ); 73 );
83 74
84 $this->assertEquals('fr', $request->getLocale()); 75 $this->assertSame('fr', $request->getLocale());
76 }
77
78 private function getEvent(Request $request)
79 {
80 $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')
81 ->disableOriginalConstructor()
82 ->getMock();
83
84 return new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
85 } 85 }
86} 86}
diff --git a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php
index 45aecc63..91ce0102 100644
--- a/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php
+++ b/tests/Wallabag/CoreBundle/Event/Listener/UserLocaleListenerTest.php
@@ -32,7 +32,7 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase
32 32
33 $listener->onInteractiveLogin($event); 33 $listener->onInteractiveLogin($event);
34 34
35 $this->assertEquals('fr', $session->get('_locale')); 35 $this->assertSame('fr', $session->get('_locale'));
36 } 36 }
37 37
38 public function testWithoutLanguage() 38 public function testWithoutLanguage()
@@ -53,6 +53,6 @@ class UserLocaleListenerTest extends \PHPUnit_Framework_TestCase
53 53
54 $listener->onInteractiveLogin($event); 54 $listener->onInteractiveLogin($event);
55 55
56 $this->assertEquals('', $session->get('_locale')); 56 $this->assertSame('', $session->get('_locale'));
57 } 57 }
58} 58}
diff --git a/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php
index b8cd0fad..64e3c6d9 100644
--- a/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php
+++ b/tests/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriberTest.php
@@ -46,12 +46,12 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
46 46
47 $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); 47 $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em);
48 48
49 $this->assertEquals($tableNameExpected, $metaDataEvent->getClassMetadata()->getTableName()); 49 $this->assertSame($tableNameExpected, $metaDataEvent->getClassMetadata()->getTableName());
50 50
51 $subscriber->loadClassMetadata($metaDataEvent); 51 $subscriber->loadClassMetadata($metaDataEvent);
52 52
53 $this->assertEquals($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); 53 $this->assertSame($finalTableName, $metaDataEvent->getClassMetadata()->getTableName());
54 $this->assertEquals($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); 54 $this->assertSame($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform));
55 } 55 }
56 56
57 /** 57 /**
@@ -75,8 +75,8 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
75 75
76 $evm->dispatchEvent('loadClassMetadata', $metaDataEvent); 76 $evm->dispatchEvent('loadClassMetadata', $metaDataEvent);
77 77
78 $this->assertEquals($finalTableName, $metaDataEvent->getClassMetadata()->getTableName()); 78 $this->assertSame($finalTableName, $metaDataEvent->getClassMetadata()->getTableName());
79 $this->assertEquals($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform)); 79 $this->assertSame($finalTableNameQuoted, $metaDataEvent->getClassMetadata()->getQuotedTableName($platform));
80 } 80 }
81 81
82 public function testPrefixManyToMany() 82 public function testPrefixManyToMany()
@@ -103,12 +103,12 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
103 103
104 $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); 104 $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em);
105 105
106 $this->assertEquals('entry', $metaDataEvent->getClassMetadata()->getTableName()); 106 $this->assertSame('entry', $metaDataEvent->getClassMetadata()->getTableName());
107 107
108 $subscriber->loadClassMetadata($metaDataEvent); 108 $subscriber->loadClassMetadata($metaDataEvent);
109 109
110 $this->assertEquals('yo_entry', $metaDataEvent->getClassMetadata()->getTableName()); 110 $this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getTableName());
111 $this->assertEquals('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']); 111 $this->assertSame('yo_entry_tag', $metaDataEvent->getClassMetadata()->associationMappings['tags']['joinTable']['name']);
112 $this->assertEquals('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform())); 112 $this->assertSame('yo_entry', $metaDataEvent->getClassMetadata()->getQuotedTableName(new \Doctrine\DBAL\Platforms\MySqlPlatform()));
113 } 113 }
114} 114}